toolkit/content/plugins.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/content/plugins.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,221 @@
     1.4 +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
     1.5 +
     1.6 +<!-- This Source Code Form is subject to the terms of the Mozilla Public
     1.7 +   - License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 +   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
     1.9 +
    1.10 +<html>
    1.11 +<head>
    1.12 +<script type="application/javascript">
    1.13 +  "use strict";
    1.14 +
    1.15 +  Components.utils.import("resource://gre/modules/AddonManager.jsm");
    1.16 +
    1.17 +  var Ci = Components.interfaces;
    1.18 +  var strBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"].getService(Ci.nsIStringBundleService);
    1.19 +  var pluginsbundle = strBundleService.createBundle("chrome://global/locale/plugins.properties");
    1.20 +  var regionbundle = strBundleService.createBundle("chrome://global-region/locale/region.properties");
    1.21 +
    1.22 +  document.writeln("<title>" + pluginsbundle.GetStringFromName("title_label") + "<\/title>");
    1.23 +</script>
    1.24 +<link rel="stylesheet" type="text/css" href="chrome://global/content/plugins.css">
    1.25 +<link rel="stylesheet" type="text/css" href="chrome://global/skin/plugins.css">
    1.26 +</head>
    1.27 +<body>
    1.28 +<div id="outside">
    1.29 +<script type="application/javascript">
    1.30 +  "use strict";
    1.31 +
    1.32 +  function setDirection() {
    1.33 +    var frame = document.getElementById("directionDetector");
    1.34 +    var direction = frame.contentDocument
    1.35 +                         .defaultView
    1.36 +                         .window
    1.37 +                         .getComputedStyle(frame.contentDocument.getElementById("target"), "")
    1.38 +                         .getPropertyValue("direction");
    1.39 +    document.body.removeChild(frame);
    1.40 +    document.dir = direction;
    1.41 +  }
    1.42 +
    1.43 +  function setupDirection() {
    1.44 +    var frame = document.createElement("iframe");
    1.45 +    frame.setAttribute("id", "directionDetector");
    1.46 +    frame.setAttribute("src", "chrome://global/content/directionDetector.html");
    1.47 +    frame.setAttribute("width", "0");
    1.48 +    frame.setAttribute("height", "0");
    1.49 +    frame.setAttribute("style", "visibility: hidden;");
    1.50 +    frame.setAttribute("onload", "setDirection();");
    1.51 +    document.body.appendChild(frame);
    1.52 +  }
    1.53 +  setupDirection();
    1.54 +
    1.55 +  /* JavaScript to enumerate and display all installed plug-ins
    1.56 +
    1.57 +   * First, refresh plugins in case anything has been changed recently in
    1.58 +   * prefs: (The "false" argument tells refresh not to reload or activate
    1.59 +   * any plug-ins that would be active otherwise.  In contrast, one would
    1.60 +   * use "true" in the case of ASD instead of restarting)
    1.61 +   */
    1.62 +  navigator.plugins.refresh(false);
    1.63 +
    1.64 +  AddonManager.getAddonsByTypes(["plugin"], function (aPlugins) {
    1.65 +    var fragment = document.createDocumentFragment();
    1.66 +
    1.67 +    // "Installed plugins"
    1.68 +    var id, label;
    1.69 +    if (aPlugins.length > 0) {
    1.70 +      id = "plugs";
    1.71 +      label = "installedplugins_label";
    1.72 +    } else {
    1.73 +      id = "noplugs";
    1.74 +      label = "nopluginsareinstalled_label";
    1.75 +    }
    1.76 +    var enabledplugins = document.createElement("h1");
    1.77 +    enabledplugins.setAttribute("id", id);
    1.78 +    enabledplugins.appendChild(document.createTextNode(pluginsbundle.GetStringFromName(label)));
    1.79 +    fragment.appendChild(enabledplugins);
    1.80 +
    1.81 +    // "Find updates for installed plugins at " ...
    1.82 +    var findpluginupdates = document.createElement("div");
    1.83 +    findpluginupdates.setAttribute("id", "findpluginupdates");
    1.84 +    findpluginupdates.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("findpluginupdates_label") + " "));
    1.85 +    fragment.appendChild(findpluginupdates);
    1.86 +
    1.87 +    // ... "mozilla.com/plugincheck"
    1.88 +    var pluginupdates = document.createElement("a");
    1.89 +    pluginupdates.setAttribute("href", regionbundle.GetStringFromName("pluginupdates_url"));
    1.90 +    pluginupdates.appendChild(document.createTextNode(regionbundle.GetStringFromName("pluginupdates_label")));
    1.91 +    findpluginupdates.appendChild(pluginupdates);
    1.92 +
    1.93 +    fragment.appendChild(document.createElement("hr"));
    1.94 +
    1.95 +    var stateNames = {};
    1.96 +    ["STATE_SOFTBLOCKED",
    1.97 +     "STATE_BLOCKED",
    1.98 +     "STATE_OUTDATED",
    1.99 +     "STATE_VULNERABLE_UPDATE_AVAILABLE",
   1.100 +     "STATE_VULNERABLE_NO_UPDATE"].forEach(function(label) {
   1.101 +      stateNames[Ci.nsIBlocklistService[label]] = label;
   1.102 +    });
   1.103 +
   1.104 +    for (var i = 0; i < aPlugins.length; i++) {
   1.105 +      var plugin = aPlugins[i];
   1.106 +      if (plugin) {
   1.107 +        // "Shockwave Flash"
   1.108 +        var plugname = document.createElement("h2");
   1.109 +        plugname.setAttribute("class", "plugname");
   1.110 +        plugname.appendChild(document.createTextNode(plugin.name));
   1.111 +        fragment.appendChild(plugname);
   1.112 +
   1.113 +        var dl = document.createElement("dl");
   1.114 +        fragment.appendChild(dl);
   1.115 +
   1.116 +        // "File: Flash Player.plugin"
   1.117 +        var fileDd = document.createElement("dd");
   1.118 +        var file = document.createElement("span");
   1.119 +        file.setAttribute("class", "label");
   1.120 +        file.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("file_label") + " "));
   1.121 +        fileDd.appendChild(file);
   1.122 +        fileDd.appendChild(document.createTextNode(plugin.pluginLibraries));
   1.123 +        dl.appendChild(fileDd);
   1.124 +
   1.125 +        // "Path: /usr/lib/mozilla/plugins/libtotem-cone-plugin.so"
   1.126 +        var pathDd = document.createElement("dd");
   1.127 +        var path = document.createElement("span");
   1.128 +        path.setAttribute("class", "label");
   1.129 +        path.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("path_label") + " "));
   1.130 +        pathDd.appendChild(path);
   1.131 +        pathDd.appendChild(document.createTextNode(plugin.pluginFullpath));
   1.132 +        dl.appendChild(pathDd);
   1.133 +
   1.134 +        // "Version: "
   1.135 +        var versionDd = document.createElement("dd");
   1.136 +        var version = document.createElement("span");
   1.137 +        version.setAttribute("class", "label");
   1.138 +        version.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("version_label") + " "));
   1.139 +        versionDd.appendChild(version);
   1.140 +        versionDd.appendChild(document.createTextNode(plugin.version));
   1.141 +        dl.appendChild(versionDd);
   1.142 +
   1.143 +        // "State: "
   1.144 +        var stateDd = document.createElement("dd");
   1.145 +        var state = document.createElement("span");
   1.146 +        state.setAttribute("label", "state");
   1.147 +        state.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("state_label") + " "));
   1.148 +        stateDd.appendChild(state);
   1.149 +        status = plugin.isActive ? pluginsbundle.GetStringFromName("state_enabled") : pluginsbundle.GetStringFromName("state_disabled");
   1.150 +        if (plugin.blocklistState in stateNames) {
   1.151 +          status += " (" + stateNames[plugin.blocklistState] + ")";
   1.152 +        }
   1.153 +        stateDd.appendChild(document.createTextNode(status));
   1.154 +        dl.appendChild(stateDd);
   1.155 +
   1.156 +        // Plugin Description
   1.157 +        var descDd = document.createElement("dd");
   1.158 +        descDd.appendChild(document.createTextNode(plugin.description));
   1.159 +        dl.appendChild(descDd);
   1.160 +
   1.161 +        // MIME Type table
   1.162 +        var mimetypeTable = document.createElement("table");
   1.163 +        mimetypeTable.setAttribute("border", "1");
   1.164 +        mimetypeTable.setAttribute("class", "contenttable");
   1.165 +        fragment.appendChild(mimetypeTable);
   1.166 +
   1.167 +        var thead = document.createElement("thead");
   1.168 +        mimetypeTable.appendChild(thead);
   1.169 +        var tr = document.createElement("tr");
   1.170 +        thead.appendChild(tr);
   1.171 +
   1.172 +        // "MIME Type" column header
   1.173 +        var typeTh = document.createElement("th");
   1.174 +        typeTh.setAttribute("class", "type");
   1.175 +        typeTh.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("mimetype_label")));
   1.176 +        tr.appendChild(typeTh);
   1.177 +
   1.178 +        // "Description" column header
   1.179 +        var descTh = document.createElement("th");
   1.180 +        descTh.setAttribute("class", "desc");
   1.181 +        descTh.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("description_label")));
   1.182 +        tr.appendChild(descTh);
   1.183 +
   1.184 +        // "Suffixes" column header
   1.185 +        var suffixesTh = document.createElement("th");
   1.186 +        suffixesTh.setAttribute("class", "suff");
   1.187 +        suffixesTh.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("suffixes_label")));
   1.188 +        tr.appendChild(suffixesTh);
   1.189 +
   1.190 +        var tbody = document.createElement("tbody");
   1.191 +        mimetypeTable.appendChild(tbody);
   1.192 +
   1.193 +        var mimeTypes = plugin.pluginMimeTypes;
   1.194 +        for (var j = 0; j < mimeTypes.length; j++) {
   1.195 +          var mimetype = mimeTypes[j];
   1.196 +          if (mimetype) {
   1.197 +            var mimetypeRow = document.createElement("tr");
   1.198 +            tbody.appendChild(mimetypeRow);
   1.199 +
   1.200 +            // "application/x-shockwave-flash"
   1.201 +            var typename = document.createElement("td");
   1.202 +            typename.appendChild(document.createTextNode(mimetype.type));
   1.203 +            mimetypeRow.appendChild(typename);
   1.204 +
   1.205 +            // "Shockwave Flash"
   1.206 +            var description = document.createElement("td");
   1.207 +            description.appendChild(document.createTextNode(mimetype.description));
   1.208 +            mimetypeRow.appendChild(description);
   1.209 +
   1.210 +            // "swf"
   1.211 +            var suffixes = document.createElement("td");
   1.212 +            suffixes.appendChild(document.createTextNode(mimetype.suffixes));
   1.213 +            mimetypeRow.appendChild(suffixes);
   1.214 +          }
   1.215 +        }
   1.216 +      }
   1.217 +    }
   1.218 +
   1.219 +    document.getElementById("outside").appendChild(fragment);
   1.220 +  });
   1.221 +</script>
   1.222 +</div>
   1.223 +</body>
   1.224 +</html>

mercurial