diff --git a/docshell/base/nsAboutRedirector.cpp b/docshell/base/nsAboutRedirector.cpp index e34764ab160e..2803400e62f3 100644 --- a/docshell/base/nsAboutRedirector.cpp +++ b/docshell/base/nsAboutRedirector.cpp @@ -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 }, diff --git a/toolkit/content/plugins.html b/toolkit/content/plugins.html index bfd84c79e6c3..e9f1cedd84a9 100644 --- a/toolkit/content/plugins.html +++ b/toolkit/content/plugins.html @@ -9,8 +9,6 @@ diff --git a/toolkit/mozapps/extensions/AddonManager.jsm b/toolkit/mozapps/extensions/AddonManager.jsm index 99f790058664..684373a40cb7 100644 --- a/toolkit/mozapps/extensions/AddonManager.jsm +++ b/toolkit/mozapps/extensions/AddonManager.jsm @@ -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. *