зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1614747, convert about:plugins to JSWindowActor-based remote page manager, r=mossop
Differential Revision: https://phabricator.services.mozilla.com/D71025
This commit is contained in:
Родитель
b14f021e00
Коммит
f22197fbf1
|
@ -0,0 +1,12 @@
|
|||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
var EXPORTED_SYMBOLS = ["AboutPluginsChild"];
|
||||
|
||||
const { RemotePageChild } = ChromeUtils.import(
|
||||
"resource://gre/actors/RemotePageChild.jsm"
|
||||
);
|
||||
|
||||
class AboutPluginsChild extends RemotePageChild {}
|
|
@ -0,0 +1,45 @@
|
|||
/* 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/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["AboutPluginsParent"];
|
||||
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"AddonManager",
|
||||
"resource://gre/modules/AddonManager.jsm"
|
||||
);
|
||||
|
||||
// Lists all the properties that plugins.html needs
|
||||
const NEEDED_PROPS = [
|
||||
"name",
|
||||
"pluginLibraries",
|
||||
"pluginFullpath",
|
||||
"version",
|
||||
"isActive",
|
||||
"blocklistState",
|
||||
"description",
|
||||
"pluginMimeTypes",
|
||||
];
|
||||
|
||||
class AboutPluginsParent extends JSWindowActorParent {
|
||||
async receiveMessage(message) {
|
||||
switch (message.name) {
|
||||
case "RequestPlugins":
|
||||
function filterProperties(plugin) {
|
||||
let filtered = {};
|
||||
for (let prop of NEEDED_PROPS) {
|
||||
filtered[prop] = plugin[prop];
|
||||
}
|
||||
return filtered;
|
||||
}
|
||||
|
||||
let plugins = await AddonManager.getAddonsByTypes(["plugin"]);
|
||||
return plugins.map(filterProperties);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
}
|
|
@ -27,6 +27,8 @@ with Files("WebRTCChild.jsm"):
|
|||
|
||||
FINAL_TARGET_FILES.actors += [
|
||||
'AboutNewTabChild.jsm',
|
||||
'AboutPluginsChild.jsm',
|
||||
'AboutPluginsParent.jsm',
|
||||
'AboutPrivateBrowsingChild.jsm',
|
||||
'AboutPrivateBrowsingParent.jsm',
|
||||
'AboutProtectionsChild.jsm',
|
||||
|
|
|
@ -105,6 +105,21 @@ let ACTORS = {
|
|||
remoteTypes: ["privilegedabout"],
|
||||
},
|
||||
|
||||
AboutPlugins: {
|
||||
parent: {
|
||||
moduleURI: "resource:///actors/AboutPluginsParent.jsm",
|
||||
},
|
||||
child: {
|
||||
moduleURI: "resource:///actors/AboutPluginsChild.jsm",
|
||||
|
||||
events: {
|
||||
DOMWindowCreated: { capture: true },
|
||||
},
|
||||
},
|
||||
|
||||
matches: ["about:plugins"],
|
||||
},
|
||||
|
||||
AboutPrivateBrowsing: {
|
||||
parent: {
|
||||
moduleURI: "resource:///actors/AboutPrivateBrowsingParent.jsm",
|
||||
|
|
|
@ -17,7 +17,7 @@ const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
|||
*/
|
||||
navigator.plugins.refresh(false);
|
||||
|
||||
RPMAddMessageListener("PluginList", function({ data: aPlugins }) {
|
||||
RPMSendQuery("RequestPlugins", {}).then(aPlugins => {
|
||||
var fragment = document.createDocumentFragment();
|
||||
|
||||
// "Installed plugins"
|
||||
|
@ -195,5 +195,3 @@ RPMAddMessageListener("PluginList", function({ data: aPlugins }) {
|
|||
|
||||
document.getElementById("outside").appendChild(fragment);
|
||||
});
|
||||
|
||||
RPMSendAsyncMessage("RequestPlugins");
|
||||
|
|
|
@ -93,6 +93,9 @@ let RemotePageAccessManager = {
|
|||
RPMPrefIsLocked: ["security.tls.version.min"],
|
||||
RPMAddToHistogram: ["*"],
|
||||
},
|
||||
"about:plugins": {
|
||||
RPMSendQuery: ["RequestPlugins"],
|
||||
},
|
||||
"about:privatebrowsing": {
|
||||
RPMSendAsyncMessage: [
|
||||
"OpenPrivateWindow",
|
||||
|
|
|
@ -532,7 +532,6 @@ var gFinalShutdownBarrier = null;
|
|||
var gBeforeShutdownBarrier = null;
|
||||
var gRepoShutdownState = "";
|
||||
var gShutdownInProgress = false;
|
||||
var gPluginPageListener = null;
|
||||
var gBrowserUpdated = null;
|
||||
|
||||
var AMTelemetry;
|
||||
|
@ -820,18 +819,6 @@ var AddonManagerInternal = {
|
|||
}
|
||||
}
|
||||
|
||||
// Support for remote about:plugins. Note that this module isn't loaded
|
||||
// at the top because Services.appinfo is defined late in tests.
|
||||
let { RemotePages } = ChromeUtils.import(
|
||||
"resource://gre/modules/remotepagemanager/RemotePageManagerParent.jsm"
|
||||
);
|
||||
|
||||
gPluginPageListener = new RemotePages("about:plugins");
|
||||
gPluginPageListener.addMessageListener(
|
||||
"RequestPlugins",
|
||||
this.requestPlugins
|
||||
);
|
||||
|
||||
gStartupComplete = true;
|
||||
this.recordTimestamp("AMI_startup_end");
|
||||
} catch (e) {
|
||||
|
@ -1061,8 +1048,6 @@ var AddonManagerInternal = {
|
|||
Services.prefs.removeObserver(PREF_EM_CHECK_UPDATE_SECURITY, this);
|
||||
Services.prefs.removeObserver(PREF_EM_UPDATE_ENABLED, this);
|
||||
Services.prefs.removeObserver(PREF_EM_AUTOUPDATE_DEFAULT, this);
|
||||
gPluginPageListener.destroy();
|
||||
gPluginPageListener = null;
|
||||
|
||||
let savedError = null;
|
||||
// Only shut down providers if they've been started.
|
||||
|
@ -1114,30 +1099,6 @@ var AddonManagerInternal = {
|
|||
}
|
||||
},
|
||||
|
||||
async requestPlugins({ 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;
|
||||
}
|
||||
|
||||
let aPlugins = await AddonManager.getAddonsByTypes(["plugin"]);
|
||||
port.sendAsyncMessage("PluginList", aPlugins.map(filterProperties));
|
||||
},
|
||||
|
||||
/**
|
||||
* Notified when a preference we're interested in has changed.
|
||||
*
|
||||
|
|
Загрузка…
Ссылка в новой задаче