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.

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

mercurial