Bug 1068087: Switch about:plugins to run remotely. r=mconley

--HG--
extra : rebase_source : f1538bb9d17cc1a320e0e29c2733a038fcbaefb2
extra : source : 0718dffcd078caef467625cb4bf05753ad5a58e1
This commit is contained in:
Dave Townsend 2015-01-08 12:40:14 -08:00
Родитель c9c9a7a81f
Коммит 55ee944e85
3 изменённых файлов: 35 добавлений и 4 удалений

Просмотреть файл

@ -43,7 +43,10 @@ static RedirEntry kRedirMap[] = {
"mozilla", "chrome://global/content/mozilla.xhtml",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT
},
{ "plugins", "chrome://global/content/plugins.html", 0 },
{
"plugins", "chrome://global/content/plugins.html",
nsIAboutModule::URI_MUST_LOAD_IN_CHILD
},
{ "config", "chrome://global/content/config.xul", 0 },
#ifdef MOZ_CRASHREPORTER
{ "crashes", "chrome://global/content/crashes.xhtml", 0 },

Просмотреть файл

@ -9,8 +9,6 @@
<script type="application/javascript">
"use strict";
Components.utils.import("resource://gre/modules/AddonManager.jsm");
var Ci = Components.interfaces;
var strBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"].getService(Ci.nsIStringBundleService);
var pluginsbundle = strBundleService.createBundle("chrome://global/locale/plugins.properties");
@ -58,7 +56,7 @@
*/
navigator.plugins.refresh(false);
AddonManager.getAddonsByTypes(["plugin"], function (aPlugins) {
addMessageListener("PluginList", function({ data: aPlugins }) {
var fragment = document.createDocumentFragment();
// "Installed plugins"
@ -215,6 +213,8 @@
document.getElementById("outside").appendChild(fragment);
});
sendAsyncMessage("RequestPlugins");
</script>
</div>
</body>

Просмотреть файл

@ -508,6 +508,7 @@ var gHotfixID = null;
var gShutdownBarrier = null;
var gRepoShutdownState = "";
var gShutdownInProgress = false;
var gPluginPageListener = null;
/**
* This is the real manager, kept here rather than in AddonManager to keep its
@ -848,6 +849,13 @@ var AddonManagerInternal = {
delete this.startupChanges[type];
}
// Support for remote about:plugins. Note that this module isn't loaded
// at the top because Services.appinfo is defined late in tests.
Cu.import("resource://gre/modules/RemotePageManager.jsm");
gPluginPageListener = new RemotePages("about:plugins");
gPluginPageListener.addMessageListener("RequestPlugins", this.requestPlugins);
gStartupComplete = true;
this.recordTimestamp("AMI_startup_end");
}
@ -1059,6 +1067,8 @@ var AddonManagerInternal = {
Services.prefs.removeObserver(PREF_EM_UPDATE_ENABLED, this);
Services.prefs.removeObserver(PREF_EM_AUTOUPDATE_DEFAULT, this);
Services.prefs.removeObserver(PREF_EM_HOTFIX_ID, this);
gPluginPageListener.destroy();
gPluginPageListener = null;
let savedError = null;
// Only shut down providers if they've been started.
@ -1102,6 +1112,24 @@ var AddonManagerInternal = {
}
}),
requestPlugins: function({ target: port }) {
// Lists all the properties that plugins.html needs
const NEEDED_PROPS = ["name", "pluginLibraries", "pluginFullpath", "version",
"isActive", "blocklistState", "description",
"pluginMimeTypes"];
function filterProperties(plugin) {
let filtered = {};
for (let prop of NEEDED_PROPS) {
filtered[prop] = plugin[prop];
}
return filtered;
}
AddonManager.getAddonsByTypes(["plugin"], function (aPlugins) {
port.sendAsyncMessage("PluginList", [filterProperties(p) for (p of aPlugins)]);
});
},
/**
* Notified when a preference we're interested in has changed.
*