Bug 665196 - Change in-content plugin crash UI to submit a crash report and reload the page in one step. r=dolske

This commit is contained in:
Felix Fung 2011-09-23 22:28:56 -07:00
parent cfce00b5ab
commit 5769dd7ef1
4 changed files with 39 additions and 24 deletions

View File

@ -6825,10 +6825,25 @@ var gPluginHandler = {
BrowserOpenAddonsMgr("addons://list/plugin");
},
// 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.
// 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) {
this.CrashSubmit.submit(pluginDumpID);
if (browserDumpID)
this.CrashSubmit.submit(browserDumpID);
@ -7075,18 +7090,16 @@ var gPluginHandler = {
status = "noSubmit";
}
else { // doPrompt
let submitChk = doc.getAnonymousElementByAttribute(
plugin, "class", "pleaseSubmitCheckbox");
submitChk.checked = submitReports;
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);
@ -7123,7 +7136,7 @@ var gPluginHandler = {
// ...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 closue with an event listener on the document.
// Clever solution? Use a closure 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);
}
@ -7135,7 +7148,12 @@ 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);

View File

@ -34,8 +34,8 @@
<!ENTITY reloadPlugin.pre "">
<!ENTITY reloadPlugin.middle "Reload the page">
<!ENTITY reloadPlugin.post " to try again.">
<!-- LOCALIZATION NOTE (report.please): This and the other report.* strings should be as short as possible, ideally 2-3 words. -->
<!ENTITY report.please "Send crash report">
<!-- LOCALIZATION NOTE: report.* strings should be as short as possible, ideally 2-3 words. -->
<!ENTITY report.checkbox "…and send crash report">
<!ENTITY report.submitting "Sending report…">
<!ENTITY report.submitted "Crash report sent.">
<!ENTITY report.disabled "Crash reporting disabled.">

View File

@ -68,15 +68,17 @@
</html:div>
<html:div class="msg msgManagePlugins"><html:a class="managePluginsLink" href="">&managePlugins;</html:a></html:div>
<html:div class="submitStatus">
<!-- links set at runtime -->
<html:div class="msg msgPleaseSubmit"><html:a class="pleaseSubmitLink" href="">&report.please;</html:a></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 class="msg msgSubmitPlease">
<html:input id="pleaseSubmitCheckbox" type="checkbox" class="pleaseSubmitCheckbox" />
<html:label for="pleaseSubmitCheckbox">&report.checkbox;</html:label>
</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">

View File

@ -55,19 +55,14 @@ 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]:not([status="please"]) .msgReload {
.submitStatus[status="please"] .msgSubmitPlease,
.submitStatus .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;