Bug 557661 - change OOPP crash UI to make it easier to submit crash reports. r=gavin, ui-r=beltzner
authorJustin Dolske <dolske>
Wed, 07 Apr 2010 18:53:00 -0700
changeset 40580 79085c74758983c62b7e9373b99936b6c8c69f39
parent 40579 f5dcc84e887c9ec91972a0ba32c7c6a78f91d8a8
child 40581 6f250c9b680ba60704cfbd5e939b2e9c8e20c05c
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgavin, beltzner
bugs557661
milestone1.9.3a5pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
Bug 557661 - change OOPP crash UI to make it easier to submit crash reports. r=gavin, ui-r=beltzner
browser/base/content/browser.js
toolkit/mozapps/plugins/content/pluginProblem.xml
toolkit/mozapps/plugins/content/pluginProblemContent.css
toolkit/themes/pinstripe/mozapps/plugins/pluginProblem.css
toolkit/themes/winstripe/mozapps/plugins/pluginProblem.css
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -6201,42 +6201,43 @@ var gMissingPluginInstaller = {
     let doc = plugin.ownerDocument;
     let overlay = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox");
 
     // The binding has role="link" here, since missing/disabled/blocked
     // plugin UI has a onclick handler on the whole thing. This isn't needed
     // for the plugin-crashed UI, because we use actual HTML links in the text.
     overlay.removeAttribute("role");
 
+    let statusDiv = doc.getAnonymousElementByAttribute(plugin, "class", "submitStatus");
 #ifdef MOZ_CRASHREPORTER
+    let status;
+
     // Determine which message to show regarding crash reports.
-    let helpClass, showClass;
     if (submittedReport) { // submitReports && !doPrompt, handled in observer
-      showClass = "msg msgSubmitted";
+      status = "submitted";
     }
     else if (!submitReports && !doPrompt) {
-      showClass = "msg msgNotSubmitted";
+      status = "noSubmit";
     }
     else { // doPrompt
-      showClass = "msg msgPleaseSubmit";
+      status = "please";
       // XXX can we make the link target actually be blank?
       let pleaseLink = doc.getAnonymousElementByAttribute(
                             plugin, "class", "pleaseSubmitLink");
       self.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) {
-        showClass = "msg msgNoCrashReport";
-    }
-
-    let textToShow = doc.getAnonymousElementByAttribute(plugin, "class", showClass);
-    textToShow.style.display = "block";
+        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");
     self.addLinkClickCallback(helpIcon, "openHelpPage");
 
     // 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
@@ -6247,17 +6248,17 @@ var gMissingPluginInstaller = {
                                                Ci.nsISupportsWeakReference]),
         observe : function(subject, topic, data) {
           let propertyBag = subject;
           if (!(propertyBag instanceof Ci.nsIPropertyBag2))
             return;
           // Ignore notifications for other crashes.
           if (propertyBag.get("minidumpID") != pluginDumpID)
             return;
-          self.updateSubmissionStatus(plugin, propertyBag, data);
+          statusDiv.setAttribute("status", data);
         },
 
         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...
@@ -6350,42 +6351,16 @@ var gMissingPluginInstaller = {
       link.setAttribute("value", gNavigatorBundle.getString("crashedpluginsMessage.learnMore"));
       link.href = gMissingPluginInstaller.crashReportHelpURL;
       let description = notification.ownerDocument.getAnonymousElementByAttribute(notification, "anonid", "messageText");
       description.appendChild(link);
     }
 
   },
 
