diff --git a/browser/base/content/aboutTabCrashed.css b/browser/base/content/aboutTabCrashed.css index 4122506da9d6..de0eabe8bdd3 100644 --- a/browser/base/content/aboutTabCrashed.css +++ b/browser/base/content/aboutTabCrashed.css @@ -3,6 +3,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ html:not(.crashDumpSubmitted) #reportSent, -html:not(.crashDumpAvailable) #report-box { +html:not(.crashDumpAvailable) #reportBox, +.container[multiple="true"] > .offers > #offerHelpMessageSingle, +.container[multiple="false"] > .offers > #offerHelpMessageMultiple, +.container[multiple="false"] > .button-container > #restoreAll { display: none; -} +} \ No newline at end of file diff --git a/browser/base/content/aboutTabCrashed.js b/browser/base/content/aboutTabCrashed.js index c8d3166e288e..61398e73a3d2 100644 --- a/browser/base/content/aboutTabCrashed.js +++ b/browser/base/content/aboutTabCrashed.js @@ -62,7 +62,7 @@ var AboutTabCrashed = { receiveMessage(message) { switch (message.name) { case "UpdateCount": { - this.showRestoreAll(message.data.count > 1); + this.setMultiple(message.data.count > 1); break; } case "SetCrashReportAvailable": { @@ -151,11 +151,11 @@ var AboutTabCrashed = { * Object property with the following properties: * * hasReport (bool): - * Whether or not there is a crash report + * Whether or not there is a crash report. * * sendReport (bool): * Whether or not the the user prefers to send the report - * by default + * by default. * * includeURL (bool): * Whether or not the user prefers to send the URL of @@ -166,15 +166,20 @@ var AboutTabCrashed = { * in the report. * * email (String): - * The email address of the user (empty if emailMe is false) + * The email address of the user (empty if emailMe is false). + * + * requestAutoSubmit (bool): + * Whether or not we should ask the user to automatically + * submit backlogged crash reports. * */ onSetCrashReportAvailable(message) { - if (message.data.hasReport) { + let data = message.data; + + if (data.hasReport) { this.hasReport = true; document.documentElement.classList.add("crashDumpAvailable"); - let data = message.data; document.getElementById("sendReport").checked = data.sendReport; document.getElementById("includeURL").checked = data.includeURL; document.getElementById("emailMe").checked = data.emailMe; @@ -183,6 +188,12 @@ var AboutTabCrashed = { } this.showCrashReportUI(data.sendReport); + } else { + this.showCrashReportUI(false); + } + + if (data.requestAutoSubmit) { + document.getElementById("requestAutoSubmit").hidden = false; } let event = new CustomEvent("AboutTabCrashedReady", {bubbles:true}); @@ -205,24 +216,29 @@ var AboutTabCrashed = { * True if the crash report form should be shown */ showCrashReportUI(shouldShow) { - let container = document.getElementById("crash-reporter-container"); - container.hidden = !shouldShow; + let options = document.getElementById("options"); + options.hidden = !shouldShow; }, /** - * Toggles the display of the "Restore All" button. + * Toggles whether or not the page is one of several visible pages + * showing the crash reporter. This controls some of the language + * on the page, along with what the "primary" button is. * - * @param shouldShow (bool) - * True if the "Restore All" button should be shown + * @param hasMultiple (bool) + * True if there are multiple crash report pages being shown. */ - showRestoreAll(shouldShow) { - let restoreAll = document.getElementById("restoreAll"); + setMultiple(hasMultiple) { + let main = document.getElementById("main"); + main.setAttribute("multiple", hasMultiple); + let restoreTab = document.getElementById("restoreTab"); - if (shouldShow) { - restoreAll.removeAttribute("hidden"); + + // The "Restore All" button has the "primary" class by default, so + // we only need to modify the "Restore Tab" button. + if (hasMultiple) { restoreTab.classList.remove("primary"); } else { - restoreAll.setAttribute("hidden", true); restoreTab.classList.add("primary"); } }, @@ -243,6 +259,7 @@ var AboutTabCrashed = { let sendReport = false; let emailMe = false; let includeURL = false; + let autoSubmit = false; if (this.hasReport) { sendReport = document.getElementById("sendReport").checked; @@ -261,6 +278,15 @@ var AboutTabCrashed = { } } + let requestAutoSubmit = document.getElementById("requestAutoSubmit"); + if (requestAutoSubmit.hidden) { + // The checkbox is hidden if the user has already opted in to sending + // backlogged crash reports. + autoSubmit = true; + } else { + autoSubmit = document.getElementById("autoSubmit").checked; + } + sendAsyncMessage(messageName, { sendReport, comments, @@ -268,6 +294,7 @@ var AboutTabCrashed = { emailMe, includeURL, URL, + autoSubmit, }); }, }; diff --git a/browser/base/content/aboutTabCrashed.xhtml b/browser/base/content/aboutTabCrashed.xhtml index 69679c4b3f33..7761f0fd04c2 100644 --- a/browser/base/content/aboutTabCrashed.xhtml +++ b/browser/base/content/aboutTabCrashed.xhtml @@ -30,28 +30,54 @@ -
+
+
-

