Bug 1192927 - Remove plugins specific code and initialize the flash plugin row in Page Info and support flash in Site Identity. r=Felipe,johannh

MozReview-Commit-ID: 3KUbgencO3M

--HG--
extra : rebase_source : d8cbf97c6764fd3700a7cbc6d5dc19565b97bad1
This commit is contained in:
Prathiksha 2018-02-18 00:20:11 +05:30
parent c3a7bce436
commit 30e02230c8
15 changed files with 47 additions and 342 deletions

View File

@ -8072,14 +8072,19 @@ var gIdentityHandler = {
container.setAttribute("align", "center");
let img = document.createElement("image");
let classes = "identity-popup-permission-icon " + aPermission.id + "-icon";
img.classList.add("identity-popup-permission-icon");
if (aPermission.id == "plugin:flash") {
img.classList.add("plugin-icon");
} else {
img.classList.add(aPermission.id + "-icon");
}
if (aPermission.state == SitePermissions.BLOCK)
classes += " blocked-permission-icon";
img.classList.add("blocked-permission-icon");
if (aPermission.sharingState == Ci.nsIMediaManagerService.STATE_CAPTURE_ENABLED ||
(aPermission.id == "screen" && aPermission.sharingState &&
!aPermission.sharingState.includes("Paused"))) {
classes += " in-use";
img.classList.add("in-use");
// Synchronize control center and identity block blinking animations.
window.promiseDocumentFlushed(() => {}).then(() => {
@ -8097,7 +8102,6 @@ var gIdentityHandler = {
}
});
}
img.setAttribute("class", classes);
let nameLabel = document.createElement("label");
nameLabel.setAttribute("flex", "1");
@ -8159,7 +8163,7 @@ var gIdentityHandler = {
state = SitePermissions.ALLOW;
scope = SitePermissions.SCOPE_REQUEST;
}
stateLabel.textContent = SitePermissions.getCurrentStateLabel(state, scope);
stateLabel.textContent = SitePermissions.getCurrentStateLabel(state, aPermission.id, scope);
container.appendChild(img);
container.appendChild(nameLabel);

View File

@ -816,6 +816,8 @@
tooltiptext="&urlbar.popupBlocked.tooltip;"/>
<image data-permission-id="canvas" class="blocked-permission-icon canvas-icon" role="button"
tooltiptext="&urlbar.canvasBlocked.tooltip;"/>
<image data-permission-id="plugin:flash" class="blocked-permission-icon plugin-icon" role="button"
tooltiptext="&urlbar.flashPluginBlocked.tooltip;"/>
<image data-permission-id="midi" class="blocked-permission-icon midi-icon" role="button"
tooltiptext="&urlbar.midiBlocked.tooltip;"/>
</box>

View File

@ -45,10 +45,6 @@
<command id="cmd_help" oncommand="doHelpButton();"/>
<command id="cmd_copy" oncommand="doCopy();"/>
<command id="cmd_selectall" oncommand="doSelectAll();"/>
<!-- permissions tab -->
<command id="cmd_pluginsDef" oncommand="onCheckboxClick('plugins');"/>
<command id="cmd_pluginsToggle" oncommand="onPluginRadioClick(event);"/>
</commandset>
<keyset id="pageInfoKeySet">
@ -278,23 +274,7 @@
crop="end" flex="1"/>
</hbox>
<vbox id="permList" flex="1">
<vbox class="permission" id="perm-plugins-row">
<label class="permissionLabel" id="permPluginsLabel"
value="&permPlugins;" control="pluginsRadioGroup"/>
<hbox id="permPluginTemplate" role="group" aria-labelledby="permPluginsLabel" align="baseline">
<label class="permPluginTemplateLabel"/>
<spacer flex="1"/>
<radiogroup class="permPluginTemplateRadioGroup" orient="horizontal" command="cmd_pluginsToggle">
<radio class="permPluginTemplateRadioDefault" label="&permUseDefault;"/>
<radio class="permPluginTemplateRadioAsk" label="&permAskAlways;"/>
<radio class="permPluginTemplateRadioAllow" label="&permAllow;"/>
<radio class="permPluginTemplateRadioHide" label="&permHide;"/>
<radio class="permPluginTemplateRadioBlock" label="&permBlock;"/>
</radiogroup>
</hbox>
</vbox>
</vbox>
<vbox id="permList" flex="1"/>
<hbox pack="end">
<button command="cmd_help" label="&helpButton.label;" dlgtype="help"/>
</hbox>

View File

@ -23,11 +23,8 @@ var permissionObserver = {
observe(aSubject, aTopic, aData) {
if (aTopic == "perm-changed") {
var permission = aSubject.QueryInterface(Ci.nsIPermission);
if (permission.matchesURI(gPermURI, true)) {
if (gPermissions.indexOf(permission.type) > -1)
if (permission.matchesURI(gPermURI, true) && gPermissions.includes(permission.type)) {
initRow(permission.type);
else if (permission.type.startsWith("plugin"))
setPluginsRadioState();
}
}
}
@ -60,11 +57,6 @@ function onUnloadPermission() {
}
function initRow(aPartId) {
if (aPartId == "plugins") {
initPluginsRow();
return;
}
createRow(aPartId);
var checkbox = document.getElementById(aPartId + "Def");
@ -72,6 +64,11 @@ function initRow(aPartId) {
var {state, scope} = SitePermissions.get(gPermURI, aPartId);
let defaultState = SitePermissions.getDefault(aPartId);
// When flash permission state is "Hide", we show it as "Always Ask" in page info.
if (aPartId.startsWith("plugin") && state == SitePermissions.PROMPT_HIDE) {
defaultState == SitePermissions.UNKNOWN ? state = defaultState : state = SitePermissions.PROMPT;
}
if (state != defaultState) {
checkbox.checked = false;
command.removeAttribute("disabled");
@ -158,10 +155,6 @@ function onCheckboxClick(aPartId) {
}
}
function onPluginRadioClick(aEvent) {
onRadioClick(aEvent.originalTarget.getAttribute("id").split("#")[0]);
}
function onRadioClick(aPartId) {
var radioGroup = document.getElementById(aPartId + "RadioGroup");
var id = radioGroup.selectedItem.id;
@ -175,90 +168,3 @@ function setRadioState(aPartId, aValue) {
radio.radioGroup.selectedItem = radio;
}
}
function fillInPluginPermissionTemplate(aPluginName, aPermissionString) {
let permPluginTemplate = document.getElementById("permPluginTemplate").cloneNode(true);
permPluginTemplate.setAttribute("permString", aPermissionString);
let attrs = [
[ ".permPluginTemplateLabel", "value", aPluginName ],
[ ".permPluginTemplateRadioGroup", "id", aPermissionString + "RadioGroup" ],
[ ".permPluginTemplateRadioDefault", "id", aPermissionString + "#0" ],
[ ".permPluginTemplateRadioAsk", "id", aPermissionString + "#3" ],
[ ".permPluginTemplateRadioAllow", "id", aPermissionString + "#1" ],
// #8 comes from Ci.nsIObjectLoadingContent.PLUGIN_PERMISSION_PROMPT_ACTION_QUIET
[ ".permPluginTemplateRadioHide", "id", aPermissionString + "#8"],
[ ".permPluginTemplateRadioBlock", "id", aPermissionString + "#2" ]
];
for (let attr of attrs) {
permPluginTemplate.querySelector(attr[0]).setAttribute(attr[1], attr[2]);
}
return permPluginTemplate;
}
function clearPluginPermissionTemplate() {
let permPluginTemplate = document.getElementById("permPluginTemplate");
permPluginTemplate.hidden = true;
permPluginTemplate.removeAttribute("permString");
document.querySelector(".permPluginTemplateLabel").removeAttribute("value");
document.querySelector(".permPluginTemplateRadioGroup").removeAttribute("id");
document.querySelector(".permPluginTemplateRadioAsk").removeAttribute("id");
document.querySelector(".permPluginTemplateRadioAllow").removeAttribute("id");
document.querySelector(".permPluginTemplateRadioBlock").removeAttribute("id");
}
function initPluginsRow() {
let vulnerableLabel = document.getElementById("browserBundle").getString("pluginActivateVulnerable.label");
let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
let permissionMap = new Map();
for (let plugin of pluginHost.getPluginTags()) {
if (plugin.disabled) {
continue;
}
for (let mimeType of plugin.getMimeTypes()) {
let permString = pluginHost.getPermissionStringForType(mimeType);
if (!permissionMap.has(permString)) {
let name = BrowserUtils.makeNicePluginName(plugin.name);
if (permString.startsWith("plugin-vulnerable:")) {
name += " \u2014 " + vulnerableLabel;
}
permissionMap.set(permString, name);
}
}
}
let entries = Array.from(permissionMap, item => ({ name: item[1], permission: item[0] }));
entries.sort(function(a, b) {
return a.name.localeCompare(b.name);
});
let permissionEntries = entries.map(p => fillInPluginPermissionTemplate(p.name, p.permission));
let permPluginsRow = document.getElementById("perm-plugins-row");
clearPluginPermissionTemplate();
if (permissionEntries.length < 1) {
permPluginsRow.hidden = true;
return;
}
for (let permissionEntry of permissionEntries) {
permPluginsRow.appendChild(permissionEntry);
}
setPluginsRadioState();
}
function setPluginsRadioState() {
let box = document.getElementById("perm-plugins-row");
for (let permissionEntry of box.childNodes) {
if (permissionEntry.hasAttribute("permString")) {
let permString = permissionEntry.getAttribute("permString");
let permission = SitePermissions.get(gPermURI, permString);
setRadioState(permString, permission.state);
}
}
}

View File

@ -96,7 +96,6 @@ tags = blocklist
skip-if = !crashreporter
[browser_pluginCrashCommentAndURL.js]
skip-if = !crashreporter
[browser_pageInfo_plugins.js]
[browser_pluginCrashReportNonDeterminism.js]
skip-if = !crashreporter
[browser_private_clicktoplay.js]

View File

@ -1,187 +0,0 @@
var gHttpTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
var gPageInfo = null;
var gNextTest = null;
var gTestBrowser = null;
var gPluginHost = Cc["@mozilla.org/plugin/host;1"]
.getService(Ci.nsIPluginHost);
var gTestPermissionString = gPluginHost.getPermissionStringForType("application/x-test");
var gSecondTestPermissionString = gPluginHost.getPermissionStringForType("application/x-second-test");
function doOnPageLoad(url, continuation) {
gNextTest = continuation;
BrowserTestUtils.browserLoaded(gTestBrowser).then(pageLoad);
gTestBrowser.loadURI(url);
}
function pageLoad() {
// The plugin events are async dispatched and can come after the load event
// This just allows the events to fire before we then go on to test the states
executeSoon(gNextTest);
}
function doOnOpenPageInfo(continuation) {
Services.obs.addObserver(pageInfoObserve, "page-info-dialog-loaded");
gNextTest = continuation;
// An explanation: it looks like the test harness complains about leaked
// windows if we don't keep a reference to every window we've opened.
// So, don't reuse pointers to opened Page Info windows - simply append
// to this list.
gPageInfo = BrowserPageInfo(null, "permTab");
}
function pageInfoObserve(win, topic, data) {
Services.obs.removeObserver(pageInfoObserve, "page-info-dialog-loaded");
gPageInfo.onFinished.push(() => executeSoon(gNextTest));
}
function finishTest() {
Services.perms.remove(makeURI("http://127.0.0.1:8888/"), gTestPermissionString);
Services.perms.remove(makeURI("http://127.0.0.1:8888/"), gSecondTestPermissionString);
Services.prefs.clearUserPref("plugins.click_to_play");
gBrowser.removeCurrentTab();
gPageInfo = null;
gNextTest = null;
gTestBrowser = null;
gPluginHost = null;
executeSoon(finish);
}
function test() {
waitForExplicitFinish();
Services.prefs.setBoolPref("plugins.click_to_play", true);
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Second Test Plug-in");
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
gTestBrowser = gBrowser.selectedBrowser;
Services.perms.remove(makeURI("http://127.0.0.1:8888/"), gTestPermissionString);
Services.perms.remove(makeURI("http://127.0.0.1:8888/"), gSecondTestPermissionString);
doOnPageLoad(gHttpTestRoot + "plugin_two_types.html", testPart1a);
}
// The first test plugin is CtP and the second test plugin is enabled.
function testPart1a() {
let testElement = gTestBrowser.contentDocumentAsCPOW.getElementById("test");
let objLoadingContent = testElement.QueryInterface(Ci.nsIObjectLoadingContent);
ok(!objLoadingContent.activated, "part 1a: Test plugin should not be activated");
let secondtest = gTestBrowser.contentDocumentAsCPOW.getElementById("secondtestA");
objLoadingContent = secondtest.QueryInterface(Ci.nsIObjectLoadingContent);
ok(objLoadingContent.activated, "part 1a: Second Test plugin should be activated");
doOnOpenPageInfo(testPart1b);
}
function testPart1b() {
let testRadioGroup = gPageInfo.document.getElementById(gTestPermissionString + "RadioGroup");
let testRadioDefault = gPageInfo.document.getElementById(gTestPermissionString + "#0");
is(testRadioGroup.selectedItem, testRadioDefault, "part 1b: Test radio group should be set to 'Default'");
let testRadioAllow = gPageInfo.document.getElementById(gTestPermissionString + "#1");
testRadioGroup.selectedItem = testRadioAllow;
testRadioAllow.doCommand();
let secondtestRadioGroup = gPageInfo.document.getElementById(gSecondTestPermissionString + "RadioGroup");
let secondtestRadioDefault = gPageInfo.document.getElementById(gSecondTestPermissionString + "#0");
is(secondtestRadioGroup.selectedItem, secondtestRadioDefault, "part 1b: Second Test radio group should be set to 'Default'");
let secondtestRadioAsk = gPageInfo.document.getElementById(gSecondTestPermissionString + "#3");
secondtestRadioGroup.selectedItem = secondtestRadioAsk;
secondtestRadioAsk.doCommand();
doOnPageLoad(gHttpTestRoot + "plugin_two_types.html", testPart2);
}
// Now, the Test plugin should be allowed, and the Test2 plugin should be CtP
function testPart2() {
let testElement = gTestBrowser.contentDocumentAsCPOW.getElementById("test").
QueryInterface(Ci.nsIObjectLoadingContent);
ok(testElement.activated, "part 2: Test plugin should be activated");
let secondtest = gTestBrowser.contentDocumentAsCPOW.getElementById("secondtestA").
QueryInterface(Ci.nsIObjectLoadingContent);
ok(!secondtest.activated, "part 2: Second Test plugin should not be activated");
is(secondtest.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY,
"part 2: Second test plugin should be click-to-play.");
let testRadioGroup = gPageInfo.document.getElementById(gTestPermissionString + "RadioGroup");
let testRadioAllow = gPageInfo.document.getElementById(gTestPermissionString + "#1");
is(testRadioGroup.selectedItem, testRadioAllow, "part 2: Test radio group should be set to 'Allow'");
let testRadioBlock = gPageInfo.document.getElementById(gTestPermissionString + "#2");
testRadioGroup.selectedItem = testRadioBlock;
testRadioBlock.doCommand();
let secondtestRadioGroup = gPageInfo.document.getElementById(gSecondTestPermissionString + "RadioGroup");
let secondtestRadioAsk = gPageInfo.document.getElementById(gSecondTestPermissionString + "#3");
is(secondtestRadioGroup.selectedItem, secondtestRadioAsk, "part 2: Second Test radio group should be set to 'Always Ask'");
let secondtestRadioBlock = gPageInfo.document.getElementById(gSecondTestPermissionString + "#2");
secondtestRadioGroup.selectedItem = secondtestRadioBlock;
secondtestRadioBlock.doCommand();
doOnPageLoad(gHttpTestRoot + "plugin_two_types.html", testPart3);
}
// Now, all the things should be blocked
function testPart3() {
let testElement = gTestBrowser.contentDocumentAsCPOW.getElementById("test").
QueryInterface(Ci.nsIObjectLoadingContent);
ok(!testElement.activated, "part 3: Test plugin should not be activated");
is(testElement.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_DISABLED,
"part 3: Test plugin should be marked as PLUGIN_DISABLED");
let secondtest = gTestBrowser.contentDocumentAsCPOW.getElementById("secondtestA").
QueryInterface(Ci.nsIObjectLoadingContent);
ok(!secondtest.activated, "part 3: Second Test plugin should not be activated");
is(secondtest.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_DISABLED,
"part 3: Second test plugin should be marked as PLUGIN_DISABLED");
// reset permissions
Services.perms.remove(makeURI("http://127.0.0.1:8888/"), gTestPermissionString);
Services.perms.remove(makeURI("http://127.0.0.1:8888/"), gSecondTestPermissionString);
// check that changing the permissions affects the radio state in the
// open Page Info window
let testRadioGroup = gPageInfo.document.getElementById(gTestPermissionString + "RadioGroup");
let testRadioDefault = gPageInfo.document.getElementById(gTestPermissionString + "#0");
is(testRadioGroup.selectedItem, testRadioDefault, "part 3: Test radio group should be set to 'Default'");
let secondtestRadioGroup = gPageInfo.document.getElementById(gSecondTestPermissionString + "RadioGroup");
let secondtestRadioDefault = gPageInfo.document.getElementById(gSecondTestPermissionString + "#0");
is(secondtestRadioGroup.selectedItem, secondtestRadioDefault, "part 3: Second Test radio group should be set to 'Default'");
doOnPageLoad(gHttpTestRoot + "plugin_two_types.html", testPart4a);
}
// Now test that setting permission directly (as from the popup notification)
// immediately influences Page Info.
function testPart4a() {
// simulate "allow" from the doorhanger
Services.perms.add(gTestBrowser.currentURI, gTestPermissionString, Ci.nsIPermissionManager.ALLOW_ACTION);
Services.perms.add(gTestBrowser.currentURI, gSecondTestPermissionString, Ci.nsIPermissionManager.ALLOW_ACTION);
// check (again) that changing the permissions affects the radio state in the
// open Page Info window
let testRadioGroup = gPageInfo.document.getElementById(gTestPermissionString + "RadioGroup");
let testRadioAllow = gPageInfo.document.getElementById(gTestPermissionString + "#1");
is(testRadioGroup.selectedItem, testRadioAllow, "part 4a: Test radio group should be set to 'Allow'");
let secondtestRadioGroup = gPageInfo.document.getElementById(gSecondTestPermissionString + "RadioGroup");
let secondtestRadioAllow = gPageInfo.document.getElementById(gSecondTestPermissionString + "#1");
is(secondtestRadioGroup.selectedItem, secondtestRadioAllow, "part 4a: Second Test radio group should be set to 'Always Allow'");
// now close Page Info and see that it opens with the right settings
gPageInfo.close();
doOnOpenPageInfo(testPart4b);
}
// check that "always allow" resulted in the radio buttons getting set to allow
function testPart4b() {
let testRadioGroup = gPageInfo.document.getElementById(gTestPermissionString + "RadioGroup");
let testRadioAllow = gPageInfo.document.getElementById(gTestPermissionString + "#1");
is(testRadioGroup.selectedItem, testRadioAllow, "part 4b: Test radio group should be set to 'Allow'");
let secondtestRadioGroup = gPageInfo.document.getElementById(gSecondTestPermissionString + "RadioGroup");
let secondtestRadioAllow = gPageInfo.document.getElementById(gSecondTestPermissionString + "#1");
is(secondtestRadioGroup.selectedItem, secondtestRadioAllow, "part 4b: Second Test radio group should be set to 'Allow'");
Services.prefs.setBoolPref("plugins.click_to_play", false);
gPageInfo.close();
finishTest();
}

View File

@ -235,6 +235,7 @@ These should match what Safari and other Apple applications use on OS X Lion. --
<!ENTITY urlbar.persistentStorageBlocked.tooltip "You have blocked persistent storage for this website.">
<!ENTITY urlbar.popupBlocked.tooltip "You have blocked pop-ups for this website.">
<!ENTITY urlbar.canvasBlocked.tooltip "You have blocked canvas data extraction for this website.">
<!ENTITY urlbar.flashPluginBlocked.tooltip "You have blocked this website from using the Adobe Flash plugin.">
<!ENTITY urlbar.midiBlocked.tooltip "You have blocked MIDI access for this website.">
<!ENTITY urlbar.openHistoryPopup.tooltip "Show history">

View File

@ -318,21 +318,10 @@ pluginActivate.learnMore=Learn More…
pluginActivateOutdated.message=%3$S has prevented the outdated plugin “%1$S” from running on %2$S.
pluginActivateOutdated.label=Outdated plugin
pluginActivate.updateLabel=Update now…
# LOCALIZATION NOTE (pluginActivateVulnerable.message, pluginActivateVulnerable.label):
# These strings are used when an unsafe plugin has no update available.
# LOCALIZATION NOTE (pluginActivateVulnerable.message):
# This string is used when an unsafe plugin has no update available.
# %1$S is the plugin name, %2$S is the domain, and %3$S is brandShortName.
pluginActivateVulnerable.message=%3$S has prevented the unsafe plugin “%1$S” from running on %2$S.
pluginActivateVulnerable.label=Vulnerable plugin!
pluginActivate.riskLabel=Whats the risk?
# LOCALIZATION NOTE (pluginActivateBlocked.message): %1$S is the plugin name, %2$S is brandShortName
pluginActivateBlocked.message=%2$S has blocked “%1$S” for your protection.
pluginActivateBlocked.label=Blocked for your protection
pluginActivateDisabled.message=“%S” is disabled.
pluginActivateDisabled.label=Disabled
pluginActivateDisabled.manage=Manage plugins…
pluginEnabled.message=“%S” is enabled on %S.
pluginEnabledOutdated.message=Outdated plugin “%S” is enabled on %S.
pluginEnabledVulnerable.message=Insecure plugin “%S” is enabled on %S.
pluginInfo.unknownPlugin=Unknown
# LOCALIZATION NOTE (pluginActivateNow.label, pluginActivateAlways.label, pluginBlockNow.label): These should be the same as the matching strings in browser.dtd

View File

@ -49,14 +49,7 @@
<!ENTITY permTab "Permissions">
<!ENTITY permTab.accesskey "P">
<!ENTITY permUseDefault "Use Default">
<!ENTITY permAskAlways "Always ask">
<!ENTITY permAllow "Allow">
<!ENTITY permAllowSession "Allow for Session">
<!ENTITY permHide "Hide">
<!ENTITY permBlock "Block">
<!ENTITY permissionsFor "Permissions for:">
<!ENTITY permPlugins "Activate Plugins">
<!ENTITY securityTab "Security">
<!ENTITY securityTab.accesskey "S">

View File

@ -6,7 +6,8 @@
# state.current.allowedForSession,
# state.current.allowedTemporarily,
# state.current.blockedTemporarily,
# state.current.blocked):
# state.current.blocked,
# state.current.hide):
# This label is used to display active permission states in the site
# identity popup (which does not have a lot of screen space).
state.current.allowed = Allowed
@ -15,6 +16,7 @@ state.current.allowedTemporarily = Allowed Temporarily
state.current.blockedTemporarily = Blocked Temporarily
state.current.blocked = Blocked
state.current.prompt = Always Ask
state.current.hide = Hide Prompt
# LOCALIZATION NOTE (state.multichoice.alwaysAsk,
# state.multichoice.allow,
@ -39,5 +41,6 @@ permission.shortcuts.label = Override Keyboard Shortcuts
permission.focus-tab-by-prompt.label = Switch to this Tab
permission.persistent-storage.label = Store Data in Persistent Storage
permission.canvas.label = Extract Canvas Data
permission.flash-plugin.label = Activate Adobe Flash plugin
permission.midi.label = Access MIDI Devices
permission.midi-sysex.label = Access MIDI Devices with SysEx Support

View File

@ -138,11 +138,14 @@ const TemporaryBlockedPermissions = {
*/
var SitePermissions = {
// Permission states.
// PROMPT_HIDE state is only used to show the "Hide Prompt" state in the identity panel
// for the "plugin:flash" permission and not in pageinfo.
UNKNOWN: Services.perms.UNKNOWN_ACTION,
ALLOW: Services.perms.ALLOW_ACTION,
BLOCK: Services.perms.DENY_ACTION,
PROMPT: Services.perms.PROMPT_ACTION,
ALLOW_COOKIES_FOR_SESSION: Ci.nsICookiePermission.ACCESS_SESSION,
PROMPT_HIDE: Ci.nsIObjectLoadingContent.PLUGIN_PERMISSION_PROMPT_ACTION_QUIET,
// Permission scopes.
SCOPE_REQUEST: "{SitePermissions.SCOPE_REQUEST}",
@ -538,13 +541,21 @@ var SitePermissions = {
*
* @param {SitePermissions state} state
* The state to get the label for.
* @param {string} id
* The permission to get the state label for.
* @param {SitePermissions scope} scope (optional)
* The scope to get the label for.
*
* @return {String|null} the localized label or null if an
* unknown state was passed.
*/
getCurrentStateLabel(state, scope = null) {
getCurrentStateLabel(state, id, scope = null) {
// We try to avoid a collision between SitePermissions.PROMPT_HIDE
// and SitePermissions.ALLOW_COOKIES_FOR_SESSION which share the same const value.
if (id.startsWith("plugin") && state == SitePermissions.PROMPT_HIDE) {
return gStringBundle.GetStringFromName("state.current.hide");
}
switch (state) {
case this.PROMPT:
return gStringBundle.GetStringFromName("state.current.prompt");
@ -585,6 +596,8 @@ var gPermissionObject = {
* - states
* Array of permission states to be exposed to the user.
* Defaults to ALLOW, BLOCK and the default state (see getDefault).
* The PROMPT_HIDE state is deliberately excluded from "plugin:flash" since we
* don't want to expose a "Hide Prompt" button to the user through pageinfo.
*/
"image": {
@ -657,6 +670,11 @@ var gPermissionObject = {
"canvas": {
},
"plugin:flash": {
labelID: "flash-plugin",
states: [ SitePermissions.UNKNOWN, SitePermissions.ALLOW, SitePermissions.BLOCK ],
},
"midi": {
exactHostMatch: true
},

View File

@ -12,7 +12,7 @@ const MIDI_ENABLED = Services.prefs.getBoolPref("dom.webmidi.enabled");
add_task(async function testPermissionsListing() {
let expectedPermissions = ["camera", "cookie", "desktop-notification", "focus-tab-by-prompt",
"geo", "image", "install", "microphone", "popup", "screen", "shortcuts"];
"geo", "image", "install", "microphone", "plugin:flash", "popup", "screen", "shortcuts"];
if (STORAGE_MANAGER_ENABLED) {
// The persistent-storage permission is still only pref-on on Nightly
// so we add it only when it's pref-on.
@ -131,7 +131,7 @@ add_task(async function testExactHostMatch() {
exactHostMatched.push("midi");
exactHostMatched.push("midi-sysex");
}
let nonExactHostMatched = ["image", "cookie", "popup", "install", "shortcuts"];
let nonExactHostMatched = ["image", "cookie", "plugin:flash", "popup", "install", "shortcuts"];
let permissions = SitePermissions.listPermissions();
for (let permission of permissions) {

View File

@ -239,9 +239,8 @@ html|*#webRTC-previewVideo {
transition: fill 1.5s;
}
.plugin-blocked-icon {
.plugin-icon.blocked-permission-icon {
list-style-image: url(chrome://mozapps/skin/plugins/plugin-blocked.svg);
transition: fill 1.5s;
}
#plugin-icon-badge {

View File

@ -168,7 +168,6 @@
"browser/base/content/test/plugins/browser_blocklist_content.js": 3470,
"browser/base/content/test/plugins/browser_clearplugindata.js": 2972,
"browser/base/content/test/plugins/browser_iterate_hidden_plugins.js": 3683,
"browser/base/content/test/plugins/browser_pageInfo_plugins.js": 3850,
"browser/base/content/test/plugins/browser_pluginCrashCommentAndURL.js": 4903,
"browser/base/content/test/plugins/browser_pluginnotification.js": 10941,
"browser/base/content/test/plugins/browser_plugins_added_dynamically.js": 2627,

View File

@ -171,7 +171,6 @@
"browser/base/content/test/plugins/browser_blocking.js": 6301,
"browser/base/content/test/plugins/browser_clearplugindata.js": 1970,
"browser/base/content/test/plugins/browser_iterate_hidden_plugins.js": 2260,
"browser/base/content/test/plugins/browser_pageInfo_plugins.js": 2521,
"browser/base/content/test/plugins/browser_pluginCrashCommentAndURL.js": 3550,
"browser/base/content/test/plugins/browser_pluginCrashReportNonDeterminism.js": 3141,
"browser/base/content/test/plugins/browser_pluginnotification.js": 8135,