Bug 1235056 - browser_pluginCrashCommentAndURL.js test needs to wait for the crash reporter to be displayed, not just for the plugin to crash
MozReview-Commit-ID: 2PaMjqYu54Y
--- a/browser/base/content/test/plugins/browser_pluginCrashCommentAndURL.js
+++ b/browser/base/content/test/plugins/browser_pluginCrashCommentAndURL.js
@@ -141,18 +141,18 @@ add_task(function* () {
Assert.equal(!!pleaseSubmit && content.getComputedStyle(pleaseSubmit).display == "block",
aConfig.shouldSubmissionUIBeVisible, "Plugin crash UI should not be visible");
});
});
function promisePluginCrashed() {
return new ContentTask.spawn(gTestBrowser, {}, function* () {
yield new Promise((resolve) => {
- addEventListener("PluginCrashed", function onPluginCrashed() {
- removeEventListener("PluginCrashed", onPluginCrashed);
+ addEventListener("PluginCrashReporterDisplayed", function onPluginCrashed() {
+ removeEventListener("PluginCrashReporterDisplayed", onPluginCrashed);
resolve();
});
});
})
}
function onSubmitStatus(aSubject, aData) {
// Wait for success or failed, doesn't matter which.
--- a/browser/modules/PluginContent.jsm
+++ b/browser/modules/PluginContent.jsm
@@ -951,16 +951,23 @@ PluginContent.prototype = {
let runID = plugin.runID;
if (isShowing) {
// If a previous plugin on the page was too small and resulted in adding a
// notification bar, then remove it because this plugin instance it big
// enough to serve as in-content notification.
this.hideNotificationBar("plugin-crashed");
doc.mozNoPluginCrashedNotification = true;
+
+ // Notify others that the crash reporter UI is now ready.
+ // Currently, this event is only used by tests.
+ let winUtils = this.content.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindowUtils);
+ let event = new this.content.CustomEvent("PluginCrashReporterDisplayed", {bubbles: true});
+ winUtils.dispatchEventToChromeOnly(plugin, event);
} else {
// If another plugin on the page was large enough to show our UI, we don't
// want to show a notification bar.
if (!doc.mozNoPluginCrashedNotification) {
this.global.sendAsyncMessage("PluginContent:ShowPluginCrashedNotification",
{ messageString: message, pluginID: runID });
// Remove the notification when the page is reloaded.
doc.defaultView.top.addEventListener("unload", event => {