From 4df939518006469e85ae348e9c118225082db622 Mon Sep 17 00:00:00 2001 From: Gavin Sharp Date: Mon, 30 Jan 2012 15:37:59 -0800 Subject: [PATCH] Back out parts of bug 698986 to resolve bug 716945 --- browser/base/content/browser.js | 75 +++++-------------- .../en-US/chrome/mozapps/plugins/plugins.dtd | 4 +- .../mozapps/plugins/content/pluginProblem.xml | 10 +-- .../plugins/content/pluginProblemContent.css | 11 ++- 4 files changed, 31 insertions(+), 69 deletions(-) diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 5e3262e207f..a9484bdd361 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -7150,25 +7150,10 @@ var gPluginHandler = { BrowserOpenAddonsMgr("addons://list/plugin"); }, - // 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); - }, - - submitReport: function (pluginDumpID, browserDumpID) { + // Callback for user clicking "submit a report" link + submitReport : function(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 gBrowser. this.CrashSubmit.submit(pluginDumpID); if (browserDumpID) this.CrashSubmit.submit(browserDumpID); @@ -7386,7 +7371,8 @@ var gPluginHandler = { return; let submittedReport = aEvent.getData("submittedCrashReport"); - let doPrompt = true; // XXX followup to 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"); @@ -7404,7 +7390,6 @@ var gPluginHandler = { 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. @@ -7415,21 +7400,18 @@ var gPluginHandler = { 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"; + status = "noReport"; } statusDiv.setAttribute("status", status); @@ -7439,23 +7421,10 @@ var gPluginHandler = { let helpIcon = doc.getAnonymousElementByAttribute(plugin, "class", "helpIcon"); this.addLinkClickCallback(helpIcon, "openHelpPage"); - // 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([Ci.nsIObserver, Ci.nsISupportsWeakReference]), @@ -7472,21 +7441,16 @@ 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 @@ -7496,12 +7460,7 @@ var gPluginHandler = { let browser = gBrowser.getBrowserForDocument(doc.defaultView.top.document); 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 = gBrowser.getNotificationBox(browser); diff --git a/toolkit/locales/en-US/chrome/mozapps/plugins/plugins.dtd b/toolkit/locales/en-US/chrome/mozapps/plugins/plugins.dtd index 6382171db05..8673940c5f2 100644 --- a/toolkit/locales/en-US/chrome/mozapps/plugins/plugins.dtd +++ b/toolkit/locales/en-US/chrome/mozapps/plugins/plugins.dtd @@ -34,8 +34,8 @@ - - + + diff --git a/toolkit/mozapps/plugins/content/pluginProblem.xml b/toolkit/mozapps/plugins/content/pluginProblem.xml index 22b8d8d3597..b1b04ec381c 100644 --- a/toolkit/mozapps/plugins/content/pluginProblem.xml +++ b/toolkit/mozapps/plugins/content/pluginProblem.xml @@ -68,17 +68,15 @@ &managePlugins; - - &reloadPlugin.pre;&reloadPlugin.middle;&reloadPlugin.post; - - - &report.checkbox; - + + &report.please; &report.submitting; &report.submitted; &report.disabled; &report.failed; &report.unavailable; + + &reloadPlugin.pre;&reloadPlugin.middle;&reloadPlugin.post; diff --git a/toolkit/mozapps/plugins/content/pluginProblemContent.css b/toolkit/mozapps/plugins/content/pluginProblemContent.css index 8f1fad30b53..3039718671e 100644 --- a/toolkit/mozapps/plugins/content/pluginProblemContent.css +++ b/toolkit/mozapps/plugins/content/pluginProblemContent.css @@ -46,8 +46,7 @@ html|applet:not([height]), html|applet[height=""] { :-moz-handler-disabled .msgDisabled, :-moz-handler-disabled .msgManagePlugins, :-moz-handler-blocked .msgBlocked, -:-moz-handler-crashed .msgCrashed, -:-moz-handler-crashed .msgReload { +:-moz-handler-crashed .msgCrashed { display: block; } @@ -56,13 +55,19 @@ html|applet:not([height]), html|applet[height=""] { } .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="please"] .msgSubmitPlease { +.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;