diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-07-05 13:08:32 +0200 |
---|---|---|
committer | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-07-05 13:08:32 +0200 |
commit | bfeac5c28ddb60531f25d7d99d0299a5161b9a8e (patch) | |
tree | 6d8516615e60a04243a976f2b1a76e16e8e845ea /dom/fetch | |
parent | a80267e9e88b3dcebf7f8f1f6f10931a99ddf2ca (diff) | |
download | uxp-bfeac5c28ddb60531f25d7d99d0299a5161b9a8e.tar.gz |
Bug 1298823 - Fix Request constructor - with "mode: navigate"
Diffstat (limited to 'dom/fetch')
-rw-r--r-- | dom/fetch/Request.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/dom/fetch/Request.cpp b/dom/fetch/Request.cpp index d3836cda10..7ca5b43c4f 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); } } } |