зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1498369 - Ensure the promise returned from Document.hasStorageAccess() will propagate user activation r=baku
Differential Revision: https://phabricator.services.mozilla.com/D9011 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
fbfee407a0
Коммит
9d62cd6360
|
@ -13653,7 +13653,8 @@ nsIDocument::HasStorageAccess(mozilla::ErrorResult& aRv)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<Promise> promise = Promise::Create(global, aRv);
|
||||
RefPtr<Promise> promise = Promise::Create(global, aRv,
|
||||
Promise::ePropagateUserInteraction);
|
||||
if (aRv.Failed()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,20 @@ AntiTracking.runTest("Storage Access API returns promises that maintain user act
|
|||
});
|
||||
ok(!threw, "requestStorageAccess should not throw");
|
||||
ok(!rejected, "requestStorageAccess should be available");
|
||||
|
||||
let dwu = SpecialPowers.getDOMWindowUtils(window);
|
||||
let helper = dwu.setHandlingUserInput(true);
|
||||
|
||||
let promise;
|
||||
try {
|
||||
promise = document.hasStorageAccess();
|
||||
} finally {
|
||||
helper.destruct();
|
||||
}
|
||||
await promise.then(_ => {
|
||||
ok(dwu.isHandlingUserInput,
|
||||
"Promise handler must run as if we're handling user input");
|
||||
});
|
||||
},
|
||||
|
||||
null, // non-blocking callback
|
||||
|
|
Загрузка…
Ссылка в новой задаче