Bug 1505913 - make plugin click-to-play and crash handling fission-compatible, r=mconley

At a high level, this change does the following:
- move the pluginchild actor to be a JSWindowActorChild
- move the parent handling from browser-plugins into a JSWindowActorParent
- move the crash handling from ContentCrashHandlers.jsm to the parent actor,
  using a `PluginManager` object. It needs to talk to the actors (and vice
  versa), so this seemed a better fit than spreading actor implementation
  details to other JSMs.
- switch to using plugin IDs to identify plugins cross-process, instead of
  combinations of names or other properties of the plugin tag. As part of that,
  ensured plugin IDs are unique between "fake" plugins and the other ones.
- drop support for having a notification for more than 1 plugin. We only support
  Flash, in practice, so there didn't seem to be much point in the added
  complexity of trying to support more than 1 thing.

Some notes:
- the previous implementation mixes runIDs (for NPAPI plugin process "runs")
  and GMP pluginIDs when doing crashreporting. AFAICT there is no guarantee
  these don't conflict, so I've split them out to avoid issues. There's a
  pluginCrashID object I pass around instead that has either a runID or
  pluginID. Happy to rename some more for clarity.
- the previous implementation used `pluginInfo` and `plugin` for a bunch of
  different types of variables. I've tried to be consistent, where:
  * `pluginElement` is a DOM element for a plugin
  * `activationInfo` is a JS object used to track click to play state for a plugin
  * `plugin` is a plugintag as returned by the pluginhost service
  * `pluginCrashID` is an identifier for a crashed plugin (see previous point).
- I'm still using broadcastAsyncMessage to tell the content processes about
  gmp plugin crashes and plugin crash submission updates, because there's no
  guarantee the actors are instantiated (for gmp plugins) nor can the parent
  easily find out which actors to talk to (for either gmp or npapi plugins).
  Open to suggestions there, too. I think our best bet might be moving that to
  IPDL-based IPC within the GMP code, but that feels like a separate bug.

Differential Revision: https://phabricator.services.mozilla.com/D37665

--HG--
rename : browser/base/content/browser-plugins.js => browser/actors/PluginParent.jsm
extra : moz-landing-system : lando
This commit is contained in:
Gijs Kruitbosch 2019-07-23 22:04:40 +00:00
Родитель 68ac43af8f
Коммит fffc7f0c58
29 изменённых файлов: 1231 добавлений и 1446 удалений

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

@ -260,6 +260,18 @@ class ContextMenuChild extends JSWindowActorChild {
imageName: null,
});
}
case "ContextMenu:PluginCommand": {
let target = ContentDOMReference.resolve(message.data.targetIdentifier);
let actor = this.manager.getActor("Plugin");
let { command } = message.data;
if (command == "play") {
actor.showClickToPlayNotification(target, true);
} else if (command == "hide") {
actor.hideClickToPlayOverlay(target);
}
break;
}
}
return undefined;

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

