diff options
Diffstat (limited to 'toolkit/content/aboutSupport.js')
-rw-r--r-- | toolkit/content/aboutSupport.js | 119 |
1 files changed, 30 insertions, 89 deletions
diff --git a/toolkit/content/aboutSupport.js b/toolkit/content/aboutSupport.js index 5daf6d189..e9087dfcb 100644 --- a/toolkit/content/aboutSupport.js +++ b/toolkit/content/aboutSupport.js @@ -75,69 +75,7 @@ var snapshotFormatters = { }, crashes: function crashes(data) { - if (!AppConstants.MOZ_CRASHREPORTER) - return; - - let strings = stringBundle(); - let daysRange = Troubleshoot.kMaxCrashAge / (24 * 60 * 60 * 1000); - $("crashes-title").textContent = - PluralForm.get(daysRange, strings.GetStringFromName("crashesTitle")) - .replace("#1", daysRange); - let reportURL; - try { - reportURL = Services.prefs.getCharPref("breakpad.reportURL"); - // Ignore any non http/https urls - if (!/^https?:/i.test(reportURL)) - reportURL = null; - } - catch (e) { } - if (!reportURL) { - $("crashes-noConfig").style.display = "block"; - $("crashes-noConfig").classList.remove("no-copy"); - return; - } - $("crashes-allReports").style.display = "block"; - $("crashes-allReports").classList.remove("no-copy"); - - if (data.pending > 0) { - $("crashes-allReportsWithPending").textContent = - PluralForm.get(data.pending, strings.GetStringFromName("pendingReports")) - .replace("#1", data.pending); - } - - let dateNow = new Date(); - $.append($("crashes-tbody"), data.submitted.map(function (crash) { - let date = new Date(crash.date); - let timePassed = dateNow - date; - let formattedDate; - if (timePassed >= 24 * 60 * 60 * 1000) - { - let daysPassed = Math.round(timePassed / (24 * 60 * 60 * 1000)); - let daysPassedString = strings.GetStringFromName("crashesTimeDays"); - formattedDate = PluralForm.get(daysPassed, daysPassedString) - .replace("#1", daysPassed); - } - else if (timePassed >= 60 * 60 * 1000) - { - let hoursPassed = Math.round(timePassed / (60 * 60 * 1000)); - let hoursPassedString = strings.GetStringFromName("crashesTimeHours"); - formattedDate = PluralForm.get(hoursPassed, hoursPassedString) - .replace("#1", hoursPassed); - } - else - { - let minutesPassed = Math.max(Math.round(timePassed / (60 * 1000)), 1); - let minutesPassedString = strings.GetStringFromName("crashesTimeMinutes"); - formattedDate = PluralForm.get(minutesPassed, minutesPassedString) - .replace("#1", minutesPassed); - } - return $.new("tr", [ - $.new("td", [ - $.new("a", crash.id, null, {href : reportURL + crash.id}) - ]), - $.new("td", formattedDate) - ]); - })); + return; }, extensions: function extensions(data) { @@ -151,22 +89,6 @@ var snapshotFormatters = { })); }, - experiments: function experiments(data) { - $.append($("experiments-tbody"), data.map(function (experiment) { - return $.new("tr", [ - $.new("td", experiment.name), - $.new("td", experiment.id), - $.new("td", experiment.description), - $.new("td", experiment.active), - $.new("td", experiment.endDate), - $.new("td", [ - $.new("a", experiment.detailURL, null, {href : experiment.detailURL, }) - ]), - $.new("td", experiment.branch), - ]); - })); - }, - modifiedPreferences: function modifiedPreferences(data) { $.append($("prefs-tbody"), sortedArrayFromObject(data).map( function ([name, value]) { @@ -793,7 +715,8 @@ Serializer.prototype = { let hasText = false; for (let child of elem.childNodes) { if (child.nodeType == Node.TEXT_NODE) { - let text = this._nodeText(child); + let text = this._nodeText( + child, (child.classList && child.classList.contains("endline"))); this._appendText(text); hasText = hasText || !!text.trim(); } @@ -820,7 +743,7 @@ Serializer.prototype = { } }, - _startNewLine: function (lines) { + _startNewLine: function () { let currLine = this._currentLine; if (currLine) { // The current line is not empty. Trim it. @@ -832,7 +755,7 @@ Serializer.prototype = { this._lines.push(""); }, - _appendText: function (text, lines) { + _appendText: function (text) { this._currentLine += text; }, @@ -855,7 +778,8 @@ Serializer.prototype = { let col = tableHeadingCols[i]; if (col.localName != "th" || col.classList.contains("title-column")) break; - colHeadings[i] = this._nodeText(col).trim(); + colHeadings[i] = this._nodeText( + col, (col.classList && col.classList.contains("endline"))).trim(); } } let hasColHeadings = Object.keys(colHeadings).length > 0; @@ -882,7 +806,10 @@ Serializer.prototype = { let text = ""; if (colHeadings[j]) text += colHeadings[j] + ": "; - text += this._nodeText(children[j]).trim(); + text += this._nodeText( + children[j], + (children[j].classList && + children[j].classList.contains("endline"))).trim(); this._appendText(text); this._startNewLine(); } @@ -898,7 +825,10 @@ Serializer.prototype = { if (this._ignoreElement(trs[i])) continue; let children = trs[i].querySelectorAll("th,td"); - let rowHeading = this._nodeText(children[0]).trim(); + let rowHeading = this._nodeText( + children[0], + (children[0].classList && + children[0].classList.contains("endline"))).trim(); if (children[0].classList.contains("title-column")) { if (!this._isHiddenSubHeading(children[0])) this._appendText(rowHeading); @@ -912,7 +842,10 @@ Serializer.prototype = { // queued up from querySelectorAll earlier. this._appendText(rowHeading + ": "); } else { - this._appendText(rowHeading + ": " + this._nodeText(children[1]).trim()); + this._appendText(rowHeading + ": " + this._nodeText( + children[1], + (children[1].classList && + children[1].classList.contains("endline"))).trim()); } } this._startNewLine(); @@ -924,8 +857,16 @@ Serializer.prototype = { return elem.classList.contains("no-copy"); }, - _nodeText: function (node) { - return node.textContent.replace(/\s+/g, " "); + _nodeText: function (node, endline) { + let whiteChars = /\s+/g + let whiteCharsButNoEndline = /(?!\n)[\s]+/g; + let _node = node.cloneNode(true); + if (_node.firstElementChild && + (_node.firstElementChild.nodeName.toLowerCase() == "button")) { + _node.removeChild(_node.firstElementChild); + } + return _node.textContent.replace( + endline ? whiteCharsButNoEndline : whiteChars, " "); }, }; @@ -997,7 +938,7 @@ function setupEventListeners() { PlacesDBUtils.checkAndFixDatabase(function(aLog) { let msg = aLog.join("\n"); $("verify-place-result").style.display = "block"; - $("verify-place-result").classList.remove("no-copy"); + $("verify-place-result-parent").classList.remove("no-copy"); $("verify-place-result").textContent = msg; }); }); |