diff options
author | Moonchild <mcwerewolf@gmail.com> | 2018-07-05 22:23:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-05 22:23:02 +0200 |
commit | 52d608c670c5c485cfe1139c40ec06d8ef460a26 (patch) | |
tree | 91d27a6911b77ae9e70ca3ba64929a92d6ea14ed /dom/fetch/Request.cpp | |
parent | c3fe7f59c8b6c1a23f5ae85f0697470fad560d68 (diff) | |
parent | 3815302230bc043f98667c1ee0de6dee15969034 (diff) | |
download | UXP-52d608c670c5c485cfe1139c40ec06d8ef460a26.tar UXP-52d608c670c5c485cfe1139c40ec06d8ef460a26.tar.gz UXP-52d608c670c5c485cfe1139c40ec06d8ef460a26.tar.lz UXP-52d608c670c5c485cfe1139c40ec06d8ef460a26.tar.xz UXP-52d608c670c5c485cfe1139c40ec06d8ef460a26.zip |
Merge pull request #599 from janekptacijarabaci/dom_fetch_request_navigate_1
Added support for Request constructor with "mode: navigate"
Diffstat (limited to 'dom/fetch/Request.cpp')
-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 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); } } } |