diff options
Diffstat (limited to 'components/permissions/aboutPermissions.xml')
-rw-r--r-- | components/permissions/aboutPermissions.xml | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/components/permissions/aboutPermissions.xml b/components/permissions/aboutPermissions.xml new file mode 100644 index 0000000..2932ea0 --- /dev/null +++ b/components/permissions/aboutPermissions.xml @@ -0,0 +1,113 @@ +<?xml version="1.0"?> +<!-- This Source Code Form is subject to the terms of the Mozilla Public + - License, v. 2.0. If a copy of the MPL was not distributed with this + - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> + +<!DOCTYPE bindings [ +<!ENTITY % aboutPermissionsDTD SYSTEM "chrome://browser/locale/permissions/aboutPermissions.dtd" > +%aboutPermissionsDTD; +]> + +<bindings xmlns="http://www.mozilla.org/xbl" + xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + xmlns:xbl="http://www.mozilla.org/xbl"> + <binding id="site" extends="chrome://global/content/bindings/richlistbox.xml#richlistitem"> + <content> + <xul:hbox class="site-container" align="center" flex="1"> + <xul:image xbl:inherits="src=favicon" class="site-favicon"/> + <xul:label xbl:inherits="value,selected" class="site-domain" crop="end" flex="1"/> + </xul:hbox> + </content> + </binding> + + <binding id="pluginPermission"> + <content> + <xul:hbox flex="1" align="baseline"> + <xul:label xbl:inherits="value=label" class="plugins-label"/> + <xul:label xbl:inherits="value=vulnerable" class="plugins-vulnerable"/> + <xul:label xbl:inherits="value=default" anonid="plugins-default" class="plugins-default"/> + <xul:spacer flex="1"/> + <xul:menulist anonid="plugins-menulist" + class="pref-menulist" + oncommand="AboutPermissions.onPermissionCommand(event, false);"> + <xul:menupopup> + <xul:menuitem anonid="ask" value="0" label="&permission.alwaysAsk;"/> + <xul:menuitem anonid="allow" value="1" label="&permission.allow;"/> + <xul:menuitem anonid="block" value="2" label="&permission.block;"/> + </xul:menupopup> + </xul:menulist> + <xul:button xbl:inherits="value=set-default" + anonid="plugins-set-default" + class="pref-set-default" + label="&permission.default;" + oncommand="AboutPermissions.onPermissionCommand(event, true);"/> + </xul:hbox> + </content> + <implementation> + <constructor><![CDATA[ + let mimeType = this.getAttribute("mimeType"); + let permString = this.getAttribute("permString"); + let menulist = document.getAnonymousElementByAttribute(this, "anonid", "plugins-menulist"); + menulist.setAttribute("id", permString + "-menulist"); + menulist.setAttribute("mimeType", mimeType); + menulist.setAttribute("type", permString); + let askitem = document.getAnonymousElementByAttribute(this, "anonid", "ask"); + askitem.setAttribute("id", permString + "-0"); + let allowitem = document.getAnonymousElementByAttribute(this, "anonid", "allow"); + allowitem.setAttribute("id", permString + "-1"); + let blockitem = document.getAnonymousElementByAttribute(this, "anonid", "block"); + blockitem.setAttribute("id", permString + "-2"); + let _default = document.getAnonymousElementByAttribute(this, "anonid", "plugins-default"); + this.setDefaultVisibility(false); + _default.setAttribute("value", "*"); + let _setDefault = document.getAnonymousElementByAttribute(this, "anonid", "plugins-set-default"); + _setDefault.setAttribute("id", permString + "-set-default"); + _setDefault.setAttribute("class", "pref-set-default"); + _setDefault.setAttribute("type", permString); + ]]> + </constructor> + <method name="setDefaultVisibility"> + <parameter name="visibility" /> + <body><![CDATA[ + let _default = document.getAnonymousElementByAttribute(this, "anonid", "plugins-default"); + if (visibility) { + _default.style.visibility = "visible"; + } else { + _default.style.visibility = "hidden"; + } + ]]> + </body> + </method> + <method name="isClickToPlay"> + <body><![CDATA[ + let pluginHost = Components.classes["@mozilla.org/plugin/host;1"] + .getService(Components.interfaces.nsIPluginHost); + let mimeType = this.getAttribute("mimeType"); + return (pluginHost.getStateForType(mimeType) + == Components.interfaces.nsIPluginTag.STATE_CLICKTOPLAY); + ]]> + </body> + </method> + <method name="isBlocklisted"> + <body><![CDATA[ + let pluginHost = Components.classes["@mozilla.org/plugin/host;1"] + .getService(Components.interfaces.nsIPluginHost); + let blocklistService = Components.classes["@mozilla.org/extensions/blocklist;1"] + .getService(Components.interfaces.nsIBlocklistService); + let mimeType = this.getAttribute("mimeType"); + let tags = pluginHost.getPluginTags(); + let blocklistState = Components.interfaces.nsIBlocklistService.STATE_NOT_BLOCKED; + for (let plugin of tags) { + if (plugin.getMimeTypes()[0] == mimeType) { + blocklistState = blocklistService.getPluginBlocklistState(plugin); + break; + } + } + return (blocklistState == Components.interfaces.nsIBlocklistService.STATE_VULNERABLE_UPDATE_AVAILABLE || + blocklistState == Components.interfaces.nsIBlocklistService.STATE_VULNERABLE_NO_UPDATE); + ]]> + </body> + </method> + </implementation> + </binding> +</bindings> |