mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-19 15:51:33 +00:00
Bug 1776109 - Part 1: Fall back to nsIPrincipal in StorageAllowedForWindow r=asuth,anti-tracking-reviewers,pbz
Differential Revision: https://phabricator.services.mozilla.com/D150282
This commit is contained in:
parent
388ea3d223
commit
4bbf6a056b
@ -235,7 +235,16 @@ StorageAccess StorageAllowedForWindow(nsPIDOMWindowInner* aWindow,
|
||||
*aRejectedReason);
|
||||
}
|
||||
|
||||
// No document? Let's return a generic rejected reason.
|
||||
// No document? Try checking Private Browsing Mode without document
|
||||
if (const nsCOMPtr<nsIGlobalObject> global = aWindow->AsGlobal()) {
|
||||
if (const nsCOMPtr<nsIPrincipal> principal = global->PrincipalOrNull()) {
|
||||
if (principal->GetPrivateBrowsingId() > 0) {
|
||||
return StorageAccess::ePrivateBrowsing;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Everything failed? Let's return a generic rejected reason.
|
||||
return StorageAccess::eDeny;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user