@ -100,4 +100,11 @@ class ContextMenuParent extends JSWindowActorParent {
handlingUserInput,
});
}
pluginCommand(command, targetIdentifier) {
this.sendAsyncMessage("ContextMenu:PluginCommand", {
command,
targetIdentifier,
});
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -0,0 +1,748 @@
/* -*- 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/. */
"use strict";
var EXPORTED_SYMBOLS = ["PluginParent", "PluginManager"];
const { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm"
);
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const { XPCOMUtils } = ChromeUtils.import(
"resource://gre/modules/XPCOMUtils.jsm"
);
XPCOMUtils.defineLazyServiceGetter(
this,
"gPluginHost",
"@mozilla.org/plugin/host;1",
"nsIPluginHost"
);
ChromeUtils.defineModuleGetter(
this,
"BrowserUtils",
"resource://gre/modules/BrowserUtils.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"CrashSubmit",
"resource://gre/modules/CrashSubmit.jsm"
);
XPCOMUtils.defineLazyGetter(this, "gNavigatorBundle", function() {
const url = "chrome://browser/locale/browser.properties";
return Services.strings.createBundle(url);
});
const kNotificationId = "click-to-play-plugins";
const {
PLUGIN_ACTIVE,
PLUGIN_VULNERABLE_NO_UPDATE,
PLUGIN_VULNERABLE_UPDATABLE,
PLUGIN_CLICK_TO_PLAY_QUIET,
} = Ci.nsIObjectLoadingContent;
const PluginManager = {
_initialized: false,
pluginMap: new Map(),
crashReports: new Map(),
gmpCrashes: new Map(),
_pendingCrashQueries: new Map(),
// BrowserGlue.jsm ensures we catch all plugin crashes.
// Barring crashes, we don't need to do anything until/unless an
// actor gets instantiated, in which case we also care about the
// plugin list changing.
ensureInitialized() {
if (this._initialized) {
return;
}
this._initialized = true;
this._updatePluginMap();
Services.obs.addObserver(this, "plugins-list-updated");
Services.obs.addObserver(this, "profile-after-change");
},
destroy() {
if (!this._initialized) {
return;
}
Services.obs.removeObserver(this, "plugins-list-updated");
Services.obs.removeObserver(this, "profile-after-change");
this.crashReports = new Map();
this.gmpCrashes = new Map();
this.pluginMap = new Map();
},
observe(subject, topic, data) {
switch (topic) {
case "plugins-list-updated":
this._updatePluginMap();
break;
case "plugin-crashed":
this.ensureInitialized();
this._registerNPAPICrash(subject);
break;
case "gmp-plugin-crash":
this.ensureInitialized();
this._registerGMPCrash(subject);
break;
case "profile-after-change":
this.destroy();
break;
}
},
getPluginTagById(id) {
return this.pluginMap.get(id);
},
_updatePluginMap() {
this.pluginMap = new Map();
let plugins = gPluginHost.getPluginTags();
for (let plugin of plugins) {
this.pluginMap.set(plugin.id, plugin);
}
},
// Crashed-plugin observer. Notified once per plugin crash, before events
// are dispatched to individual plugin instances. However, because of IPC,
// the event and the observer notification may still race.
_registerNPAPICrash(subject) {
let propertyBag = subject;
if (
!(propertyBag instanceof Ci.nsIWritablePropertyBag2) ||
!propertyBag.hasKey("runID") ||
!propertyBag.hasKey("pluginName")
) {
Cu.reportError(
"A NPAPI plugin crashed, but the notification is incomplete."
);
return;
}
let runID = propertyBag.getPropertyAsUint32("runID");
let uglyPluginName = propertyBag.getPropertyAsAString("pluginName");
let pluginName = BrowserUtils.makeNicePluginName(uglyPluginName);
let pluginDumpID = propertyBag.getPropertyAsAString("pluginDumpID");
let browserDumpID = propertyBag.getPropertyAsAString("browserDumpID");
let state;
let crashReporter = Services.appinfo.QueryInterface(Ci.nsICrashReporter);
if (!AppConstants.MOZ_CRASHREPORTER || !crashReporter.enabled) {
// This state tells the user that crash reporting is disabled, so we
// cannot send a report.
state = "noSubmit";
} else if (!pluginDumpID) {
// If we don't have a minidumpID, we can't submit anything.
// This can happen if the plugin is killed from the task manager.
// This state tells the user that this is the case.
state = "noReport";
} else {
// This state asks the user to submit a crash report.
state = "please";
}
let crashInfo = { runID, state, pluginName, pluginDumpID, browserDumpID };
this.crashReports.set(runID, crashInfo);
let listeners = this._pendingCrashQueries.get(runID) || [];
for (let listener of listeners) {
listener(crashInfo);
}
this._pendingCrashQueries.delete(runID);
},
_registerGMPCrash(subject) {
let propertyBag = subject;
if (
!(propertyBag instanceof Ci.nsIWritablePropertyBag2) ||
!propertyBag.hasKey("pluginID") ||
!propertyBag.hasKey("pluginDumpID") ||
!propertyBag.hasKey("pluginName")
) {
Cu.reportError("PluginManager can not read plugin information.");
return;
}
let pluginID = propertyBag.getPropertyAsUint32("pluginID");
let pluginDumpID = propertyBag.getPropertyAsAString("pluginDumpID");
if (pluginDumpID) {
this.gmpCrashes.set(pluginID, { pluginDumpID, pluginID });
}
// Only the parent process gets the gmp-plugin-crash observer
// notification, so we need to inform any content processes that
// the GMP has crashed. This then fires PluginCrashed events in
// all the relevant windows, which will trigger child actors being
// created, which will contact us again, when we'll use the
// gmpCrashes collection to respond.
if (Services.ppmm) {
let pluginName = propertyBag.getPropertyAsAString("pluginName");
Services.ppmm.broadcastAsyncMessage("gmp-plugin-crash", {
pluginName,
pluginID,
});
}
},
/**
* Submit a crash report for a crashed NPAPI plugin.
*
* @param pluginCrashID
* An object with either a runID (for NPAPI crashes) or a pluginID
* property (for GMP plugin crashes).
* A run ID is a unique identifier for a particular run of a plugin
* process - and is analogous to a process ID (though it is managed
* by Gecko instead of the operating system).
* @param keyVals
* An object whose key-value pairs will be merged
* with the ".extra" file submitted with the report.
* The properties of htis object will override properties
* of the same name in the .extra file.
*/
submitCrashReport(pluginCrashID, keyVals = {}) {
let report = this.getCrashReport(pluginCrashID);
if (!report) {
Cu.reportError(
`Could not find plugin dump IDs for ${JSON.stringify(pluginCrashID)}.` +
`It is possible that a report was already submitted.`
);
return;
}
let { pluginDumpID, browserDumpID } = report;
let submissionPromise = CrashSubmit.submit(pluginDumpID, {
recordSubmission: true,
extraExtraKeyVals: keyVals,
});
if (browserDumpID) {
CrashSubmit.submit(browserDumpID).catch(Cu.reportError);
}
this.broadcastState(pluginCrashID, "submitting");
submissionPromise.then(
() => {
this.broadcastState(pluginCrashID, "success");
},
() => {
this.broadcastState(pluginCrashID, "failed");
}
);
if (pluginCrashID.hasOwnProperty("runID")) {
this.crashReports.delete(pluginCrashID.runID);
} else {
this.gmpCrashes.delete(pluginCrashID.pluginID);
}
},
broadcastState(pluginCrashID, state) {
if (!pluginCrashID.hasOwnProperty("runID")) {
return;
}
let { runID } = pluginCrashID;
Services.ppmm.broadcastAsyncMessage(
"PluginParent:NPAPIPluginCrashReportSubmitted",
{ runID, state }
);
},
getCrashReport(pluginCrashID) {
if (pluginCrashID.hasOwnProperty("pluginID")) {
return this.gmpCrashes.get(pluginCrashID.pluginID);
}
return this.crashReports.get(pluginCrashID.runID);
},
/**
* Called by actors when they want crash info on behalf of the child.
* Will either return such info immediately if we have it, or return
* a promise, which resolves when we do have it. The promise resolution
* function is kept around for when we get the `plugin-crashed` observer
* notification.
*/
awaitPluginCrashInfo(runID) {
if (this.crashReports.has(runID)) {
return this.crashReports.get(runID);
}
let listeners = this._pendingCrashQueries.get(runID);
if (!listeners) {
listeners = [];
this._pendingCrashQueries.set(runID, listeners);
}
return new Promise(resolve => listeners.push(resolve));
},
/**
* This allows dependency injection, where an automated test can
* dictate how and when we respond to a child's inquiry about a crash.
* This is helpful when testing different orderings for plugin crash
* notifications (ie race conditions).
*
* Concretely, for the toplevel browsingContext of the `browser` we're
* passed, call the passed `handler` function the next time the child
* asks for crash data (using PluginContent:GetCrashData). We'll return
* the result of the function to the child. The message in question
* uses the actor query API, so promises and/or async functions will
* Just Work.
*/
mockResponse(browser, handler) {
let { currentWindowGlobal } = browser.frameLoader.browsingContext;
currentWindowGlobal.getActor("Plugin")._mockedResponder = handler;
},
};
const PREF_SESSION_PERSIST_MINUTES =
"plugin.sessionPermissionNow.intervalInMinutes";
class PluginParent extends JSWindowActorParent {
constructor() {
super();
PluginManager.ensureInitialized();
}
receiveMessage(msg) {
let browser = this.manager.rootFrameLoader.ownerElement;
let win = browser.ownerGlobal;
switch (msg.name) {
case "PluginContent:ShowClickToPlayNotification":
this.showClickToPlayNotification(
browser,
msg.data.plugin,
msg.data.showNow
);
break;
case "PluginContent:RemoveNotification":
this.removeNotification(browser);
break;
case "PluginContent:ShowPluginCrashedNotification":
this.showPluginCrashedNotification(browser, msg.data.pluginCrashID);
break;
case "PluginContent:SubmitReport":
if (AppConstants.MOZ_CRASHREPORTER) {
this.submitReport(
msg.data.runID,
msg.data.keyVals,
msg.data.submitURLOptIn
);
}
break;
case "PluginContent:LinkClickCallback":
switch (msg.data.name) {
case "managePlugins":
case "openHelpPage":
this[msg.data.name](win);
break;
case "openPluginUpdatePage":
this.openPluginUpdatePage(win, msg.data.pluginId);
break;
}
break;
case "PluginContent:GetCrashData":
if (this._mockedResponder) {
let rv = this._mockedResponder(msg.data);
delete this._mockedResponder;
return rv;
}
return PluginManager.awaitPluginCrashInfo(msg.data.runID);
default:
Cu.reportError(
"PluginParent did not expect to handle message " + msg.name
);
break;
}
return null;
}
// Callback for user clicking on a disabled plugin
managePlugins(window) {
window.BrowserOpenAddonsMgr("addons://list/plugin");
}
// Callback for user clicking on the link in a click-to-play plugin
// (where the plugin has an update)
async openPluginUpdatePage(window, pluginId) {
let pluginTag = PluginManager.getPluginTagById(pluginId);
if (!pluginTag) {
return;
}
let { Blocklist } = ChromeUtils.import(
"resource://gre/modules/Blocklist.jsm"
);
let url = await Blocklist.getPluginBlockURL(pluginTag);
window.openTrustedLinkIn(url, "tab");
}
submitReport(runID, keyVals, submitURLOptIn) {
if (!AppConstants.MOZ_CRASHREPORTER) {
return;
}
Services.prefs.setBoolPref(
"dom.ipc.plugins.reportCrashURL",
!!submitURLOptIn
);
PluginManager.submitCrashReport({ runID }, keyVals);
}
// Callback for user clicking a "reload page" link
reloadPage(browser) {
browser.reload();
}
// Callback for user clicking the help icon
openHelpPage(window) {
window.openHelpLink("plugin-crashed", false);
}
_clickToPlayNotificationEventCallback(event) {
if (event == "showing") {
Services.telemetry
.getHistogramById("PLUGINS_NOTIFICATION_SHOWN")
.add(!this.options.showNow);
} else if (event == "dismissed") {
// Once the popup is dismissed, clicking the icon should show the full
// list again
this.options.showNow = false;
}
}
/**
* Called from the plugin doorhanger to set the new permissions for a plugin
* and activate plugins if necessary.
* aNewState should be one of:
* - "allownow"
* - "block"
* - "continue"
* - "continueblocking"
*/
_updatePluginPermission(aBrowser, aActivationInfo, aNewState) {
let permission;
let expireType;
let expireTime;
let histogram = Services.telemetry.getHistogramById(
"PLUGINS_NOTIFICATION_USER_ACTION_2"
);
let window = aBrowser.ownerGlobal;
let notification = window.PopupNotifications.getNotification(
kNotificationId,
aBrowser
);
// Update the permission manager.
// Also update the current state of activationInfo.fallbackType so that
// subsequent opening of the notification shows the current state.
switch (aNewState) {
case "allownow":
permission = Ci.nsIPermissionManager.ALLOW_ACTION;
expireType = Ci.nsIPermissionManager.EXPIRE_SESSION;
expireTime =
Date.now() +
Services.prefs.getIntPref(PREF_SESSION_PERSIST_MINUTES) * 60 * 1000;
histogram.add(0);
aActivationInfo.fallbackType = PLUGIN_ACTIVE;
notification.options.extraAttr = "active";
break;
case "block":
permission = Ci.nsIPermissionManager.PROMPT_ACTION;
expireType = Ci.nsIPermissionManager.EXPIRE_SESSION;
expireTime = 0;
histogram.add(2);
let pluginTag = PluginManager.getPluginTagById(aActivationInfo.id);
switch (pluginTag.blocklistState) {
case Ci.nsIBlocklistService.STATE_VULNERABLE_UPDATE_AVAILABLE:
aActivationInfo.fallbackType = PLUGIN_VULNERABLE_UPDATABLE;
break;
case Ci.nsIBlocklistService.STATE_VULNERABLE_NO_UPDATE:
aActivationInfo.fallbackType = PLUGIN_VULNERABLE_NO_UPDATE;
break;
default:
// PLUGIN_CLICK_TO_PLAY_QUIET will only last until they reload the page, at
// which point it will be PLUGIN_CLICK_TO_PLAY (the overlays will appear)
aActivationInfo.fallbackType = PLUGIN_CLICK_TO_PLAY_QUIET;
}
notification.options.extraAttr = "inactive";
break;
// In case a plugin has already been allowed/disallowed in another tab, the
// buttons matching the existing block state shouldn't change any permissions
// but should run the plugin-enablement code below.
case "continue":
aActivationInfo.fallbackType = PLUGIN_ACTIVE;
notification.options.extraAttr = "active";
break;
case "continueblocking":
aActivationInfo.fallbackType = PLUGIN_CLICK_TO_PLAY_QUIET;
notification.options.extraAttr = "inactive";
break;
default:
Cu.reportError(Error("Unexpected plugin state: " + aNewState));
return;
}
if (aNewState != "continue" && aNewState != "continueblocking") {
let { principal } = notification.options;
Services.perms.addFromPrincipal(
principal,
aActivationInfo.permissionString,
permission,
expireType,
expireTime
);
}
this.sendAsyncMessage("PluginParent:ActivatePlugins", {
activationInfo: aActivationInfo,
newState: aNewState,
});
}
showClickToPlayNotification(browser, plugin, showNow) {
let window = browser.ownerGlobal;
let notification = window.PopupNotifications.getNotification(
kNotificationId,
browser
);
if (!plugin) {
this.removeNotification(browser);
return;
}
// We assume that we can only have 1 notification at a time anyway.
if (notification) {
if (showNow) {
notification.options.showNow = true;
notification.reshow();
}
return;
}
// Construct a notification for the plugin:
let { id, fallbackType } = plugin;
let pluginTag = PluginManager.getPluginTagById(id);
if (!pluginTag) {
return;
}
let permissionString = gPluginHost.getPermissionStringForTag(pluginTag);
let active = fallbackType == PLUGIN_ACTIVE;
let options = {
dismissed: !showNow,
hideClose: true,
persistent: showNow,
eventCallback: this._clickToPlayNotificationEventCallback,
showNow,
popupIconClass: "plugin-icon",
extraAttr: active ? "active" : "inactive",
principal: this.browsingContext.currentWindowGlobal.documentPrincipal,
};
let description;
if (
fallbackType == Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE
) {
description = gNavigatorBundle.GetStringFromName(
"flashActivate.outdated.message"
);
} else {
description = gNavigatorBundle.GetStringFromName("flashActivate.message");
}
let badge = window.document.getElementById("plugin-icon-badge");
badge.setAttribute("animate", "true");
badge.addEventListener("animationend", function animListener(event) {
if (
event.animationName == "blink-badge" &&
badge.hasAttribute("animate")
) {
badge.removeAttribute("animate");
badge.removeEventListener("animationend", animListener);
}
});
let weakBrowser = Cu.getWeakReference(browser);
let activationInfo = { id, fallbackType, permissionString };
// Note: in both of these action callbacks, we check the fallbackType on the
// activationInfo object, not the local variable. This is important because
// the activationInfo object is effectively read/write - the notification
// will stay up, and for blocking after allowing (or vice versa) to work, we
// need to always read the updated value.
let mainAction = {
callback: () => {
let browserRef = weakBrowser.get();
if (!browserRef) {
return;
}
let perm =
activationInfo.fallbackType == PLUGIN_ACTIVE
? "continue"
: "allownow";
this._updatePluginPermission(browserRef, activationInfo, perm);
},
label: gNavigatorBundle.GetStringFromName("flashActivate.allow"),
accessKey: gNavigatorBundle.GetStringFromName(
"flashActivate.allow.accesskey"
),
dismiss: true,
};
let secondaryActions = [
{
callback: () => {
let browserRef = weakBrowser.get();
if (!browserRef) {
return;
}
let perm =
activationInfo.fallbackType == PLUGIN_ACTIVE
? "block"
: "continueblocking";
this._updatePluginPermission(browserRef, activationInfo, perm);
},
label: gNavigatorBundle.GetStringFromName("flashActivate.noAllow"),
accessKey: gNavigatorBundle.GetStringFromName(
"flashActivate.noAllow.accesskey"
),
dismiss: true,
},
];
window.PopupNotifications.show(
browser,
kNotificationId,
description,
"plugins-notification-icon",
mainAction,
secondaryActions,
options
);
// Check if the plugin is insecure and update the notification icon accordingly.
let haveInsecure = false;
switch (fallbackType) {
// haveInsecure will trigger the red flashing icon and the infobar
// styling below
case PLUGIN_VULNERABLE_UPDATABLE:
case PLUGIN_VULNERABLE_NO_UPDATE:
haveInsecure = true;
}
window.document
.getElementById("plugins-notification-icon")
.classList.toggle("plugin-blocked", haveInsecure);
}
removeNotification(browser) {
let { PopupNotifications } = browser.ownerGlobal;
let notification = PopupNotifications.getNotification(
kNotificationId,
browser
);
if (notification) {
PopupNotifications.remove(notification);
}
}
/**
* Shows a plugin-crashed notification bar for a browser that has had an
* invisible NPAPI plugin crash, or a GMP plugin crash.
*
* @param browser
* The browser to show the notification for.
* @param pluginCrashID
* The unique-per-process identifier for the NPAPI plugin or GMP.
* This will have either a runID or pluginID property, identifying
* an npapi plugin or gmp plugin crash, respectively.
*/
showPluginCrashedNotification(browser, pluginCrashID) {
// If there's already an existing notification bar, don't do anything.
let notificationBox = browser.getTabBrowser().getNotificationBox(browser);
let notification = notificationBox.getNotificationWithValue(
"plugin-crashed"
);
let report = PluginManager.getCrashReport(pluginCrashID);
if (notification || !report) {
return;
}
// Configure the notification bar
let priority = notificationBox.PRIORITY_WARNING_MEDIUM;
let iconURL = "chrome://global/skin/plugins/pluginGeneric.svg";
let reloadLabel = gNavigatorBundle.GetStringFromName(
"crashedpluginsMessage.reloadButton.label"
);
let reloadKey = gNavigatorBundle.GetStringFromName(
"crashedpluginsMessage.reloadButton.accesskey"
);
let buttons = [
{
label: reloadLabel,
accessKey: reloadKey,
popup: null,
callback() {
browser.reload();
},
},
];
if (AppConstants.MOZ_CRASHREPORTER) {
let submitLabel = gNavigatorBundle.GetStringFromName(
"crashedpluginsMessage.submitButton.label"
);
let submitKey = gNavigatorBundle.GetStringFromName(
"crashedpluginsMessage.submitButton.accesskey"
);
let submitButton = {
label: submitLabel,
accessKey: submitKey,
popup: null,
callback: () => {
PluginManager.submitCrashReport(pluginCrashID);
},
};
buttons.push(submitButton);
}
let messageString = gNavigatorBundle.formatStringFromName(
"crashedpluginsMessage.title",
[report.pluginName]
);
notification = notificationBox.appendNotification(
messageString,
"plugin-crashed",
iconURL,
priority,
buttons
);
// Add the "learn more" link.
let link = notification.ownerDocument.createXULElement("label", {
is: "text-link",
});
link.setAttribute(
"value",
gNavigatorBundle.GetStringFromName("crashedpluginsMessage.learnMore")
);
let crashurl = Services.urlFormatter.formatURLPref("app.support.baseURL");
crashurl += "plugin-crashed-notificationbar";
link.href = crashurl;
notification.messageText.appendChild(link);
}
}

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

@ -41,6 +41,7 @@ FINAL_TARGET_FILES.actors += [
'PageInfoChild.jsm',
'PageStyleChild.jsm',
'PluginChild.jsm',
'PluginParent.jsm',
'RFPHelperChild.jsm',
'SearchTelemetryChild.jsm',
'SubframeCrashChild.jsm',

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

@ -1,564 +0,0 @@
/* -*- 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 gPluginHandler = {
PREF_SESSION_PERSIST_MINUTES: "plugin.sessionPermissionNow.intervalInMinutes",
PREF_PERSISTENT_DAYS: "plugin.persistentPermissionAlways.intervalInDays",
MESSAGES: [
"PluginContent:ShowClickToPlayNotification",
"PluginContent:RemoveNotification",
"PluginContent:InstallSinglePlugin",
"PluginContent:ShowPluginCrashedNotification",
"PluginContent:SubmitReport",
"PluginContent:LinkClickCallback",
],
init() {
const mm = window.messageManager;
for (let msg of this.MESSAGES) {
mm.addMessageListener(msg, this);
}
window.addEventListener("unload", this);
},
uninit() {
const mm = window.messageManager;
for (let msg of this.MESSAGES) {
mm.removeMessageListener(msg, this);
}
window.removeEventListener("unload", this);
},
handleEvent(event) {
if (event.type == "unload") {
this.uninit();
}
},
receiveMessage(msg) {
switch (msg.name) {
case "PluginContent:ShowClickToPlayNotification":
this.showClickToPlayNotification(
msg.target,
msg.data.plugins,
msg.data.showNow,
msg.principal,
msg.data.location
);
break;
case "PluginContent:RemoveNotification":
this.removeNotification(msg.target, msg.data.name);
break;
case "PluginContent:InstallSinglePlugin":
this.installSinglePlugin(msg.data.pluginInfo);
break;
case "PluginContent:ShowPluginCrashedNotification":
this.showPluginCrashedNotification(
msg.target,
msg.data.messageString,
msg.data.pluginID
);
break;
case "PluginContent:SubmitReport":
if (AppConstants.MOZ_CRASHREPORTER) {
this.submitReport(
msg.data.runID,
msg.data.keyVals,
msg.data.submitURLOptIn
);
}
break;
case "PluginContent:LinkClickCallback":
switch (msg.data.name) {
case "managePlugins":
case "openHelpPage":
case "openPluginUpdatePage":
this[msg.data.name](msg.data.pluginTag);
break;
}
break;
default:
Cu.reportError(
"gPluginHandler did not expect to handle message " + msg.name
);
break;
}
},
// Callback for user clicking on a disabled plugin
managePlugins() {
BrowserOpenAddonsMgr("addons://list/plugin");
},
// Callback for user clicking on the link in a click-to-play plugin
// (where the plugin has an update)
async openPluginUpdatePage(pluginTag) {
let { Blocklist } = ChromeUtils.import(
"resource://gre/modules/Blocklist.jsm"
);
let url = await Blocklist.getPluginBlockURL(pluginTag);
openTrustedLinkIn(url, "tab");
},
submitReport: function submitReport(runID, keyVals, submitURLOptIn) {
if (!AppConstants.MOZ_CRASHREPORTER) {
return;
}
Services.prefs.setBoolPref(
"dom.ipc.plugins.reportCrashURL",
submitURLOptIn
);
PluginCrashReporter.submitCrashReport(runID, keyVals);
},
// Callback for user clicking a "reload page" link
reloadPage(browser) {
browser.reload();
},
// Callback for user clicking the help icon
openHelpPage() {
openHelpLink("plugin-crashed", false);
},
_clickToPlayNotificationEventCallback: function PH_ctpEventCallback(event) {
if (event == "showing") {
Services.telemetry
.getHistogramById("PLUGINS_NOTIFICATION_SHOWN")
.add(!this.options.primaryPlugin);
// Histograms always start at 0, even though our data starts at 1
let histogramCount = this.options.pluginData.size - 1;
if (histogramCount > 4) {
histogramCount = 4;
}
Services.telemetry
.getHistogramById("PLUGINS_NOTIFICATION_PLUGIN_COUNT")
.add(histogramCount);
} else if (event == "dismissed") {
// Once the popup is dismissed, clicking the icon should show the full
// list again
this.options.primaryPlugin = null;
}
},
/**
* Called from the plugin doorhanger to set the new permissions for a plugin
* and activate plugins if necessary.
* aNewState should be one of:
* - "allownow"
* - "block"
* - "continue"
* - "continueblocking"
*/
_updatePluginPermission(aBrowser, aPluginInfo, aNewState) {
let permission;
let expireType;
let expireTime;
let histogram = Services.telemetry.getHistogramById(
"PLUGINS_NOTIFICATION_USER_ACTION_2"
);
let notification = PopupNotifications.getNotification(
"click-to-play-plugins",
aBrowser
);
// Update the permission manager.
// Also update the current state of pluginInfo.fallbackType so that
// subsequent opening of the notification shows the current state.
switch (aNewState) {
case "allownow":
permission = Ci.nsIPermissionManager.ALLOW_ACTION;
expireType = Ci.nsIPermissionManager.EXPIRE_SESSION;
expireTime =
Date.now() +
Services.prefs.getIntPref(this.PREF_SESSION_PERSIST_MINUTES) *
60 *
1000;
histogram.add(0);
aPluginInfo.fallbackType = Ci.nsIObjectLoadingContent.PLUGIN_ACTIVE;
notification.options.extraAttr = "active";
break;
case "block":
permission = Ci.nsIPermissionManager.PROMPT_ACTION;
expireType = Ci.nsIPermissionManager.EXPIRE_SESSION;
expireTime = 0;
histogram.add(2);
switch (aPluginInfo.blocklistState) {
case Ci.nsIBlocklistService.STATE_VULNERABLE_UPDATE_AVAILABLE:
aPluginInfo.fallbackType =
Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE;
break;
case Ci.nsIBlocklistService.STATE_VULNERABLE_NO_UPDATE:
aPluginInfo.fallbackType =
Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_NO_UPDATE;
break;
default:
// PLUGIN_CLICK_TO_PLAY_QUIET will only last until they reload the page, at
// which point it will be PLUGIN_CLICK_TO_PLAY (the overlays will appear)
aPluginInfo.fallbackType =
Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY_QUIET;
}
notification.options.extraAttr = "inactive";
break;
// In case a plugin has already been allowed/disallowed in another tab, the
// buttons matching the existing block state shouldn't change any permissions
// but should run the plugin-enablement code below.
case "continue":
aPluginInfo.fallbackType = Ci.nsIObjectLoadingContent.PLUGIN_ACTIVE;
notification.options.extraAttr = "active";
break;
case "continueblocking":
aPluginInfo.fallbackType =
Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY_QUIET;
notification.options.extraAttr = "inactive";
break;
default:
Cu.reportError(Error("Unexpected plugin state: " + aNewState));
return;
}
if (aNewState != "continue" && aNewState != "continueblocking") {
let principal = notification.options.principal;
Services.perms.addFromPrincipal(
principal,
aPluginInfo.permissionString,
permission,
expireType,
expireTime
);
aPluginInfo.pluginPermissionType = expireType;
}
aBrowser.messageManager.sendAsyncMessage("BrowserPlugins:ActivatePlugins", {
pluginInfo: aPluginInfo,
newState: aNewState,
});
},
showClickToPlayNotification(browser, plugins, showNow, principal, location) {
// It is possible that we've received a message from the frame script to show
// a click to play notification for a principal that no longer matches the one
// that the browser's content now has assigned (ie, the browser has browsed away
// after the message was sent, but before the message was received). In that case,
// we should just ignore the message.
if (!principal.equals(browser.contentPrincipal)) {
return;
}
// Data URIs, when linked to from some page, inherit the principal of that
// page. That means that we also need to compare the actual locations to
// ensure we aren't getting a message from a Data URI that we're no longer
// looking at.
let receivedURI = Services.io.newURI(location);
if (!browser.documentURI.equalsExceptRef(receivedURI)) {
return;
}
let notification = PopupNotifications.getNotification(
"click-to-play-plugins",
browser
);
// If this is a new notification, create a pluginData map, otherwise append
let pluginData;
if (notification) {
pluginData = notification.options.pluginData;
} else {
pluginData = new Map();
}
for (let pluginInfo of plugins) {
if (pluginData.has(pluginInfo.permissionString)) {
continue;
}
pluginData.set(pluginInfo.permissionString, pluginInfo);
}
let primaryPluginPermission = null;
if (showNow) {
primaryPluginPermission = plugins[0].permissionString;
}
if (notification) {
// Don't modify the notification UI while it's on the screen, that would be
// jumpy and might allow clickjacking.
if (showNow) {
notification.options.primaryPlugin = primaryPluginPermission;
notification.reshow();
}
return;
}
if (plugins.length == 1) {
let pluginInfo = plugins[0];
let active =
pluginInfo.fallbackType == Ci.nsIObjectLoadingContent.PLUGIN_ACTIVE;
let options = {
dismissed: !showNow,
hideClose: true,
persistent: showNow,
eventCallback: this._clickToPlayNotificationEventCallback,
primaryPlugin: primaryPluginPermission,
popupIconClass: "plugin-icon",
extraAttr: active ? "active" : "inactive",
pluginData,
principal,
};
let description;
if (
pluginInfo.fallbackType ==
Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE
) {
description = gNavigatorBundle.getString(
"flashActivate.outdated.message"
);
} else {
description = gNavigatorBundle.getString("flashActivate.message");
}
let badge = document.getElementById("plugin-icon-badge");
badge.setAttribute("animate", "true");
badge.addEventListener("animationend", function animListener(event) {
if (
event.animationName == "blink-badge" &&
badge.hasAttribute("animate")
) {
badge.removeAttribute("animate");
badge.removeEventListener("animationend", animListener);
}
});
let weakBrowser = Cu.getWeakReference(browser);
let mainAction = {
callback: () => {
let browserRef = weakBrowser.get();
if (browserRef) {
if (
pluginInfo.fallbackType ==
Ci.nsIObjectLoadingContent.PLUGIN_ACTIVE
) {
this._updatePluginPermission(browserRef, pluginInfo, "continue");
} else {
this._updatePluginPermission(browserRef, pluginInfo, "allownow");
}
}
},
label: gNavigatorBundle.getString("flashActivate.allow"),
accessKey: gNavigatorBundle.getString("flashActivate.allow.accesskey"),
dismiss: true,
};
let secondaryActions = [
{
callback: () => {
let browserRef = weakBrowser.get();
if (browserRef) {
if (
pluginInfo.fallbackType ==
Ci.nsIObjectLoadingContent.PLUGIN_ACTIVE
) {
this._updatePluginPermission(browserRef, pluginInfo, "block");
} else {
this._updatePluginPermission(
browserRef,
pluginInfo,
"continueblocking"
);
}
}
},
label: gNavigatorBundle.getString("flashActivate.noAllow"),
accessKey: gNavigatorBundle.getString(
"flashActivate.noAllow.accesskey"
),
dismiss: true,
},
];
PopupNotifications.show(
browser,
"click-to-play-plugins",
description,
"plugins-notification-icon",
mainAction,
secondaryActions,
options
);
// Check if the plugin is insecure and update the notification icon accordingly.
let haveInsecure = false;
switch (pluginInfo.fallbackType) {
// haveInsecure will trigger the red flashing icon and the infobar
// styling below
case Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_UPDATABLE:
case Ci.nsIObjectLoadingContent.PLUGIN_VULNERABLE_NO_UPDATE:
haveInsecure = true;
}
document
.getElementById("plugins-notification-icon")
.classList.toggle("plugin-blocked", haveInsecure);
} else {
this.removeNotification(browser, "click-to-play-plugins");
}
},
removeNotification(browser, name) {
let notification = PopupNotifications.getNotification(name, browser);
if (notification) {
PopupNotifications.remove(notification);
}
},
contextMenuCommand(browser, plugin, command) {
browser.messageManager.sendAsyncMessage(
"BrowserPlugins:ContextMenuCommand",
{ command },
{ plugin }
);
},
// Crashed-plugin observer. Notified once per plugin crash, before events
// are dispatched to individual plugin instances.
NPAPIPluginCrashed(subject, topic, data) {
let propertyBag = subject;
if (
!(propertyBag instanceof Ci.nsIPropertyBag2) ||
!(propertyBag instanceof Ci.nsIWritablePropertyBag2) ||
!propertyBag.hasKey("runID") ||
!propertyBag.hasKey("pluginName")
) {
Cu.reportError(
"A NPAPI plugin crashed, but the properties of this plugin " +
"cannot be read."
);
return;
}
let runID = propertyBag.getPropertyAsUint32("runID");
let uglyPluginName = propertyBag.getPropertyAsAString("pluginName");
let pluginName = BrowserUtils.makeNicePluginName(uglyPluginName);
let pluginDumpID = propertyBag.getPropertyAsAString("pluginDumpID");
// If we don't have a minidumpID, we can't (or didn't) submit anything.
// This can happen if the plugin is killed from the task manager.
let state;
if (!AppConstants.MOZ_CRASHREPORTER || !gCrashReporter.enabled) {
// This state tells the user that crash reporting is disabled, so we
// cannot send a report.
state = "noSubmit";
} else if (!pluginDumpID) {
// This state tells the user that there is no crash report available.
state = "noReport";
} else {
// This state asks the user to submit a crash report.
state = "please";
}
let mm = window.getGroupMessageManager("browsers");
mm.broadcastAsyncMessage("BrowserPlugins:NPAPIPluginProcessCrashed", {
pluginName,
runID,
state,
});
},
/**
* Shows a plugin-crashed notification bar for a browser that has had an
* invisiable NPAPI plugin crash, or a GMP plugin crash.
*
* @param browser
* The browser to show the notification for.
* @param messageString
* The string to put in the notification bar
* @param pluginID
* The unique-per-process identifier for the NPAPI plugin or GMP.
* For a GMP, this is the pluginID. For NPAPI plugins (where "pluginID"
* means something different), this is the runID.
*/
showPluginCrashedNotification(browser, messageString, pluginID) {
// If there's already an existing notification bar, don't do anything.
let notificationBox = gBrowser.getNotificationBox(browser);
let notification = notificationBox.getNotificationWithValue(
"plugin-crashed"
);
if (notification) {
return;
}
// Configure the notification bar
let priority = notificationBox.PRIORITY_WARNING_MEDIUM;
let iconURL = "chrome://global/skin/plugins/pluginGeneric.svg";
let reloadLabel = gNavigatorBundle.getString(
"crashedpluginsMessage.reloadButton.label"
);
let reloadKey = gNavigatorBundle.getString(
"crashedpluginsMessage.reloadButton.accesskey"
);
let buttons = [
{
label: reloadLabel,
accessKey: reloadKey,
popup: null,
callback() {
browser.reload();
},
},
];
if (
AppConstants.MOZ_CRASHREPORTER &&
PluginCrashReporter.hasCrashReport(pluginID)
) {
let submitLabel = gNavigatorBundle.getString(
"crashedpluginsMessage.submitButton.label"
);
let submitKey = gNavigatorBundle.getString(
"crashedpluginsMessage.submitButton.accesskey"
);
let submitButton = {
label: submitLabel,
accessKey: submitKey,
popup: null,
callback: () => {
PluginCrashReporter.submitCrashReport(pluginID);
},
};
buttons.push(submitButton);
}
notification = notificationBox.appendNotification(
messageString,
"plugin-crashed",
iconURL,
priority,
buttons
);
// Add the "learn more" link.
let link = notification.ownerDocument.createXULElement("label", {
is: "text-link",
});
link.setAttribute(
"value",
gNavigatorBundle.getString("crashedpluginsMessage.learnMore")
);
let crashurl = formatURL("app.support.baseURL", true);
crashurl += "plugin-crashed-notificationbar";
link.href = crashurl;
notification.messageText.appendChild(link);
},
};
gPluginHandler.init();

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

@ -1739,11 +1739,6 @@ var gBrowserInit = {
onLoad() {
gBrowser.addEventListener("DOMUpdateBlockedPopups", gPopupBlockerObserver);
Services.obs.addObserver(
gPluginHandler.NPAPIPluginCrashed,
"plugin-crashed"
);
window.addEventListener("AppCommand", HandleAppCommandEvent, true);
// These routines add message listeners. They must run before
@ -2419,11 +2414,6 @@ var gBrowserInit = {
gExtensionsNotifications.uninit();
Services.obs.removeObserver(
gPluginHandler.NPAPIPluginCrashed,
"plugin-crashed"
);
try {
gBrowser.removeProgressListener(window.XULBrowserWindow);
gBrowser.removeTabsProgressListener(window.TabsProgressListener);

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

@ -89,7 +89,6 @@
}
Services.scriptloader.loadSubScript("chrome://browser/content/browser-media.js", this);
Services.scriptloader.loadSubScript("chrome://browser/content/browser-pageActions.js", this);
Services.scriptloader.loadSubScript("chrome://browser/content/browser-plugins.js", this);
Services.scriptloader.loadSubScript("chrome://browser/content/browser-sidebar.js", this);
Services.scriptloader.loadSubScript("chrome://browser/content/browser-tabsintitlebar.js", this);
Services.scriptloader.loadSubScript("chrome://browser/content/tabbrowser.js", this);

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

@ -139,9 +139,6 @@ with Files("browser-pageActions.js"):
with Files("browser-places.js"):
BUG_COMPONENT = ("Firefox", "Bookmarks & History")
with Files("browser-plugins.js"):
BUG_COMPONENT = ("Core", "Plug-ins")
with Files("browser-safebrowsing.js"):
BUG_COMPONENT = ("Toolkit", "Safe Browsing")

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

@ -1701,11 +1701,11 @@ nsContextMenu.prototype = {
},
playPlugin() {
gPluginHandler.contextMenuCommand(this.browser, this.target, "play");
this.actor.pluginCommand("play", this.targetIdentifier);
},
hidePlugin() {
gPluginHandler.contextMenuCommand(this.browser, this.target, "hide");
this.actor.pluginCommand("hide", this.targetIdentifier);
},
// Generate email address and put it on clipboard.

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

@ -23,7 +23,6 @@ support-files =
plugin_alternate_content.html
plugin_big.html
plugin_bug749455.html
plugin_bug820497.html
plugin_hidden_to_visible.html
plugin_iframe.html
plugin_outsideScrollArea.html

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

@ -28,7 +28,6 @@ support-files =
plugin_bug749455.html
plugin_bug787619.html
plugin_bug797677.html
plugin_bug820497.html
plugin_favorfallback.html
plugin_hidden_to_visible.html
plugin_iframe.html
@ -55,8 +54,6 @@ fail-if = fission
[browser_bug812562.js]
tags = blocklist
[browser_bug818118.js]
[browser_bug820497.js]
fail-if = fission
[browser_clearplugindata.js]
tags = blocklist
[browser_CTP_context_menu.js]

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

@ -87,5 +87,5 @@ add_task(async function() {
// check plugin state
pluginInfo = await promiseForPluginInfo("test", gBrowser.selectedBrowser);
ok(pluginInfo.activated, "plugin should not be activated");
ok(pluginInfo.activated, "plugin should be activated");
});

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

@ -63,125 +63,119 @@ add_task(async function setup() {
* click-to-play activation.
*/
add_task(async function() {
await BrowserTestUtils.withNewTab(
{
gBrowser,
url: PLUGIN_PAGE,
},
async function(browser) {
// Work around for delayed PluginBindingAttached
await promiseUpdatePluginBindings(browser);
await BrowserTestUtils.withNewTab(PLUGIN_PAGE, async function(browser) {
// Work around for delayed PluginBindingAttached
await promiseUpdatePluginBindings(browser);
let pluginInfo = await promiseForPluginInfo("test", browser);
ok(!pluginInfo.activated, "Plugin should not be activated");
let pluginInfo = await promiseForPluginInfo("test", browser);
ok(!pluginInfo.activated, "Plugin should not be activated");
// Simulate clicking the "Allow Always" button.
let notification = PopupNotifications.getNotification(
"click-to-play-plugins",
browser
);
await promiseForNotificationShown(notification, browser);
PopupNotifications.panel.firstElementChild.button.click();
// Simulate clicking the "Allow Always" button.
let notification = PopupNotifications.getNotification(
"click-to-play-plugins",
browser
);
await promiseForNotificationShown(notification, browser);
PopupNotifications.panel.firstElementChild.button.click();
// Prepare a crash report topic observer that only returns when
// the crash report has been successfully sent.
let crashReportChecker = (subject, data) => {
return data == "success";
// Prepare a crash report topic observer that only returns when
// the crash report has been successfully sent.
let crashReportChecker = (subject, data) => {
return data == "success";
};
let crashReportPromise = TestUtils.topicObserved(
"crash-report-status",
crashReportChecker
);
await ContentTask.spawn(browser, null, async function() {
let plugin = content.document.getElementById("test");
plugin.QueryInterface(Ci.nsIObjectLoadingContent);
await ContentTaskUtils.waitForCondition(() => {
return plugin.activated;
}, "Waited too long for plugin to activate.");
try {
Cu.waiveXrays(plugin).crash();
} catch (e) {}
let getUI = id => {
return plugin.openOrClosedShadowRoot.getElementById(id);
};
let crashReportPromise = TestUtils.topicObserved(
"crash-report-status",
crashReportChecker
);
await ContentTask.spawn(browser, null, async function() {
let plugin = content.document.getElementById("test");
plugin.QueryInterface(Ci.nsIObjectLoadingContent);
// Now wait until the plugin crash report UI shows itself, which is
// asynchronous.
let statusDiv;
await ContentTaskUtils.waitForCondition(() => {
return plugin.activated;
}, "Waited too long for plugin to activate.");
await ContentTaskUtils.waitForCondition(() => {
statusDiv = getUI("submitStatus");
return statusDiv.getAttribute("status") == "please";
}, "Waited too long for plugin to show crash report UI");
try {
Cu.waiveXrays(plugin).crash();
} catch (e) {}
let getUI = id => {
return plugin.openOrClosedShadowRoot.getElementById(id);
};
// Now wait until the plugin crash report UI shows itself, which is
// asynchronous.
let statusDiv;
await ContentTaskUtils.waitForCondition(() => {
statusDiv = getUI("submitStatus");
return statusDiv.getAttribute("status") == "please";
}, "Waited too long for plugin to show crash report UI");
// Make sure the UI matches our expectations...
let style = content.getComputedStyle(getUI("pleaseSubmit"));
if (style.display != "block") {
throw new Error(
`Submission UI visibility is not correct. ` +
`Expected block style, got ${style.display}.`
);
}
// Fill the crash report in with some test values that we'll test for in
// the parent.
getUI("submitComment").value = "a test comment";
let optIn = getUI("submitURLOptIn");
if (!optIn.checked) {
throw new Error("URL opt-in should default to true.");
}
// Submit the report.
optIn.click();
getUI("submitButton").click();
// And wait for the parent to say that the crash report was submitted
// successfully. This can take time on debug builds.
await ContentTaskUtils.waitForCondition(
() => {
return statusDiv.getAttribute("status") == "success";
},
"Timed out waiting for plugin binding to be in success state",
100,
200
// Make sure the UI matches our expectations...
let style = content.getComputedStyle(getUI("pleaseSubmit"));
if (style.display != "block") {
throw new Error(
`Submission UI visibility is not correct. ` +
`Expected block style, got ${style.display}.`
);
});
}
let [subject] = await crashReportPromise;
// Fill the crash report in with some test values that we'll test for in
// the parent.
getUI("submitComment").value = "a test comment";
let optIn = getUI("submitURLOptIn");
if (!optIn.checked) {
throw new Error("URL opt-in should default to true.");
}
ok(
subject instanceof Ci.nsIPropertyBag,
"The crash report subject should be an nsIPropertyBag."
// Submit the report.
optIn.click();
getUI("submitButton").click();
// And wait for the parent to say that the crash report was submitted
// successfully. This can take time on debug builds.
await ContentTaskUtils.waitForCondition(
() => {
return statusDiv.getAttribute("status") == "success";
},
"Timed out waiting for plugin binding to be in success state",
100,
200
);
});
let crashData = convertPropertyBag(subject);
ok(crashData.serverCrashID, "Should have a serverCrashID set.");
let [subject] = await crashReportPromise;
// Remove the submitted report file after ensuring it exists.
let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
file.initWithPath(Services.crashmanager._submittedDumpsDir);
file.append(crashData.serverCrashID + ".txt");
ok(file.exists(), "Submitted report file should exist");
file.remove(false);
ok(
subject instanceof Ci.nsIPropertyBag,
"The crash report subject should be an nsIPropertyBag."
);
ok(crashData.extra, "Extra data should exist");
is(
crashData.extra.PluginUserComment,
"a test comment",
"Comment in extra data should match comment in textbox"
);
let crashData = convertPropertyBag(subject);
ok(crashData.serverCrashID, "Should have a serverCrashID set.");
is(
crashData.extra.PluginContentURL,
undefined,
"URL should be absent from extra data when opt-in not checked"
);
}
);
// Remove the submitted report file after ensuring it exists.
let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
file.initWithPath(Services.crashmanager._submittedDumpsDir);
file.append(crashData.serverCrashID + ".txt");
ok(file.exists(), "Submitted report file should exist");
file.remove(false);
ok(crashData.extra, "Extra data should exist");
is(
crashData.extra.PluginUserComment,
"a test comment",
"Comment in extra data should match comment in textbox"
);
is(
crashData.extra.PluginContentURL,
undefined,
"URL should be absent from extra data when opt-in not checked"
);
});
});
/**

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

@ -10,6 +10,15 @@ function updateAllTestPlugins(aState) {
setTestPluginEnabledState(aState, "Second Test Plug-in");
}
function promisePluginActivated() {
return ContentTask.spawn(gBrowser.selectedBrowser, null, function() {
return ContentTaskUtils.waitForCondition(
() => content.document.getElementById("test").activated,
"Wait for plugin to be activated"
);
});
}
add_task(async function() {
registerCleanupFunction(async function() {
clearAllPluginPermissions();
@ -191,6 +200,7 @@ add_task(async function() {
PopupNotifications.panel.firstElementChild.button.click();
await promisePluginActivated();
pluginInfo = await promiseForPluginInfo("test");
is(
pluginInfo.pluginFallbackType,
@ -305,6 +315,7 @@ add_task(async function() {
PopupNotifications.panel.firstElementChild.button.click();
await promisePluginActivated();
pluginInfo = await promiseForPluginInfo("test");
ok(pluginInfo.activated, "Test 24a, Plugin should be active.");
@ -343,6 +354,7 @@ add_task(async function() {
PopupNotifications.panel.firstElementChild.button.click();
await promisePluginActivated();
pluginInfo = await promiseForPluginInfo("test");
ok(pluginInfo.activated, "Test 24b, Plugin should be active.");

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

@ -1,107 +0,0 @@
var gTestRoot = getRootDirectory(gTestPath).replace(
"chrome://mochitests/content/",
"http://127.0.0.1:8888/"
);
var gTestBrowser = null;
var gNumPluginBindingsAttached = 0;
add_task(async function() {
registerCleanupFunction(function() {
clearAllPluginPermissions();
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, "Test Plug-in");
setTestPluginEnabledState(
Ci.nsIPluginTag.STATE_ENABLED,
"Second Test Plug-in"
);
gBrowser.removeCurrentTab();
window.focus();
gTestBrowser = null;
});
});
add_task(async function() {
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser);
gTestBrowser = gBrowser.selectedBrowser;
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Test Plug-in");
setTestPluginEnabledState(
Ci.nsIPluginTag.STATE_CLICKTOPLAY,
"Second Test Plug-in"
);
BrowserTestUtils.addContentEventListener(
gTestBrowser,
"PluginBindingAttached",
function() {
gNumPluginBindingsAttached++;
},
true,
null,
true
);
await promiseTabLoadEvent(
gBrowser.selectedTab,
gTestRoot + "plugin_bug820497.html"
);
await promiseForCondition(function() {
return gNumPluginBindingsAttached == 1;
});
await ContentTask.spawn(gTestBrowser, null, () => {
// Note we add the second plugin in the code farther down, so there's
// no way we got here with anything but one plugin loaded.
let doc = content.document;
let testplugin = doc.getElementById("test");
ok(testplugin, "should have test plugin");
let secondtestplugin = doc.getElementById("secondtest");
ok(!secondtestplugin, "should not yet have second test plugin");
});
await promisePopupNotification("click-to-play-plugins");
let notification = PopupNotifications.getNotification(
"click-to-play-plugins",
gTestBrowser
);
ok(notification, "should have a click-to-play notification");
await promiseForNotificationShown(notification);
is(
notification.options.pluginData.size,
1,
"should be 1 type of plugin in the popup notification"
);
await ContentTask.spawn(gTestBrowser, {}, async function() {
XPCNativeWrapper.unwrap(content).addSecondPlugin();
});
await promiseForCondition(function() {
return gNumPluginBindingsAttached == 2;
});
await ContentTask.spawn(gTestBrowser, null, () => {
let doc = content.document;
let testplugin = doc.getElementById("test");
ok(testplugin, "should have test plugin");
let secondtestplugin = doc.getElementById("secondtest");
ok(secondtestplugin, "should have second test plugin");
});
notification = PopupNotifications.getNotification(
"click-to-play-plugins",
gTestBrowser
);
ok(notification, "should have popup notification");
await promiseForNotificationShown(notification);
is(
notification.options.pluginData.size,
2,
"aited too long for 2 types of plugins in popup notification"
);
});

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

@ -1,3 +1,9 @@
"use strict";
let { PluginManager } = ChromeUtils.import(
"resource:///actors/PluginParent.jsm"
);
/**
* Test that the notification bar for crashed GMPs works.
*/
@ -8,6 +14,13 @@ add_task(async function() {
url: "about:blank",
},
async function(browser) {
// Ensure the parent has heard before the client.
// In practice, this is always true for GMP crashes (but not for NPAPI ones!)
PluginManager.gmpCrashes.set(1, {
pluginID: 1,
pluginName: "GlobalTestPlugin",
});
await ContentTask.spawn(browser, null, async function() {
const GMP_CRASH_EVENT = {
pluginID: 1,

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

@ -5,6 +5,10 @@ const { PromiseUtils } = ChromeUtils.import(
"resource://gre/modules/PromiseUtils.jsm"
);
const { PluginManager } = ChromeUtils.import(
"resource:///actors/PluginParent.jsm"
);
/**
* With e10s, plugins must run in their own process. This means we have
* three processes at a minimum when we're running a plugin:
@ -24,7 +28,6 @@ const { PromiseUtils } = ChromeUtils.import(
const CRASH_URL =
"http://example.com/browser/browser/base/content/test/plugins/plugin_crashCommentAndURL.html";
const CRASHED_MESSAGE = "BrowserPlugins:NPAPIPluginProcessCrashed";
/**
* In order for our test to work, we need to be able to put a plugin
@ -80,9 +83,10 @@ function preparePlugin(browser, pluginFallbackState) {
});
return plugin.runID;
}).then(runID => {
browser.messageManager.sendAsyncMessage(
"BrowserPlugins:Test:ClearCrashData"
);
let { currentWindowGlobal } = browser.frameLoader.browsingContext;
currentWindowGlobal
.getActor("Plugin")
.sendAsyncMessage("PluginParent:Test:ClearCrashData");
return runID;
});
}
@ -123,7 +127,7 @@ let crashObserver = (subject, topic, data) => {
};
Services.obs.addObserver(crashObserver, "plugin-crashed");
// plugins.testmode will make BrowserPlugins:Test:ClearCrashData work.
// plugins.testmode will make PluginParent:Test:ClearCrashData work.
Services.prefs.setBoolPref("plugins.testmode", true);
registerCleanupFunction(() => {
Services.prefs.clearUserPref("plugins.testmode");
@ -149,20 +153,12 @@ add_task(async function testChromeHearsPluginCrashFirst() {
// pseudoselector, but we want it to seem still active, because the
// content process is not yet supposed to know that the plugin has
// crashed.
let runID = await preparePlugin(
browser,
Ci.nsIObjectLoadingContent.PLUGIN_ACTIVE
);
// Send the message down to PluginContent.jsm saying that the plugin has
// crashed, and that we have a crash report.
let mm = browser.messageManager;
mm.sendAsyncMessage(CRASHED_MESSAGE, {
pluginName: "",
runID,
state: "please",
});
await preparePlugin(browser, Ci.nsIObjectLoadingContent.PLUGIN_ACTIVE);
// In this case, the parent responds immediately when the child asks
// for crash data. in `testContentHearsCrashFirst we will delay the
// response (simulating what happens if the parent doesn't know about
// the crash yet).
await ContentTask.spawn(browser, null, async function() {
// At this point, the content process should have heard the
// plugin crash message from the parent, and we are OK to emit
@ -178,7 +174,7 @@ add_task(async function testChromeHearsPluginCrashFirst() {
return;
}
// Now we need the plugin to seem crashed to PluginContent.jsm, without
// Now we need the plugin to seem crashed to the child actor, without
// actually crashing the plugin again. We hack around this by overriding
// the pluginFallbackType again.
Object.defineProperty(plugin, "pluginFallbackType", {
@ -197,6 +193,11 @@ add_task(async function testChromeHearsPluginCrashFirst() {
});
plugin.dispatchEvent(event);
// The plugin child actor will go fetch crash info in the parent. Wait
// for it to come back:
await ContentTaskUtils.waitForCondition(
() => statusDiv.getAttribute("status") == "please"
);
Assert.equal(
statusDiv.getAttribute("status"),
"please",
@ -230,6 +231,21 @@ add_task(async function testContentHearsCrashFirst() {
Ci.nsIObjectLoadingContent.PLUGIN_CRASHED
);
// We resolve this promise when we're ready to tell the child from the parent.
let allowParentToRespond = PromiseUtils.defer();
// This promise is resolved as soon as we're contacted by the child.
// It forces the parent not to respond until `allowParentToRespond` has been
// resolved.
let parentRequestPromise = new Promise(resolve => {
PluginManager.mockResponse(browser, function(data) {
resolve(data);
return allowParentToRespond.promise.then(() => {
return { pluginName: "", runID, state: "please" };
});
});
});
await ContentTask.spawn(browser, null, async function() {
// At this point, the content process has not yet heard from the
// parent about the crash report. Let's ensure that by making sure
@ -254,7 +270,16 @@ add_task(async function testContentHearsCrashFirst() {
});
plugin.dispatchEvent(event);
});
let receivedData = await parentRequestPromise;
is(receivedData.runID, runID, "Should get a request for the same crash.");
await ContentTask.spawn(browser, null, function() {
let plugin = content.document.getElementById("plugin");
plugin.QueryInterface(Ci.nsIObjectLoadingContent);
let statusDiv = plugin.openOrClosedShadowRoot.getElementById(
"submitStatus"
);
Assert.notEqual(
statusDiv.getAttribute("status"),
"please",
@ -262,14 +287,8 @@ add_task(async function testContentHearsCrashFirst() {
);
});
// Now send the message down to PluginContent.jsm that the plugin has
// crashed...
let mm = browser.messageManager;
mm.sendAsyncMessage(CRASHED_MESSAGE, {
pluginName: "",
runID,
state: "please",
});
// Now allow the parent to respond to the child with crash info:
allowParentToRespond.resolve();
await ContentTask.spawn(browser, null, async function() {
// At this point, the content process will have heard the message
@ -280,6 +299,9 @@ add_task(async function testContentHearsCrashFirst() {
let statusDiv = plugin.openOrClosedShadowRoot.getElementById(
"submitStatus"
);
await ContentTaskUtils.waitForCondition(() => {
return statusDiv && statusDiv.getAttribute("status") == "please";
});
Assert.equal(
statusDiv.getAttribute("status"),

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

@ -1,17 +0,0 @@
<!DOCTYPE html>
<html>
<head><meta charset="utf-8"/></head>
<body>
<object id="test" type="application/x-test" width=200 height=200></object>
<script>
function addSecondPlugin() {
var object = document.createElement("object");
object.type = "application/x-second-test";
object.width = 200;
object.height = 200;
object.id = "secondtest";
document.body.appendChild(object);
}
</script>
</body>
</html>

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

@ -48,7 +48,6 @@ browser.jar:
content/browser/browser-media.js (content/browser-media.js)
content/browser/browser-pageActions.js (content/browser-pageActions.js)
content/browser/browser-places.js (content/browser-places.js)
content/browser/browser-plugins.js (content/browser-plugins.js)
content/browser/browser-safebrowsing.js (content/browser-safebrowsing.js)
content/browser/browser-sidebar.js (content/browser-sidebar.js)
content/browser/browser-siteIdentity.js (content/browser-siteIdentity.js)

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

@ -61,6 +61,40 @@ let ACTORS = {
allFrames: true,
},
Plugin: {
parent: {
moduleURI: "resource:///actors/PluginParent.jsm",
messages: [
"PluginContent:ShowClickToPlayNotification",
"PluginContent:RemoveNotification",
"PluginContent:ShowPluginCrashedNotification",
"PluginContent:SubmitReport",
"PluginContent:LinkClickCallback",
"PluginContent:GetCrashData",
],
},
child: {
moduleURI: "resource:///actors/PluginChild.jsm",
events: {
PluginBindingAttached: { capture: true, wantUntrusted: true },
PluginCrashed: { capture: true },
PluginOutdated: { capture: true },
PluginInstantiated: { capture: true },
PluginRemoved: { capture: true },
HiddenPlugin: { capture: true },
},
messages: [
"PluginParent:ActivatePlugins",
"PluginParent:Test:ClearCrashData",
],
observers: ["decoder-doctor-notification"],
},
allFrames: true,
},
SwitchDocumentDirection: {
child: {
moduleURI: "resource:///actors/SwitchDocumentDirectionChild.jsm",
@ -270,30 +304,6 @@ let LEGACY_ACTORS = {
},
},
Plugin: {
child: {
module: "resource:///actors/PluginChild.jsm",
events: {
PluginBindingAttached: { capture: true, wantUntrusted: true },
PluginCrashed: { capture: true },
PluginOutdated: { capture: true },
PluginInstantiated: { capture: true },
PluginRemoved: { capture: true },
HiddenPlugin: { capture: true },
},
messages: [
"BrowserPlugins:ActivatePlugins",
"BrowserPlugins:ContextMenuCommand",
"BrowserPlugins:NPAPIPluginProcessCrashed",
"BrowserPlugins:CrashReportSubmitted",
"BrowserPlugins:Test:ClearCrashData",
],
observers: ["decoder-doctor-notification"],
},
},
RFPHelper: {
child: {
module: "resource:///actors/RFPHelperChild.jsm",
@ -522,6 +532,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
ContentClick: "resource:///modules/ContentClick.jsm",
FormValidationHandler: "resource:///modules/FormValidationHandler.jsm",
LoginManagerParent: "resource://gre/modules/LoginManagerParent.jsm",
PluginManager: "resource:///actors/PluginParent.jsm",
PictureInPicture: "resource://gre/modules/PictureInPicture.jsm",
ReaderParent: "resource:///modules/ReaderParent.jsm",
RemotePrompt: "resource:///modules/RemotePrompt.jsm",
@ -556,7 +567,6 @@ let initializedModules = {};
if (AppConstants.MOZ_CRASHREPORTER) {
XPCOMUtils.defineLazyModuleGetters(this, {
PluginCrashReporter: "resource:///modules/ContentCrashHandlers.jsm",
UnsubmittedCrashHandler: "resource:///modules/ContentCrashHandlers.jsm",
});
}
@ -587,6 +597,8 @@ const listeners = {
"update-downloaded": ["UpdateListener"],
"update-available": ["UpdateListener"],
"update-error": ["UpdateListener"],
"gmp-plugin-crash": ["PluginManager"],
"plugin-crashed": ["PluginManager"],
},
ppmm: {
@ -1538,9 +1550,6 @@ BrowserGlue.prototype = {
// the first browser window has finished initializing
_onFirstWindowLoaded: function BG__onFirstWindowLoaded(aWindow) {
TabCrashHandler.init();
if (AppConstants.MOZ_CRASHREPORTER) {
PluginCrashReporter.init();
}
ProcessHangMonitor.init();

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

@ -5,7 +5,6 @@
"use strict";
var EXPORTED_SYMBOLS = [
"PluginCrashReporter",
"SubframeCrashHandler",
"TabCrashHandler",
"UnsubmittedCrashHandler",
@ -1012,154 +1011,3 @@ var UnsubmittedCrashHandler = {
}
},
};
var PluginCrashReporter = {
/**
* Makes the PluginCrashReporter ready to hear about and
* submit crash reports.
*/
init() {
if (this.initialized) {
return;
}
this.initialized = true;
this.crashReports = new Map();
Services.obs.addObserver(this, "plugin-crashed");
Services.obs.addObserver(this, "gmp-plugin-crash");
Services.obs.addObserver(this, "profile-after-change");
},
uninit() {
Services.obs.removeObserver(this, "plugin-crashed");
Services.obs.removeObserver(this, "gmp-plugin-crash");
Services.obs.removeObserver(this, "profile-after-change");
this.initialized = false;
},
observe(subject, topic, data) {
switch (topic) {
case "plugin-crashed": {
let propertyBag = subject;
if (
!(propertyBag instanceof Ci.nsIPropertyBag2) ||
!(propertyBag instanceof Ci.nsIWritablePropertyBag2) ||
!propertyBag.hasKey("runID") ||
!propertyBag.hasKey("pluginDumpID")
) {
Cu.reportError(
"PluginCrashReporter can not read plugin information."
);
return;
}
let runID = propertyBag.getPropertyAsUint32("runID");
let pluginDumpID = propertyBag.getPropertyAsAString("pluginDumpID");
let browserDumpID = propertyBag.getPropertyAsAString("browserDumpID");
if (pluginDumpID) {
this.crashReports.set(runID, { pluginDumpID, browserDumpID });
}
break;
}
case "gmp-plugin-crash": {
let propertyBag = subject;
if (
!(propertyBag instanceof Ci.nsIWritablePropertyBag2) ||
!propertyBag.hasKey("pluginID") ||
!propertyBag.hasKey("pluginDumpID") ||
!propertyBag.hasKey("pluginName")
) {
Cu.reportError(
"PluginCrashReporter can not read plugin information."
);
return;
}
let pluginID = propertyBag.getPropertyAsUint32("pluginID");
let pluginDumpID = propertyBag.getPropertyAsAString("pluginDumpID");
if (pluginDumpID) {
this.crashReports.set(pluginID, { pluginDumpID });
}
// Only the parent process gets the gmp-plugin-crash observer
// notification, so we need to inform any content processes that
// the GMP has crashed.
if (Services.ppmm) {
let pluginName = propertyBag.getPropertyAsAString("pluginName");
Services.ppmm.broadcastAsyncMessage("gmp-plugin-crash", {
pluginName,
pluginID,
});
}
break;
}
case "profile-after-change":
this.uninit();
break;
}
},
/**
* Submit a crash report for a crashed NPAPI plugin.
*
* @param runID
* The runID of the plugin that crashed. A run ID is a unique
* identifier for a particular run of a plugin process - and is
* analogous to a process ID (though it is managed by Gecko instead
* of the operating system).
* @param keyVals
* An object whose key-value pairs will be merged
* with the ".extra" file submitted with the report.
* The properties of htis object will override properties
* of the same name in the .extra file.
*/
submitCrashReport(runID, keyVals) {
if (!this.crashReports.has(runID)) {
Cu.reportError(
`Could not find plugin dump IDs for run ID ${runID}.` +
`It is possible that a report was already submitted.`
);
return;
}
keyVals = keyVals || {};
let { pluginDumpID, browserDumpID } = this.crashReports.get(runID);
let submissionPromise = CrashSubmit.submit(pluginDumpID, {
recordSubmission: true,
extraExtraKeyVals: keyVals,
});
if (browserDumpID) {
CrashSubmit.submit(browserDumpID).catch(Cu.reportError);
}
this.broadcastState(runID, "submitting");
submissionPromise.then(
() => {
this.broadcastState(runID, "success");
},
() => {
this.broadcastState(runID, "failed");
}
);
this.crashReports.delete(runID);
},
broadcastState(runID, state) {
for (let window of Services.wm.getEnumerator("navigator:browser")) {
let mm = window.messageManager;
mm.broadcastAsyncMessage("BrowserPlugins:CrashReportSubmitted", {
runID,
state,
});
}
},
hasCrashReport(runID) {
return this.crashReports.has(runID);
},
};

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

@ -63,6 +63,11 @@ interface nsIPluginTag : nsISupports
Array<AUTF8String> getMimeTypes();
Array<AUTF8String> getMimeDescriptions();
Array<AUTF8String> getExtensions();
/**
* An id for this plugin. 0 is a valid id.
*/
readonly attribute unsigned long id;
};
/**
@ -89,9 +94,4 @@ interface nsIFakePluginTag : nsIPluginTag
* can use to access the element that instantiates the plugin.
*/
readonly attribute AString sandboxScript;
/**
* A unique id for this JS-implemented plugin. 0 is a valid id.
*/
readonly attribute unsigned long id;
};

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

@ -142,6 +142,9 @@ static nsresult IsEnabledStateLockedForPlugin(nsIInternalPluginTag* aTag,
}
/* nsIInternalPluginTag */
uint32_t nsIInternalPluginTag::sNextId;
nsIInternalPluginTag::nsIInternalPluginTag() {}
nsIInternalPluginTag::nsIInternalPluginTag(const char* aName,
@ -180,8 +183,6 @@ bool nsIInternalPluginTag::HasMimeType(const nsACString& aMimeType) const {
/* nsPluginTag */
uint32_t nsPluginTag::sNextId;
nsPluginTag::nsPluginTag(nsPluginInfo* aPluginInfo, int64_t aLastModifiedTime,
bool fromExtension, uint32_t aBlocklistState)
: nsIInternalPluginTag(aPluginInfo->fName, aPluginInfo->fDescription,
@ -678,12 +679,16 @@ nsPluginTag::GetLastModifiedTime(PRTime* aLastModifiedTime) {
return NS_OK;
}
NS_IMETHODIMP
nsPluginTag::GetId(uint32_t* aId) {
*aId = mId;
return NS_OK;
}
bool nsPluginTag::IsFromExtension() const { return mIsFromExtension; }
/* nsFakePluginTag */
uint32_t nsFakePluginTag::sNextId;
nsFakePluginTag::nsFakePluginTag()
: mId(sNextId++), mState(nsPluginTag::ePluginState_Disabled) {}

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

@ -92,6 +92,8 @@ class nsIInternalPluginTag : public nsIPluginTag {
nsTArray<nsCString> mMimeTypes; // UTF-8
nsTArray<nsCString> mMimeDescriptions; // UTF-8
nsTArray<nsCString> mExtensions; // UTF-8
static uint32_t sNextId;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIInternalPluginTag, NS_IINTERNALPLUGINTAG_IID)
@ -183,8 +185,6 @@ class nsPluginTag final : public nsIInternalPluginTag {
void InitSandboxLevel();
nsresult EnsureMembersAreUTF8();
void FixupVersion();
static uint32_t sNextId;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsPluginTag, NS_PLUGINTAG_IID)
@ -240,10 +240,6 @@ class nsFakePluginTag : public nsIInternalPluginTag, public nsIFakePluginTag {
nsString mSandboxScript;
nsPluginTag::PluginState mState;
// Stores the id to use for the JS-implemented plugin that gets registered
// next through nsPluginHost::RegisterFakePlugin.
static uint32_t sNextId;
};
#endif // nsPluginTags_h_

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

@ -109,14 +109,16 @@ var testObserver = {
};
function onPluginCrashed(aEvent) {
async function onPluginCrashed(aEvent) {
ok(true, "Plugin crashed notification received");
is(aEvent.type, "PluginCrashed", "event is correct type");
let submitButton = document.getAnonymousElementByAttribute(aEvent.target,
"class",
"submitButton") ||
aEvent.target.openOrClosedShadowRoot.getElementById("submitButton");
await SimpleTest.promiseWaitForCondition(
() => aEvent.target.openOrClosedShadowRoot.getElementById("submitButton"),
"Waiting for submit button to exist."
);
let submitButton = aEvent.target.openOrClosedShadowRoot.getElementById("submitButton");
// try to submit this report
sendMouseEvent({type:'click'}, submitButton, window);
}

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

@ -113,14 +113,15 @@ var testObserver = {
}
};
function onPluginCrashed(aEvent) {
async function onPluginCrashed(aEvent) {
ok(true, "Plugin crashed notification received");
is(aEvent.type, "PluginCrashed", "event is correct type");
let submitButton = document.getAnonymousElementByAttribute(aEvent.target,
"class",
"submitButton") ||
aEvent.target.openOrClosedShadowRoot.getElementById("submitButton");
await SimpleTest.promiseWaitForCondition(
() => aEvent.target.openOrClosedShadowRoot.getElementById("submitButton"),
"Waiting for submit button to exist."
);
let submitButton = aEvent.target.openOrClosedShadowRoot.getElementById("submitButton");
// try to submit this report
sendMouseEvent({type:'click'}, submitButton, window);
}

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

@ -9459,17 +9459,6 @@
"bug_numbers": [902075, 1345894],
"alert_emails": ["flashvideo-2015@mozilla.com"]
},
"PLUGINS_NOTIFICATION_PLUGIN_COUNT": {
"record_in_processes": ["main", "content"],
"products": ["firefox", "fennec", "geckoview"],
"releaseChannelCollection": "opt-out",
"expires_in_version": "never",
"kind": "enumerated",
"n_values": 5,
"description": "The number of plugins present in the click-to-activate notification, minus one (1, 2, 3, 4, more than 4)",
"bug_numbers": [902075, 1345894],
"alert_emails": ["flashvideo-2015@mozilla.com"]
},
"PLUGINS_NOTIFICATION_USER_ACTION_2": {
"record_in_processes": ["main", "content"],
"products": ["firefox", "fennec", "geckoview"],

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

@ -37,7 +37,7 @@
"ContactDB.jsm": ["ContactDB", "DB_NAME", "STORE_NAME", "SAVED_GETALL_STORE_NAME", "REVISION_STORE", "DB_VERSION"],
"content-process.jsm": ["init"],
"content.jsm": ["registerContentFrame"],
"ContentCrashHandlers.jsm": ["TabCrashHandler", "PluginCrashReporter", "UnsubmittedCrashHandler"],
"ContentCrashHandlers.jsm": ["TabCrashHandler", "SubframeCrashHandler", "UnsubmittedCrashHandler"],
"ContentObservers.js": [],
"ContentPrefUtils.jsm": ["ContentPref", "cbHandleResult", "cbHandleError", "cbHandleCompletion", "safeCallback", "_methodsCallableFromChild"],
"cookies.js": ["Cookies"],