summaryrefslogtreecommitdiffstats
path: root/dom/fetch/Request.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dom/fetch/Request.cpp')
-rw-r--r--dom/fetch/Request.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/dom/fetch/Request.cpp b/dom/fetch/Request.cpp
index d3836cda1..7ca5b43c4 100644
--- a/dom/fetch/Request.cpp
+++ b/dom/fetch/Request.cpp
@@ -338,8 +338,7 @@ Request::Constructor(const GlobalObject& aGlobal,
if (mode == RequestMode::Navigate ||
(aInit.IsAnyMemberPresent() && request->Mode() == RequestMode::Navigate)) {
- aRv.ThrowTypeError<MSG_INVALID_REQUEST_MODE>(NS_LITERAL_STRING("navigate"));
- return nullptr;
+ mode = RequestMode::Same_origin;
}
if (aInit.IsAnyMemberPresent()) {
@@ -374,11 +373,7 @@ Request::Constructor(const GlobalObject& aGlobal,
nsresult rv = principal->CheckMayLoad(uri, /* report */ false,
/* allowIfInheritsPrincipal */ false);
if (NS_FAILED(rv)) {
- nsAutoCString globalOrigin;
- principal->GetOrigin(globalOrigin);
- aRv.ThrowTypeError<MSG_CROSS_ORIGIN_REFERRER_URL>(referrer,
- NS_ConvertUTF8toUTF16(globalOrigin));
- return nullptr;
+ referrerURL.AssignLiteral(kFETCH_CLIENT_REFERRER_STR);
}
}
}
@@ -403,11 +398,10 @@ Request::Constructor(const GlobalObject& aGlobal,
// this work in a single sync loop.
RefPtr<ReferrerSameOriginChecker> checker =
new ReferrerSameOriginChecker(worker, referrerURL, rv);
- checker->Dispatch(Terminating, aRv);
- if (aRv.Failed() || NS_FAILED(rv)) {
- aRv.ThrowTypeError<MSG_CROSS_ORIGIN_REFERRER_URL>(referrer,
- worker->GetLocationInfo().mOrigin);
- return nullptr;
+ IgnoredErrorResult error;
+ checker->Dispatch(Terminating, error);
+ if (error.Failed() || NS_FAILED(rv)) {
+ referrerURL.AssignLiteral(kFETCH_CLIENT_REFERRER_STR);
}
}
}