Bug 723970 Backout Bug 698187 due to mozilla-central back out of parts of bug 698986 to resolve bug 716945 r=Neil a=Callek.
authorPhilip Chee <philip.chee@gmail.com>
Sat, 04 Feb 2012 00:15:37 +0800
changeset 10168 9f3e1bfd37aa65ed30fba232175b3e9f5f1c5a06
parent 10167 227876aaf64da489d9eac67906d384a277536a2b
child 10169 e5f48721a62908856f2bb566ff441a06d6bae33f
push idunknown
push userunknown
push dateunknown
reviewersNeil, Callek
bugs723970, 698187, 698986, 716945
Bug 723970 Backout Bug 698187 due to mozilla-central back out of parts of bug 698986 to resolve bug 716945 r=Neil a=Callek.
suite/common/bindings/notification.xml
--- a/suite/common/bindings/notification.xml
+++ b/suite/common/bindings/notification.xml
@@ -520,32 +520,16 @@
                                           callbackArgs = [ aEvent ];
                                         callback.apply(this, callbackArgs);
                                       }.bind(this),
                                       true);
                   ]]>
         </body>
       </method>
 
-      <!-- When user clicks try, check if the crash report should be sent in the background -->
-      <method name="retryPluginPage">
-        <parameter name="status"/>
-        <parameter name="submitChk"/>
-        <parameter name="pluginDumpID"/>
-        <parameter name="browserDumpID"/>
-        <body>
-          <![CDATA[
-            // Check status to make sure we haven't submitted already.
-            if (status == "please" && submitChk.checked)
-              this.submitReport(pluginDumpID, browserDumpID);
-            this.reloadPage();
-          ]]>
-        </body>
-      </method>
-
       <!-- Callback for user clicking "submit a report" link -->
       <method name="submitReport">
         <parameter name="pluginDumpID"/>
         <parameter name="browserDumpID"/>
         <body>
           <![CDATA[
             this.CrashSubmit.submit(pluginDumpID);
             if (browserDumpID)
@@ -1502,18 +1486,18 @@
           // that the target is a plugin
           if (!(plugin instanceof Components.interfaces.nsIObjectLoadingContent))
             return;
 
           if (!(event instanceof Components.interfaces.nsIDOMDataContainerEvent))
             return;
 
           var submittedReport = event.getData("submittedCrashReport");
-          var doPrompt        = true; // XXX followup to get via gCrashReporter;
-          var submitReports   = false;
+          var doPrompt        = true; // XXX followup for .getData("doPrompt");
+          var submitReports   = true; // XXX followup for .getData("submitReports");
           var pluginName      = event.getData("pluginName");
           var pluginFilename  = event.getData("pluginFilename");
           var pluginDumpID    = event.getData("pluginDumpID");
           var browserDumpID   = event.getData("browserDumpID");
 
           // Remap the plugin name to a more user-presentable form.
           pluginName = this.makeNicePluginName(pluginName, pluginFilename);
 
@@ -1521,42 +1505,37 @@
           plugin.clientTop;
 
           // Configure the crashed-plugin placeholder.
           var doc = plugin.ownerDocument;
           var overlay = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox");
 
           var status;
           var statusDiv = doc.getAnonymousElementByAttribute(plugin, "class", "submitStatus");
-          var submitChk = doc.getAnonymousElementByAttribute(plugin, "class", "pleaseSubmitCheckbox");
-          var cr = Components.classes["@mozilla.org/toolkit/crash-reporter;1"]
-                             .getService(Components.interfaces.nsICrashReporter);
 
           if (this.CrashSubmit) {
-            submitReports = cr.submitReports;
             // 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 the gCrashReporter submitReports preference.
-              submitChk.checked = submitReports;
-              submitChk.addEventListener("click", function() {
-                cr.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, this.submitReport,
+                                        pluginDumpID, browserDumpID);
             }
 
-            // 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 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;
@@ -1564,42 +1543,28 @@
                   if (propertyBag.get("minidumpID") != pluginDumpID)
                     return;
                   statusDiv.setAttribute("status", data);
                 },
 
                 handleEvent : function(event) {
                   // Not expected to be called, just here for the closure.
                 }
-              };
-
-              let submitReportsPrefObserver = {
-                QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIObserver,
-                                                       Components.interfaces.nsISupportsWeakReference]),
-                observe: function(subject, topic, data) {
-                  submitChk.checked = cr.submitReports;
-                },
-
-                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...
-              var os = Components.classes["@mozilla.org/observer-service;1"]
-                                 .getService(Components.interfaces.nsIObserverService);
-              os.addObserver(observer, "crash-report-status", true);
-              os.addObserver(submitReportsPrefObserver, "submit-reports-pref-changed", true);
+              Components.classes["@mozilla.org/observer-service;1"]
+                        .getService(Components.interfaces.nsIObserverService)
+                        .addObserver(observer, "crash-report-status", 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 statusDiv.
               // When it goes away, so do the listener references and the closure.
               statusDiv.addEventListener("mozCleverClosureHack", observer, false);
-              submitChk.addEventListener("mozCleverClosureHack", submitReportsPrefObserver, false);
             }
           }
 
           // 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";
           }
@@ -1611,20 +1576,17 @@
           var helpIcon = doc.getAnonymousElementByAttribute(plugin, "class", "helpIcon");
           this.addLinkClickCallback(helpIcon, this.openHelpPage);
 
           var messageString = this._stringBundle.formatStringFromName("crashedpluginsMessage.title", [pluginName], 1);
           var crashText = doc.getAnonymousElementByAttribute(plugin, "class", "msg msgCrashed");
           crashText.textContent = messageString;
 
           var link = doc.getAnonymousElementByAttribute(plugin, "class", "reloadLink");
-          if (this.CrashSubmit)
-            this.addLinkClickCallback(link, this.retryPluginPage, status, submitChk, pluginDumpID, browserDumpID);
-          else
-            this.addLinkClickCallback(link, this.reloadPage);
+          this.addLinkClickCallback(link, this.reloadPage);
 
           // 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";
             // If another plugin on the page was large enough to show our UI, we
             // don't want to show a notification bar.