mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-23 18:26:15 +00:00
Bug 1517526 - Let user allow blocked autoplay. r=johannh
Differential Revision: https://phabricator.services.mozilla.com/D17130 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
fb4355013b
commit
d13fedb2c6
@ -1055,7 +1055,8 @@ var gIdentityHandler = {
|
||||
SitePermissions.SCOPE_POLICY, SitePermissions.SCOPE_GLOBAL,
|
||||
].includes(aPermission.scope);
|
||||
|
||||
if (aPermission.id == "popup" && !isPolicyPermission) {
|
||||
if ((aPermission.id == "popup" && !isPolicyPermission) ||
|
||||
aPermission.id == "autoplay-media") {
|
||||
let menulist = document.createXULElement("menulist");
|
||||
let menupopup = document.createXULElement("menupopup");
|
||||
let block = document.createXULElement("vbox");
|
||||
|
@ -54,8 +54,27 @@ add_task(async function testMainViewVisible() {
|
||||
let labels = permissionsList.querySelectorAll(".identity-popup-permission-label");
|
||||
is(labels.length, 1, "One permission visible in main view");
|
||||
is(labels[0].textContent, labelText, "Correct value");
|
||||
|
||||
let menulist = document.getElementById("identity-popup-popup-menulist");
|
||||
Assert.equal(menulist.label, "Block");
|
||||
|
||||
await EventUtils.synthesizeMouseAtCenter(menulist, { type: "mousedown" });
|
||||
await BrowserTestUtils.waitForCondition(() => {
|
||||
return menulist.getElementsByTagName("menuitem")[0].label === "Allow";
|
||||
});
|
||||
|
||||
let menuitem = menulist.getElementsByTagName("menuitem")[0];
|
||||
Assert.equal(menuitem.getAttribute("label"), "Allow");
|
||||
|
||||
menuitem.click();
|
||||
menulist.menupopup.hidePopup();
|
||||
await closeIdentityPopup();
|
||||
|
||||
let uri = Services.io.newURI(AUTOPLAY_PAGE);
|
||||
let state = SitePermissions.get(uri, "autoplay-media").state;
|
||||
Assert.equal(state, SitePermissions.ALLOW);
|
||||
});
|
||||
|
||||
Services.perms.removeAll();
|
||||
Services.prefs.clearUserPref("media.autoplay.default");
|
||||
});
|
||||
|
@ -706,6 +706,7 @@ var gPermissionObject = {
|
||||
return SitePermissions.UNKNOWN;
|
||||
},
|
||||
labelID: "autoplay-media",
|
||||
states: [ SitePermissions.ALLOW, SitePermissions.BLOCK ],
|
||||
},
|
||||
|
||||
"image": {
|
||||
|
Loading…
Reference in New Issue
Block a user