-  updateSubmissionStatus : function (plugin, propBag, status) {
-    let doc = plugin.ownerDocument;
-
-    // One of these two may already be visible, reset them to be hidden.
-    let pleaseText     = doc.getAnonymousElementByAttribute(plugin, "class", "msg msgPleaseSubmit");
-    let submittingText = doc.getAnonymousElementByAttribute(plugin, "class", "msg msgSubmitting");
-    pleaseText.style.display = "";
-    submittingText.style.display = "";
-
-    let msgClass;
-    switch (status) {
-      case "submitting":
-        msgClass = "msg msgSubmitting";
-        break;
-      case "success":
-        msgClass = "msg msgSubmitted";
-        break;
-      case "failed":
-        msgClass = "msg msgSubmitFailed";
-        break;
-    }
-
-    let textToShow = doc.getAnonymousElementByAttribute(plugin, "class", msgClass);
-    textToShow.style.display = "block";
-  },
-
   refreshBrowser: function (aEvent) {
     // browser elements are anonymous so we can't just use target.
     var browser = aEvent.originalTarget;
     var notificationBox = gBrowser.getNotificationBox(browser);
     var notification = notificationBox.getNotificationWithValue("missing-plugins");
 
     // clear the plugin list, now that at least one plugin has been installed
     browser.missingPlugins = null;
--- a/toolkit/mozapps/plugins/content/pluginProblem.xml
+++ b/toolkit/mozapps/plugins/content/pluginProblem.xml
@@ -56,26 +56,28 @@
     <content>
         <xul:vbox class="mainBox" role="link" flex="1" chromedir="&locale.dir;">
             <xul:spacer flex="1"/>
             <xul:box class="icon"/>
             <html:div class="msg msgUnsupported">&missingPlugin.label;</html:div>
             <html:div class="msg msgDisabled">&disabledPlugin.label;</html:div>
             <html:div class="msg msgBlocked">&blockedPlugin.label;</html:div>
             <html:div class="msg msgCrashed"><!-- set at runtime --></html:div>
-            <html:div class="msg msgReload">&reloadPlugin.pre;<html:a class="reloadLink" href="">&reloadPlugin.middle;</html:a>&reloadPlugin.post;</html:div>
-            <xul:spacer flex="1"/>
-            <html:div class="msg msgBottomLinks">
+            <html:div class="submitStatus">
                 <!-- link href set at runtime -->
                 <html:div class="msg msgPleaseSubmit"><html:a class="pleaseSubmitLink" href="">&report.please;</html:a></html:div>
                 <html:div class="msg msgSubmitting">&report.submitting;<html:span class="throbber"> </html:span></html:div>
                 <html:div class="msg msgSubmitted">&report.submitted;</html:div>
                 <html:div class="msg msgNotSubmitted">&report.disabled;</html:div>
                 <html:div class="msg msgSubmitFailed">&report.failed;</html:div>
                 <html:div class="msg msgNoCrashReport">&report.unavailable;</html:div>
                 <!-- link href set at runtime -->
+                <html:div class="msg msgReload">&reloadPlugin.pre;<html:a class="reloadLink" href="">&reloadPlugin.middle;</html:a>&reloadPlugin.post;</html:div>
+            </html:div>
+            <xul:spacer flex="1"/>
+            <html:div class="msg msgBottomLinks">
                 <html:span class="helpIcon" role="link"/>
             </html:div>
         </xul:vbox>
         <html:div style="display:none;"><children/></html:div>
     </content>
 </binding>
 </bindings>
--- a/toolkit/mozapps/plugins/content/pluginProblemContent.css
+++ b/toolkit/mozapps/plugins/content/pluginProblemContent.css
@@ -35,21 +35,35 @@ html|applet:not([height]), html|applet[h
 
 .msg {
   display: none;
 }
 
 :-moz-type-unsupported .msgUnsupported,
 :-moz-handler-disabled .msgDisabled,
 :-moz-handler-blocked .msgBlocked,
-:-moz-handler-crashed .msgCrashed,
-:-moz-handler-crashed .msgReload {
+:-moz-handler-crashed .msgCrashed {
   display: block;
 }
 
+.submitStatus[status="noReport"]   .msgNoCrashReport,
+.submitStatus[status="please"]     .msgPleaseSubmit,
+.submitStatus[status="noSubmit"]   .msgNotSubmitted,
+.submitStatus[status="submitting"] .msgSubmitting,
+.submitStatus[status="success"]    .msgSubmitted,
+.submitStatus[status="failed"]     .msgSubmitFailed,
+.submitStatus[status]:not([status="please"]) .msgReload {
+  display: block;
+}
+.submitStatus[status="please"] .msgReload {
+  /* Take up space when invisible, so stuff doesn't shift upon reveal. */
+  display: block;
+  visibility: hidden;
+}
+
 .helpIcon {
   cursor: pointer;
 }
 
 .mainBox[chromedir="rtl"] {
   direction: rtl;
   unicode-bidi: embed;
 }
--- a/toolkit/themes/pinstripe/mozapps/plugins/pluginProblem.css
+++ b/toolkit/themes/pinstripe/mozapps/plugins/pluginProblem.css
@@ -49,27 +49,24 @@ html|a {
 
 .msg {
     font: message-box;
     font-size: 12px;
     cursor: default;
     text-shadow: rgba(0,0,0,0.8) 0 0 5px;
 }
 
+.submitStatus div {
+    min-height: 19px; /* height of biggest line (with throbber) */
+}
+
 .msgBottomLinks {
     padding-left: 2px;
     padding-right: 2px;
 }
 
-.msgBottomLinks div {
-    text-align: right;
-    margin-right: 4px;
-    margin-bottom: -19px;
-    min-height: 19px; /* height of biggest line (with throbber) */
-}
-
 .helpIcon {
     float: left;
     display: inline-block;
     min-width: 16px;
     min-height: 16px;
     background: url(chrome://mozapps/skin/plugins/pluginHelp-16.png) no-repeat;
 }
--- a/toolkit/themes/winstripe/mozapps/plugins/pluginProblem.css
+++ b/toolkit/themes/winstripe/mozapps/plugins/pluginProblem.css
@@ -49,27 +49,24 @@ html|a {
 
 .msg {
     font: message-box;
     font-size: 12px;
     cursor: default;
     text-shadow: rgba(0,0,0,0.8) 0 0 5px;
 }
 
+.submitStatus div {
+    min-height: 19px; /* height of biggest line (with throbber) */
+}
+
 .msgBottomLinks {
     padding-left: 2px;
     padding-right: 2px;
 }
 
-.msgBottomLinks div {
-    text-align: right;
-    margin-right: 4px;
-    margin-bottom: -19px;
-    min-height: 19px; /* height of biggest line (with throbber) */
-}
-
 .helpIcon {
     float: left;
     display: inline-block;
     min-width: 16px;
     min-height: 16px;
     background: url(chrome://mozapps/skin/plugins/pluginHelp-16.png) no-repeat;
 }