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