Issue #618 - Don't mute errors for module scripts because they always use CORS

This commit is contained in:
Jon Coppeard 2020-08-22 07:08:10 +00:00 • committed by Roy Tam
commit 75f3f09fc6

View file

@ -2446,10 +2446,10 @@ ScriptLoader::PrepareLoadedRequest(ScriptLoadRequest* aRequest,
} }
nsCOMPtr<nsIChannel> channel = do_QueryInterface(req); nsCOMPtr<nsIChannel> channel = do_QueryInterface(req);
// If this load was subject to a CORS check; don't flag it with a // If this load was subject to a CORS check, don't flag it with a separate
// separate origin principal, so that it will treat our document's // origin principal, so that it will treat our document's principal as the
// principal as the origin principal // origin principal. Module loads always use CORS.
if (aRequest->mCORSMode == CORS_NONE) { if (!aRequest->IsModuleRequest() && aRequest->mCORSMode == CORS_NONE) {
rv = nsContentUtils::GetSecurityManager()-> rv = nsContentUtils::GetSecurityManager()->
GetChannelResultPrincipal(channel, getter_AddRefs(aRequest->mOriginPrincipal)); GetChannelResultPrincipal(channel, getter_AddRefs(aRequest->mOriginPrincipal));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);