Backout Bug 697964 and its follow-up bug 698405 as the core bug was backed out from mozilla-aurora. a=Standard8
authorMark Banner <bugzilla@standard8.plus.com>
Thu, 26 Jan 2012 09:00:50 +0000
changeset 10129 86e637b83cbdd511364cf5adde50215fa90587f0
parent 10128 de5589a5f7fbde02d128fce859bdc6b0e5e84277
child 10130 67f886f2f49ab44ac1c0d50427bd67a3fd1418aa
push idunknown
push userunknown
push dateunknown
reviewersStandard8
bugs697964, 698405
Backout Bug 697964 and its follow-up bug 698405 as the core bug was backed out from mozilla-aurora. a=Standard8
mail/base/content/plugins.js
mail/test/mozmill/content-tabs/test-plugin-crashing.js
--- a/mail/base/content/plugins.js
+++ b/mail/base/content/plugins.js
@@ -251,35 +251,16 @@ var gPluginHandler = {
                {plugins: missingPluginsArray, browser: getBrowser});
   },
 
   // Callback for user clicking on a disabled plugin
   managePlugins: function ph_managePlugins(aEvent) {
     openAddonsMgr("addons://list/plugin");
   },
 
-  // When user clicks try, checks if we should also send crash report in bg
-  // When user clicks try, checks if we should also send crash report in bg
-  retryPluginPage: function (browser, plugin, pluginDumpID, browserDumpID) {
-    let doc = plugin.ownerDocument;
-
-    let statusDiv =
-      doc.getAnonymousElementByAttribute(plugin, "class", "submitStatus");
-    let status = statusDiv.getAttribute("status");
-
-    let submitChk =
-      doc.getAnonymousElementByAttribute(plugin, "class", "pleaseSubmitCheckbox");
-
-    // Check status to make sure we haven't submitted already
-    if (status == "please" && submitChk.checked) {
-      this.submitReport(pluginDumpID, browserDumpID);
-    }
-    this.reloadPage(browser);
-  },
-
   // Callback for user clicking "submit a report" link
   submitReport : function ph_submitReport(pluginDumpID, browserDumpID) {
     // The crash reporter wants a DOM element it can append an IFRAME to,
     // which it uses to submit a form. Let's just give it curBrowser.
 
     var curBrowser = document.getElementById('tabmail').getBrowserForSelectedTab();
     this.CrashSubmit.submit(pluginDumpID, curBrowser, null, null);
     if (browserDumpID)
@@ -507,20 +488,19 @@ var gPluginHandler = {
 
   // Crashed-plugin event listener. Called for every instance of a
   // plugin in content.
   pluginInstanceCrashed: function (plugin, aEvent) {
     // Ensure the plugin and event are of the right type.
     if (!(aEvent instanceof Components.interfaces.nsIDOMDataContainerEvent))
       return;
 
-    let Cc = Components.classes;
-    let Ci = Components.interfaces;
     let submittedReport = aEvent.getData("submittedCrashReport");
-    let doPrompt = true; // XXX followup for get via gCrashReporter
+    let doPrompt = true; // XXX followup for .getData("doPrompt");
+    let submitReports = true; // XXX followup for .getData("submitReports");
     let pluginName = aEvent.getData("pluginName");
     let pluginFilename = aEvent.getData("pluginFilename");
     let pluginDumpID = aEvent.getData("pluginDumpID");
     let browserDumpID = aEvent.getData("browserDumpID");
     let messengerBundle = document.getElementById("bundle_messenger");
     let tabmail = document.getElementById('tabmail');
 
     // Remap the plugin name to a more user-presentable form.
@@ -530,68 +510,51 @@ var gPluginHandler = {
 
     //
     // Configure the crashed-plugin placeholder.
     //
     let doc = plugin.ownerDocument;
     let overlay = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox");
     let statusDiv = doc.getAnonymousElementByAttribute(plugin, "class", "submitStatus");
 #ifdef MOZ_CRASHREPORTER
-    let submitReports = gCrashReporter.submitReports;
     let status;
 
     // Determine which message to show regarding crash reports.
     if (submittedReport) { // submitReports && !doPrompt, handled in observer
       status = "submitted";
     }
     else if (!submitReports && !doPrompt) {
       status = "noSubmit";
     }
     else { // doPrompt
-      // link submit checkbox to gCrashReporter submitReports preference
-      let submitChk = doc.getAnonymousElementByAttribute(
-                        plugin, "class", "pleaseSubmitCheckbox");
-      submitChk.checked = submitReports;
-      submitChk.addEventListener("click", function() {
-        gCrashReporter.submitReports = this.checked;
-      }, false);
-
       status = "please";
+      // XXX can we make the link target actually be blank?
+      let pleaseLink = doc.getAnonymousElementByAttribute(
+                            plugin, "class", "pleaseSubmitLink");
+      this.addLinkClickCallback(pleaseLink, "submitReport",
+                                pluginDumpID, browserDumpID);
     }
 
     // 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.
     if (!pluginDumpID) {
       status = "noReport";
     }
 
     statusDiv.setAttribute("status", status);
 
     let bottomLinks = doc.getAnonymousElementByAttribute(plugin, "class", "msg msgBottomLinks");
     bottomLinks.style.display = "block";
     let helpIcon = doc.getAnonymousElementByAttribute(plugin, "class", "helpIcon");
     this.addLinkClickCallback(helpIcon, "openPluginCrashHelpPage");
 
-    // If we're showing the checkbox to trigger report submission, we'll want
-    // to be able to update all the instances of the UI for this crash when
-    // one instance of the checkbox is modified or the status is updated.
+    // If we're showing the link to manually trigger report submission, we'll
+    // want to be able to update all the instances of the UI for this crash to
+    // show an updated message when a report is submitted.
     if (doPrompt) {
-      let submitReportsPrefObserver = {
-        QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
-                                               Ci.nsISupportsWeakReference]),
-        observe : function(subject, topic, data) {
-          let submitChk = doc.getAnonymousElementByAttribute(
-                            plugin, "class", "pleaseSubmitCheckbox");
-          submitChk.checked = gCrashReporter.submitReports;
-        },
-        handleEvent : function(event) {
-          // Not expected to be called, just here for the closure.
-        }
-      };
-
       let observer = {
         QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIObserver,
                                                Components.interfaces.nsISupportsWeakReference]),
         observe : function(subject, topic, data) {
           let propertyBag = subject;
           if (!(propertyBag instanceof Components.interfaces.nsIPropertyBag2))
             return;
           // Ignore notifications for other crashes.
@@ -602,40 +565,31 @@ var gPluginHandler = {
 
         handleEvent : function(event) {
             // Not expected to be called, just here for the closure.
         }
       };
 
       // Use a weak reference, so we don't have to remove it...
       Services.obs.addObserver(observer, "crash-report-status", true);
-      Services.obs.addObserver(
-        submitReportsPrefObserver, "submit-reports-pref-changed", true);
       // ...alas, now we need something to hold a strong reference to prevent
       // it from being GC. But I don't want to manually manage the reference's
       // lifetime (which should be no greater than the page).
-      // Clever solution? Use a closure with an event listener on the document.
+      // Clever solution? Use a closue with an event listener on the document.
       // When the doc goes away, so do the listener references and the closure.
       doc.addEventListener("mozCleverClosureHack", observer, false);
-      doc.addEventListener(
-        "mozCleverClosureHack", submitReportsPrefObserver, false);
     }
 #endif
 
     let crashText = doc.getAnonymousElementByAttribute(plugin, "class", "msg msgCrashed");
     crashText.textContent = messageString;
     let browser = tabmail.getBrowserForSelectedTab();
 
     let link = doc.getAnonymousElementByAttribute(plugin, "class", "reloadLink");
-#ifdef MOZ_CRASHREPORTER
-    this.addLinkClickCallback(
-      link, "retryPluginPage", browser, plugin, pluginDumpID, browserDumpID);
-#else
     this.addLinkClickCallback(link, "reloadPage", browser);
-#endif
 
     let notificationBox = getNotificationBox(browser.contentWindow);
 
     // Is the <object>'s size too small to hold what we want to show?
     if (this.isTooSmall(plugin, overlay)) {
         // Hide the overlay's contents. Use visibility style, so that it
         // doesn't collapse down to 0x0.
         overlay.style.visibility = "hidden";
--- a/mail/test/mozmill/content-tabs/test-plugin-crashing.js
+++ b/mail/test/mozmill/content-tabs/test-plugin-crashing.js
@@ -77,17 +77,16 @@ function setupModule(module) {
   Services.prefs.setCharPref(kStartPagePref, kPluginUrl);
   Services.prefs.setCharPref(kPluginCrashDocPref, kPluginCrashDocUrl);
 
   let Cc = Components.classes;
   let Ci = Components.interfaces;
 
   let crashReporter = Cc["@mozilla.org/toolkit/crash-reporter;1"]
                         .getService(Ci.nsICrashReporter);
-  crashReporter.enabled = true;
 
   /* Bug 689580 - these crash tests fail randomly on 64-bit OSX.  We'll
    * disable them for now, until we can figure out what's going on.
    */
   Components.utils.import("resource://gre/modules/Services.jsm");
   let is64BitOSX = (mc.mozmillModule.isMac &&
                     Services.appinfo.XPCOMABI.match(/x86_64-/));