&tabCrashed.header;

+

&tabCrashed.header2;

-

&tabCrashed.message;

-
- - - @@ -60,7 +86,7 @@
- diff --git a/browser/base/content/test/general/browser_aboutTabCrashed_showForm.js b/browser/base/content/test/general/browser_aboutTabCrashed_showForm.js index 0f49a2775e35..f84a48709778 100644 --- a/browser/base/content/test/general/browser_aboutTabCrashed_showForm.js +++ b/browser/base/content/test/general/browser_aboutTabCrashed_showForm.js @@ -31,8 +31,8 @@ add_task(function* test_show_form() { let checkbox = doc.getElementById("sendReport"); ok(checkbox.checked, "Send report checkbox is checked."); - // Ensure the form is displayed. - let container = doc.getElementById("crash-reporter-container"); - ok(!container.hidden, "Showing the crash report detail form."); + // Ensure the options form is displayed. + let options = doc.getElementById("options"); + ok(!options.hidden, "Showing the crash report options form."); }); }); diff --git a/browser/base/content/test/general/browser_aboutTabCrashed_withoutDump.js b/browser/base/content/test/general/browser_aboutTabCrashed_withoutDump.js index 2db143e1bf57..d63baa5457a8 100644 --- a/browser/base/content/test/general/browser_aboutTabCrashed_withoutDump.js +++ b/browser/base/content/test/general/browser_aboutTabCrashed_withoutDump.js @@ -32,9 +32,9 @@ add_task(function* test_without_dump() { Assert.ok(!doc.documentElement.classList.contains("crashDumpAvailable"), "doesn't have crash dump"); - let container = doc.getElementById("crash-reporter-container"); - Assert.ok(container, "has crash-reporter-container"); - Assert.ok(container.hidden, "crash-reporter-container is hidden"); + let options = doc.getElementById("options"); + Assert.ok(options, "has crash report options"); + Assert.ok(options.hidden, "crash report options are hidden"); doc.getElementById("closeTab").click(); }); diff --git a/browser/components/sessionstore/test/browser_crashedTabs.js b/browser/components/sessionstore/test/browser_crashedTabs.js index ff20c562445b..5841d536a6b7 100644 --- a/browser/components/sessionstore/test/browser_crashedTabs.js +++ b/browser/components/sessionstore/test/browser_crashedTabs.js @@ -392,7 +392,8 @@ add_task(function* test_hide_restore_all_button() { let restoreAllButton = doc.getElementById("restoreAll"); let restoreOneButton = doc.getElementById("restoreTab"); - is(restoreAllButton.getAttribute("hidden"), "true", "Restore All button should be hidden"); + let restoreAllStyles = window.getComputedStyle(restoreAllButton); + is(restoreAllStyles.display, "none", "Restore All button should be hidden"); ok(restoreOneButton.classList.contains("primary"), "Restore Tab button should have the primary class"); let newTab2 = gBrowser.addTab(); @@ -421,7 +422,8 @@ add_task(function* test_hide_restore_all_button() { restoreAllButton = doc.getElementById("restoreAll"); restoreOneButton = doc.getElementById("restoreTab"); - ok(!restoreAllButton.hasAttribute("hidden"), "Restore All button should not be hidden"); + restoreAllStyles = window.getComputedStyle(restoreAllButton); + isnot(restoreAllStyles.display, "none", "Restore All button should not be hidden"); ok(!(restoreOneButton.classList.contains("primary")), "Restore Tab button should not have the primary class"); yield BrowserTestUtils.closeWindow(win2); diff --git a/browser/locales/en-US/chrome/browser/aboutTabCrashed.dtd b/browser/locales/en-US/chrome/browser/aboutTabCrashed.dtd index eac62d7211f9..d962af8e790b 100644 --- a/browser/locales/en-US/chrome/browser/aboutTabCrashed.dtd +++ b/browser/locales/en-US/chrome/browser/aboutTabCrashed.dtd @@ -2,15 +2,29 @@ - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - - - - - - - - - + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/browser/modules/ContentCrashHandlers.jsm b/browser/modules/ContentCrashHandlers.jsm index f6970860d117..cb6d20886940 100644 --- a/browser/modules/ContentCrashHandlers.jsm +++ b/browser/modules/ContentCrashHandlers.jsm @@ -335,6 +335,12 @@ this.TabCrashHandler = { let browser = message.target.browser; + if (message.data.autoSubmit) { + // The user has opted in to autosubmitted backlogged + // crash reports in the future. + UnsubmittedCrashHandler.autoSubmit = true; + } + let childID = this.browserMap.get(browser.permanentKey); let dumpID = this.childMap.get(childID); if (!dumpID) @@ -449,11 +455,19 @@ this.TabCrashHandler = { return; } + let requestAutoSubmit = !UnsubmittedCrashHandler.autoSubmit; let sendReport = this.prefs.getBoolPref("sendReport"); let includeURL = this.prefs.getBoolPref("includeURL"); let emailMe = this.prefs.getBoolPref("emailMe"); - let data = { hasReport: true, sendReport, includeURL, emailMe }; + let data = { + hasReport: true, + sendReport, + includeURL, + emailMe, + requestAutoSubmit, + }; + if (emailMe) { data.email = this.prefs.getCharPref("email", ""); } diff --git a/browser/themes/shared/aboutTabCrashed.css b/browser/themes/shared/aboutTabCrashed.css index e42922ac95d6..33ca7fa3eb38 100644 --- a/browser/themes/shared/aboutTabCrashed.css +++ b/browser/themes/shared/aboutTabCrashed.css @@ -2,16 +2,35 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +body { + font-size: 1.25rem; +} + .title { background-image: url("chrome://browser/skin/tab-crashed.svg"); } +.title > h1, +.offers { + margin-left: 14px; +} + +.title > h1 { + /** + * Add commentary? + */ + padding-right: 14px; +} + +.container { + width: 45%; +} + #reportSent { font-weight: bold; } -#crash-reporter-container { - width: 80%; +#reportBox { background-color: var(--in-content-box-background-hover); margin: 24px 0; padding: 14px; @@ -19,6 +38,10 @@ border-radius: 2px; } +#reportBox > h2:first-child { + margin-top: 0; +} + #crash-reporter-title { font-weight: bold; margin: 0 0 14px 0; @@ -31,12 +54,26 @@ textarea { resize: none; } +input[type="text"], +input[type="checkbox"] { + -moz-margin-start: 0px; +} + #options { list-style: none; margin-inline-start: 0; } -input[type="text"], -#options > li { - margin: 14px 0 0 0; +#options > li, +#email { + margin-top: 14px; } + +.checkbox-with-label { + display: flex; +} + +.checkbox-with-label > label { + margin-top: auto; + margin-bottom: auto; +} \ No newline at end of file diff --git a/toolkit/themes/shared/in-content/common.inc.css b/toolkit/themes/shared/in-content/common.inc.css index cf1e6a40e2a2..ea2e1e1020d5 100644 --- a/toolkit/themes/shared/in-content/common.inc.css +++ b/toolkit/themes/shared/in-content/common.inc.css @@ -74,11 +74,16 @@ xul|caption { margin: 0; } +html|h2, xul|caption > xul|checkbox, xul|caption > xul|label { font-size: 1.3rem; font-weight: bold; line-height: 22px; +} + +xul|caption > xul|checkbox, +xul|caption > xul|label { margin: 0 !important; } @@ -502,31 +507,12 @@ html|a:hover:active, /* Checkboxes and radio buttons */ -/* Hide the actual checkbox */ -html|input[type="checkbox"] { - opacity: 0; - width: 0; - pointer-events: none; - position: absolute; -} - -/* Create a box to style as the checkbox */ -html|input[type="checkbox"] + html|label:before { - display: inline-block; - content: ""; - vertical-align: middle; -} - -html|input[type="checkbox"] + html|label { - line-height: 0px; -} - xul|checkbox { margin-inline-start: 0; } xul|*.checkbox-check, -html|input[type="checkbox"] + html|label:before { +html|input[type="checkbox"] { -moz-appearance: none; width: 23px; height: 23px; @@ -542,7 +528,7 @@ html|input[type="checkbox"] + html|label:before { } xul|checkbox:not([disabled="true"]):hover > xul|*.checkbox-check, -html|input[type="checkbox"]:not(:disabled) + html|label:hover:before { +html|input[type="checkbox"]:not(:disabled):hover { border-color: var(--in-content-border-focus); } @@ -550,12 +536,12 @@ xul|*.checkbox-check[checked] { list-style-image: url("chrome://global/skin/in-content/check.svg#check"); } -html|input[type="checkbox"]:checked + html|label:before { +html|input[type="checkbox"]:checked { background-image: url("chrome://global/skin/in-content/check.svg#check"), linear-gradient(#fff, rgba(255,255,255,0.8)) !important; } xul|checkbox[disabled="true"] > xul|*.checkbox-check, -html|input[type="checkbox"]:disabled + html|label { +html|input[type="checkbox"]:disabled { opacity: 0.5; }