Bug 1235056 - browser_pluginCrashCommentAndURL.js test needs to wait for the crash reporter to be displayed, not just for the plugin to crash r=mconley
authorKirk Steuber <ksteuber@mozilla.com>
Thu, 31 Mar 2016 14:47:34 -0700
changeset 291211 326505923c0f5d80ededec90e7b7e431cf1ed065
parent 291210 8ce603f20bac14b9bf0a34da4a17c65c83bafb66
child 291212 6bd212fe9859a9bccab6df1e455b3a1d6168f74c
push id74517
push usermconley@mozilla.com
push dateFri, 01 Apr 2016 16:25:03 +0000
treeherdermozilla-inbound@326505923c0f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley
bugs1235056
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1235056 - browser_pluginCrashCommentAndURL.js test needs to wait for the crash reporter to be displayed, not just for the plugin to crash r=mconley MozReview-Commit-ID: 2PaMjqYu54Y
browser/base/content/test/plugins/browser_pluginCrashCommentAndURL.js
browser/modules/PluginContent.jsm
--- 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
@@ -956,16 +956,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 => {