Bug 1602090 part 2. Create separate CheckMayLoad and CheckMayLoadWithReporting APIs. r=ckerschb

CheckMayLoadAndReport takes a window ID.  This allows us to report
errors from it to the web console as needed.  Most consumers know statically
whether they want reporting or not, so there's no reason to force the ones that
don't to provide window ids.

Differential Revision: https://phabricator.services.mozilla.com/D56388
This commit is contained in:
Boris Zbarsky
2019-12-13 06:24:12 +00:00
parent 6792639b59
commit fcb04b87e4
19 changed files with 165 additions and 43 deletions

View File

@@ -676,7 +676,8 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
aPrincipal->OriginAttributesRef().mPrivateBrowsingId > 0);
NS_ENSURE_SUCCESS(rv, rv);
// Check the principal is allowed to load the target.
return aPrincipal->CheckMayLoad(targetBaseURI, true, false);
// Unfortunately we don't have a window id to work with here...
return aPrincipal->CheckMayLoadWithReporting(targetBaseURI, false, 0);
}
//-- get the source scheme