Bug 1298823 - Make Request constructor throw less often, r=qdot

This commit is contained in:
Andrea Marchesini 2017-02-28 18:53:53 +01:00
Родитель d2afbdd254
Коммит f4d88a4bee
3 изменённых файлов: 6 добавлений и 22 удалений

Просмотреть файл

@ -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