зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1608588 - Auto-deny `desktop-notification` permission appropriately r=geckoview-reviewers,esawin
This causes us to automatically deny the `desktop-notification` permission if there is no user interaction, like desktop Firefox. This is not enforced if the `dom.webnotifications.requireuserinteraction` preference is set to `false` Differential Revision: https://phabricator.services.mozilla.com/D60758 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
dd6f2af24c
Коммит
e2ee347144
|
@ -236,6 +236,19 @@ GeckoViewPermission.prototype = {
|
|||
}
|
||||
|
||||
let perm = types.queryElementAt(0, Ci.nsIContentPermissionType);
|
||||
if (
|
||||
perm.type === "desktop-notification" &&
|
||||
!aRequest.isHandlingUserInput &&
|
||||
Services.prefs.getBoolPref(
|
||||
"dom.webnotifications.requireuserinteraction",
|
||||
true
|
||||
)
|
||||
) {
|
||||
// We need user interaction and don't have it.
|
||||
aRequest.cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
let dispatcher = GeckoViewUtils.getDispatcherForWindow(
|
||||
aRequest.window ? aRequest.window : aRequest.element.ownerGlobal
|
||||
);
|
||||
|
|
|
@ -219,6 +219,7 @@ class PermissionDelegateTest : BaseSessionTest() {
|
|||
}
|
||||
|
||||
@Test fun notification() {
|
||||
sessionRule.setPrefsUntilTestEnd(mapOf("dom.webnotifications.requireuserinteraction" to false))
|
||||
mainSession.loadTestPath(HELLO_HTML_PATH)
|
||||
mainSession.waitForPageStop()
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче