toolkit/content/plugins.html

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
     3 <!-- This Source Code Form is subject to the terms of the Mozilla Public
     4    - License, v. 2.0. If a copy of the MPL was not distributed with this
     5    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
     7 <html>
     8 <head>
     9 <script type="application/javascript">
    10   "use strict";
    12   Components.utils.import("resource://gre/modules/AddonManager.jsm");
    14   var Ci = Components.interfaces;
    15   var strBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"].getService(Ci.nsIStringBundleService);
    16   var pluginsbundle = strBundleService.createBundle("chrome://global/locale/plugins.properties");
    17   var regionbundle = strBundleService.createBundle("chrome://global-region/locale/region.properties");
    19   document.writeln("<title>" + pluginsbundle.GetStringFromName("title_label") + "<\/title>");
    20 </script>
    21 <link rel="stylesheet" type="text/css" href="chrome://global/content/plugins.css">
    22 <link rel="stylesheet" type="text/css" href="chrome://global/skin/plugins.css">
    23 </head>
    24 <body>
    25 <div id="outside">
    26 <script type="application/javascript">
    27   "use strict";
    29   function setDirection() {
    30     var frame = document.getElementById("directionDetector");
    31     var direction = frame.contentDocument
    32                          .defaultView
    33                          .window
    34                          .getComputedStyle(frame.contentDocument.getElementById("target"), "")
    35                          .getPropertyValue("direction");
    36     document.body.removeChild(frame);
    37     document.dir = direction;
    38   }
    40   function setupDirection() {
    41     var frame = document.createElement("iframe");
    42     frame.setAttribute("id", "directionDetector");
    43     frame.setAttribute("src", "chrome://global/content/directionDetector.html");
    44     frame.setAttribute("width", "0");
    45     frame.setAttribute("height", "0");
    46     frame.setAttribute("style", "visibility: hidden;");
    47     frame.setAttribute("onload", "setDirection();");
    48     document.body.appendChild(frame);
    49   }
    50   setupDirection();
    52   /* JavaScript to enumerate and display all installed plug-ins
    54    * First, refresh plugins in case anything has been changed recently in
    55    * prefs: (The "false" argument tells refresh not to reload or activate
    56    * any plug-ins that would be active otherwise.  In contrast, one would
    57    * use "true" in the case of ASD instead of restarting)
    58    */
    59   navigator.plugins.refresh(false);
    61   AddonManager.getAddonsByTypes(["plugin"], function (aPlugins) {
    62     var fragment = document.createDocumentFragment();
    64     // "Installed plugins"
    65     var id, label;
    66     if (aPlugins.length > 0) {
    67       id = "plugs";
    68       label = "installedplugins_label";
    69     } else {
    70       id = "noplugs";
    71       label = "nopluginsareinstalled_label";
    72     }
    73     var enabledplugins = document.createElement("h1");
    74     enabledplugins.setAttribute("id", id);
    75     enabledplugins.appendChild(document.createTextNode(pluginsbundle.GetStringFromName(label)));
    76     fragment.appendChild(enabledplugins);
    78     // "Find updates for installed plugins at " ...
    79     var findpluginupdates = document.createElement("div");
    80     findpluginupdates.setAttribute("id", "findpluginupdates");
    81     findpluginupdates.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("findpluginupdates_label") + " "));
    82     fragment.appendChild(findpluginupdates);
    84     // ... "mozilla.com/plugincheck"
    85     var pluginupdates = document.createElement("a");
    86     pluginupdates.setAttribute("href", regionbundle.GetStringFromName("pluginupdates_url"));
    87     pluginupdates.appendChild(document.createTextNode(regionbundle.GetStringFromName("pluginupdates_label")));
    88     findpluginupdates.appendChild(pluginupdates);
    90     fragment.appendChild(document.createElement("hr"));
    92     var stateNames = {};
    93     ["STATE_SOFTBLOCKED",
    94      "STATE_BLOCKED",
    95      "STATE_OUTDATED",
    96      "STATE_VULNERABLE_UPDATE_AVAILABLE",
    97      "STATE_VULNERABLE_NO_UPDATE"].forEach(function(label) {
    98       stateNames[Ci.nsIBlocklistService[label]] = label;
    99     });
   101     for (var i = 0; i < aPlugins.length; i++) {
   102       var plugin = aPlugins[i];
   103       if (plugin) {
   104         // "Shockwave Flash"
   105         var plugname = document.createElement("h2");
   106         plugname.setAttribute("class", "plugname");
   107         plugname.appendChild(document.createTextNode(plugin.name));
   108         fragment.appendChild(plugname);
   110         var dl = document.createElement("dl");
   111         fragment.appendChild(dl);
   113         // "File: Flash Player.plugin"
   114         var fileDd = document.createElement("dd");
   115         var file = document.createElement("span");
   116         file.setAttribute("class", "label");
   117         file.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("file_label") + " "));
   118         fileDd.appendChild(file);
   119         fileDd.appendChild(document.createTextNode(plugin.pluginLibraries));
   120         dl.appendChild(fileDd);
   122         // "Path: /usr/lib/mozilla/plugins/libtotem-cone-plugin.so"
   123         var pathDd = document.createElement("dd");
   124         var path = document.createElement("span");
   125         path.setAttribute("class", "label");
   126         path.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("path_label") + " "));
   127         pathDd.appendChild(path);
   128         pathDd.appendChild(document.createTextNode(plugin.pluginFullpath));
   129         dl.appendChild(pathDd);
   131         // "Version: "
   132         var versionDd = document.createElement("dd");
   133         var version = document.createElement("span");
   134         version.setAttribute("class", "label");
   135         version.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("version_label") + " "));
   136         versionDd.appendChild(version);
   137         versionDd.appendChild(document.createTextNode(plugin.version));
   138         dl.appendChild(versionDd);
   140         // "State: "
   141         var stateDd = document.createElement("dd");
   142         var state = document.createElement("span");
   143         state.setAttribute("label", "state");
   144         state.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("state_label") + " "));
   145         stateDd.appendChild(state);
   146         status = plugin.isActive ? pluginsbundle.GetStringFromName("state_enabled") : pluginsbundle.GetStringFromName("state_disabled");
   147         if (plugin.blocklistState in stateNames) {
   148           status += " (" + stateNames[plugin.blocklistState] + ")";
   149         }
   150         stateDd.appendChild(document.createTextNode(status));
   151         dl.appendChild(stateDd);
   153         // Plugin Description
   154         var descDd = document.createElement("dd");
   155         descDd.appendChild(document.createTextNode(plugin.description));
   156         dl.appendChild(descDd);
   158         // MIME Type table
   159         var mimetypeTable = document.createElement("table");
   160         mimetypeTable.setAttribute("border", "1");
   161         mimetypeTable.setAttribute("class", "contenttable");
   162         fragment.appendChild(mimetypeTable);
   164         var thead = document.createElement("thead");
   165         mimetypeTable.appendChild(thead);
   166         var tr = document.createElement("tr");
   167         thead.appendChild(tr);
   169         // "MIME Type" column header
   170         var typeTh = document.createElement("th");
   171         typeTh.setAttribute("class", "type");
   172         typeTh.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("mimetype_label")));
   173         tr.appendChild(typeTh);
   175         // "Description" column header
   176         var descTh = document.createElement("th");
   177         descTh.setAttribute("class", "desc");
   178         descTh.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("description_label")));
   179         tr.appendChild(descTh);
   181         // "Suffixes" column header
   182         var suffixesTh = document.createElement("th");
   183         suffixesTh.setAttribute("class", "suff");
   184         suffixesTh.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("suffixes_label")));
   185         tr.appendChild(suffixesTh);
   187         var tbody = document.createElement("tbody");
   188         mimetypeTable.appendChild(tbody);
   190         var mimeTypes = plugin.pluginMimeTypes;
   191         for (var j = 0; j < mimeTypes.length; j++) {
   192           var mimetype = mimeTypes[j];
   193           if (mimetype) {
   194             var mimetypeRow = document.createElement("tr");
   195             tbody.appendChild(mimetypeRow);
   197             // "application/x-shockwave-flash"
   198             var typename = document.createElement("td");
   199             typename.appendChild(document.createTextNode(mimetype.type));
   200             mimetypeRow.appendChild(typename);
   202             // "Shockwave Flash"
   203             var description = document.createElement("td");
   204             description.appendChild(document.createTextNode(mimetype.description));
   205             mimetypeRow.appendChild(description);
   207             // "swf"
   208             var suffixes = document.createElement("td");
   209             suffixes.appendChild(document.createTextNode(mimetype.suffixes));
   210             mimetypeRow.appendChild(suffixes);
   211           }
   212         }
   213       }
   214     }
   216     document.getElementById("outside").appendChild(fragment);
   217   });
   218 </script>
   219 </div>
   220 </body>
   221 </html>

mercurial