Bug 1235056 - PluginCrashReporterDisplayed event now only shown if the crash reporter can actually be shown and event is not accessible to web content. draft
authorKirk Steuber <ksteuber@mozilla.com>
Thu, 31 Mar 2016 14:31:13 -0700
changeset 346337 ec775180dd8daae800ddeee771bf1e25c19f1199
parent 346262 9e0496ae6616346d0fcc1fe4644a0d82ccbd75c0
child 517420 af70aa6627fcd65e86c26e5a7a6f430f67aa44b2
push id14347
push userksteuber@mozilla.com
push dateThu, 31 Mar 2016 21:31:42 +0000
bugs1235056
milestone48.0a1
Bug 1235056 - PluginCrashReporterDisplayed event now only shown if the crash reporter can actually be shown and event is not accessible to web content. MozReview-Commit-ID: 2hHgTR1Zqb1
browser/modules/PluginContent.jsm
--- a/browser/modules/PluginContent.jsm
+++ b/browser/modules/PluginContent.jsm
@@ -951,32 +951,34 @@ 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
+      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 => {
           this.hideNotificationBar("plugin-crashed");
         }, false);
       }
     }
-
-    // Notify others that the crash reporter UI is now ready
-    this.global.content.dispatchEvent(
-      new this.global.content.CustomEvent("PluginCrashReporterDisplayed", {bubbles: true}));
   },
 
   NPAPIPluginCrashReportSubmitted: function({ runID, state }) {
     this.pluginCrashData.delete(runID);
     let contentWindow = this.global.content;
     let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
                            .getInterface(Ci.nsIDOMWindowUtils);
     let plugins = cwu.plugins;