зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1298823 - Make Request constructor throw less often, r=qdot
This commit is contained in:
Родитель
d2afbdd254
Коммит
f4d88a4bee
|
@ -340,8 +340,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()) {
|
||||
|
@ -376,11 +375,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -405,11 +400,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
[referrer-origin-worker.html]
|
||||
type: testharness
|
||||
[Cross-origin referrer is overridden by client origin]
|
||||
expected: FAIL
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
[referrer-origin.html]
|
||||
type: testharness
|
||||
[Cross-origin referrer is overridden by client origin]
|
||||
expected: FAIL
|
||||
|
Загрузка…
Ссылка в новой задаче