зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1848783, part 1 - Add active document check - r=anti-tracking-reviewers,timhuang
Differential Revision: https://phabricator.services.mozilla.com/D186982
This commit is contained in:
Родитель
5005011998
Коммит
09cd45ddba
|
@ -17234,6 +17234,12 @@ already_AddRefed<mozilla::dom::Promise> Document::HasStorageAccess(
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
if (!IsCurrentActiveDocument()) {
|
||||
promise->MaybeRejectWithInvalidStateError(
|
||||
"hasStorageAccess requires an active document");
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
bool hasStorageAccess;
|
||||
nsresult rv = HasStorageAccessSync(hasStorageAccess);
|
||||
if (NS_FAILED(rv)) {
|
||||
|
@ -17432,6 +17438,12 @@ already_AddRefed<mozilla::dom::Promise> Document::RequestStorageAccess(
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
if (!IsCurrentActiveDocument()) {
|
||||
promise->MaybeRejectWithInvalidStateError(
|
||||
"requestStorageAccess requires an active document");
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
// Get a pointer to the inner window- We need this for convenience sake
|
||||
RefPtr<nsPIDOMWindowInner> inner = GetInnerWindow();
|
||||
if (!inner) {
|
||||
|
|
|
@ -845,6 +845,10 @@ Maybe<bool> StorageAccessAPIHelper::CheckCallingContextDecidesStorageAccessAPI(
|
|||
return Some(true);
|
||||
}
|
||||
|
||||
if (!aDocument->IsCurrentActiveDocument()) {
|
||||
return Some(false);
|
||||
}
|
||||
|
||||
if (aRequestingStorageAccess) {
|
||||
// Perform a Permission Policy Request
|
||||
dom::FeaturePolicy* policy = aDocument->FeaturePolicy();
|
||||
|
|
Загрузка…
Ссылка в новой задаче