mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-17 06:09:19 +00:00
Bug 1912810 - Don't call ShouldAllowAccessFor if GetURI returns null. r=bvandersloot
Differential Revision: https://phabricator.services.mozilla.com/D219614
This commit is contained in:
parent
8bfa144ed7
commit
0b53a24daa
@ -850,12 +850,24 @@ BasePrincipal::HasFirstpartyStorageAccess(mozIDOMWindow* aCheckWindow,
|
||||
*aRejectedReason = 0;
|
||||
*aOutAllowed = false;
|
||||
|
||||
if (IsSystemPrincipal()) {
|
||||
// System principal is always considered to have first-party storage access.
|
||||
*aOutAllowed = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsPIDOMWindowInner* win = nsPIDOMWindowInner::From(aCheckWindow);
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = GetURI(getter_AddRefs(uri));
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
// The uri could be null if the principal is an expanded principal.
|
||||
if (!uri) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
*aOutAllowed = ShouldAllowAccessFor(win, uri, aRejectedReason);
|
||||
return NS_OK;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user