зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1476034 - about:crashes: switched to fluent. r=flod,Pike
Summary: The about:crashes page is being updated (bug 1463515). To facilitate these changes, this patch changes the about:crashes page to use Fluent for localization instead of the old systems. This also includes a script to migrate strings from the old .DTD and .properties files to the new .ftl one. Test Plan: 1. build Firefox with the changes 2. run Firefox 3. go to the about:crashes page 4. expect nothing to be different This extension: https://github.com/rhelmer/webext-experiment-crashme can be used to add local crash reports for verifying the different states of the about:crashes page. Reviewers: flod, Pike, jchen, snorp Reviewed By: flod, Pike, jchen, snorp Subscribers: nalexander, reviewbot Bug #: 1476034 Differential Revision: https://phabricator.services.mozilla.com/D2225 --HG-- extra : rebase_source : 0ca9516b4df78e735fd03907f2ea324bc72ca893
This commit is contained in:
Родитель
6c0e1e4469
Коммит
dded25327a
|
@ -169,11 +169,6 @@ whitelist = new Set(whitelist.filter(item =>
|
|||
).map(item => item.file));
|
||||
|
||||
const ignorableWhitelist = new Set([
|
||||
// These 2 files are unreferenced only when building without the crash
|
||||
// reporter (eg. Linux x64 asan builds on treeherder)
|
||||
"chrome://global/locale/crashes.dtd",
|
||||
"chrome://global/locale/crashes.properties",
|
||||
|
||||
// The following files are outside of the omni.ja file, so we only catch them
|
||||
// when testing on a non-packaged build.
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
ChromeUtils.import("resource://gre/modules/AddonManager.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/DelayedInit.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/L10nRegistry.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/Messaging.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
@ -389,6 +390,11 @@ var BrowserApp = {
|
|||
"Telemetry:CustomTabsPing",
|
||||
]);
|
||||
|
||||
// Initialize the default l10n resource sources for L10nRegistry.
|
||||
let locales = Services.locale.getPackagedLocales();
|
||||
const greSource = new FileSource("toolkit", locales, "resource://gre/localization/{locale}/");
|
||||
L10nRegistry.registerSource(greSource);
|
||||
|
||||
// Provide compatibility for add-ons like QuitNow that send "Browser:Quit"
|
||||
// as an observer notification.
|
||||
Services.obs.addObserver((subject, topic, data) =>
|
||||
|
|
|
@ -72,8 +72,6 @@ chrome.jar:
|
|||
% override chrome://pluginproblem/locale/pluginproblem.dtd chrome://browser/locale/overrides/plugins/pluginproblem.dtd
|
||||
% override chrome://global/locale/aboutSupport.dtd chrome://browser/locale/overrides/global/aboutSupport.dtd
|
||||
% override chrome://global/locale/aboutSupport.properties chrome://browser/locale/overrides/global/aboutSupport.properties
|
||||
% override chrome://global/locale/crashes.dtd chrome://browser/locale/overrides/crashreporter/crashes.dtd
|
||||
% override chrome://global/locale/crashes.properties chrome://browser/locale/overrides/crashreporter/crashes.properties
|
||||
% override chrome://global/locale/mozilla.dtd chrome://browser/locale/overrides/global/mozilla.dtd
|
||||
% override chrome://global/locale/aboutTelemetry.dtd chrome://browser/locale/overrides/global/aboutTelemetry.dtd
|
||||
% override chrome://global/locale/aboutTelemetry.properties chrome://browser/locale/overrides/global/aboutTelemetry.properties
|
||||
|
|
|
@ -5,8 +5,10 @@
|
|||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
FileSource: "resource://gre/modules/L10nRegistry.jsm",
|
||||
GeckoViewTelemetryController: "resource://gre/modules/GeckoViewTelemetryController.jsm",
|
||||
GeckoViewUtils: "resource://gre/modules/GeckoViewUtils.jsm",
|
||||
L10nRegistry: "resource://gre/modules/L10nRegistry.jsm",
|
||||
Services: "resource://gre/modules/Services.jsm",
|
||||
});
|
||||
|
||||
|
@ -111,6 +113,11 @@ GeckoViewStartup.prototype = {
|
|||
// The Telemetry initialization for the content process is performed in
|
||||
// ContentProcessSingleton.js for consistency with Desktop Telemetry.
|
||||
GeckoViewTelemetryController.setup();
|
||||
|
||||
// Initialize the default l10n resource sources for L10nRegistry.
|
||||
let locales = Services.locale.getPackagedLocales();
|
||||
const greSource = new FileSource("toolkit", locales, "resource://gre/localization/{locale}/");
|
||||
L10nRegistry.registerSource(greSource);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#endif
|
||||
@BINPATH@/dictionaries/*
|
||||
@BINPATH@/hyphenation/*
|
||||
@BINPATH@/localization/*
|
||||
|
||||
[assets destdir="assets/@ANDROID_CPU_ARCH@"]
|
||||
#ifndef MOZ_STATIC_JS
|
||||
|
|
|
@ -29,12 +29,14 @@ def test(mod, path, entity=None):
|
|||
"chrome/pluginproblem/pluginproblem.dtd",
|
||||
"chrome/global/aboutSupport.dtd",
|
||||
"chrome/global/aboutSupport.properties",
|
||||
"crashreporter/crashes.dtd",
|
||||
"crashreporter/crashes.properties",
|
||||
"chrome/global/mozilla.dtd",
|
||||
"chrome/global/aboutTelemetry.dtd",
|
||||
"chrome/global/aboutTelemetry.properties",
|
||||
"chrome/global/aboutWebrtc.properties"):
|
||||
"chrome/global/aboutWebrtc.properties",
|
||||
):
|
||||
return "error"
|
||||
if re.match(r"crashreporter/[^/]*.ftl", path):
|
||||
# error on crashreporter/*.ftl
|
||||
return "error"
|
||||
return "ignore"
|
||||
|
||||
|
|
|
@ -50,9 +50,6 @@ relativesrcdir toolkit/locales:
|
|||
# about:support
|
||||
locale/@AB_CD@/browser/overrides/global/aboutSupport.dtd (%chrome/global/aboutSupport.dtd)
|
||||
locale/@AB_CD@/browser/overrides/global/aboutSupport.properties (%chrome/global/aboutSupport.properties)
|
||||
#about:crashes
|
||||
locale/@AB_CD@/browser/overrides/crashreporter/crashes.dtd (%crashreporter/crashes.dtd)
|
||||
locale/@AB_CD@/browser/overrides/crashreporter/crashes.properties (%crashreporter/crashes.properties)
|
||||
#about:mozilla
|
||||
locale/@AB_CD@/browser/overrides/global/mozilla.dtd (%chrome/global/mozilla.dtd)
|
||||
#about:telemetry
|
||||
|
@ -69,3 +66,16 @@ relativesrcdir dom/locales:
|
|||
locale/@AB_CD@/browser/overrides/dom/dom.properties (%chrome/dom/dom.properties)
|
||||
#about:plugins
|
||||
locale/@AB_CD@/browser/overrides/plugins.properties (%chrome/plugins.properties)
|
||||
|
||||
# Fluent files
|
||||
# Note: All rules must be wildcards, as localized files are optional
|
||||
# Only run this if we're not en-US, as en-US is already built
|
||||
# by toolkit/locales/jar.mn.
|
||||
|
||||
#define EN_US en-US
|
||||
#if AB_CD != EN_US
|
||||
[localization] @AB_CD@.jar:
|
||||
relativesrcdir toolkit/locales:
|
||||
#about:crashes
|
||||
crashreporter (%crashreporter/**/*.ftl)
|
||||
#endif
|
||||
|
|
|
@ -201,6 +201,10 @@ exclude-multi-locale = [
|
|||
reference = "toolkit/locales/en-US/chrome/global/aboutSupport.properties"
|
||||
l10n = "{l}toolkit/chrome/global/aboutSupport.properties"
|
||||
|
||||
[[paths]]
|
||||
reference = "toolkit/locales/en-US/crashreporter/*.ftl"
|
||||
l10n = "{l}toolkit/crashreporter/*.ftl"
|
||||
|
||||
[[paths]]
|
||||
reference = "toolkit/locales/en-US/crashreporter/crashes.dtd"
|
||||
l10n = "{l}toolkit/crashreporter/crashes.dtd"
|
||||
|
|
|
@ -29,12 +29,14 @@ def test(mod, path, entity=None):
|
|||
"chrome/pluginproblem/pluginproblem.dtd",
|
||||
"chrome/global/aboutSupport.dtd",
|
||||
"chrome/global/aboutSupport.properties",
|
||||
"crashreporter/crashes.dtd",
|
||||
"crashreporter/crashes.properties",
|
||||
"chrome/global/mozilla.dtd",
|
||||
"chrome/global/aboutTelemetry.dtd",
|
||||
"chrome/global/aboutTelemetry.properties",
|
||||
"chrome/global/aboutWebrtc.properties"):
|
||||
"chrome/global/aboutWebrtc.properties",
|
||||
):
|
||||
return "error"
|
||||
if re.match(r"crashreporter/[^/]*.ftl", path):
|
||||
# error on crashreporter/*.ftl
|
||||
return "error"
|
||||
return "ignore"
|
||||
|
||||
|
@ -52,7 +54,7 @@ def test(mod, path, entity=None):
|
|||
# we only have exceptions for mobile*
|
||||
return "error"
|
||||
if mod == "mobile/android":
|
||||
if not entity:
|
||||
if entity is None:
|
||||
if (re.match(r"mobile-l10n.js", path) or
|
||||
re.match(r"defines.inc", path)):
|
||||
return "ignore"
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
# coding=utf8
|
||||
|
||||
# Any copyright is dedicated to the Public Domain.
|
||||
# http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
from __future__ import absolute_import
|
||||
import fluent.syntax.ast as FTL
|
||||
from fluent.migrate.helpers import transforms_from
|
||||
|
||||
|
||||
def migrate(ctx):
|
||||
"""Bug 1476034 - about:crashes localization migration from DTD to Fluent"""
|
||||
|
||||
ctx.add_transforms(
|
||||
"toolkit/crashreporter/aboutcrashes.ftl",
|
||||
"toolkit/crashreporter/aboutcrashes.ftl",
|
||||
transforms_from(
|
||||
"""
|
||||
crash-reports-title = { COPY("toolkit/crashreporter/crashes.dtd", "crashReports.title") }
|
||||
|
||||
clear-all-reports-label = { COPY("toolkit/crashreporter/crashes.dtd", "clearAllReports.label") }
|
||||
delete-confirm-title = { COPY("toolkit/crashreporter/crashes.properties", "deleteconfirm.title") }
|
||||
delete-confirm-description = { COPY("toolkit/crashreporter/crashes.properties", "deleteconfirm.description") }
|
||||
|
||||
crashes-unsubmitted-label = { COPY("toolkit/crashreporter/crashes.dtd", "crashesUnsubmitted.label") }
|
||||
id-heading = { COPY("toolkit/crashreporter/crashes.dtd", "id.heading") }
|
||||
date-crashed-heading = { COPY("toolkit/crashreporter/crashes.dtd", "dateCrashed.heading") }
|
||||
|
||||
crashes-submitted-label = { COPY("toolkit/crashreporter/crashes.dtd", "crashesSubmitted.label") }
|
||||
date-submitted-heading = { COPY("toolkit/crashreporter/crashes.dtd", "dateSubmitted.heading") }
|
||||
|
||||
no-reports-label = { COPY("toolkit/crashreporter/crashes.dtd", "noReports.label") }
|
||||
no-config-label = { COPY("toolkit/crashreporter/crashes.dtd", "noConfig.label") }
|
||||
""")
|
||||
)
|
|
@ -19,7 +19,7 @@ th {
|
|||
text-align: left;
|
||||
white-space: nowrap;
|
||||
}
|
||||
th[chromedir="rtl"] {
|
||||
th:-moz-locale-dir(rtl) {
|
||||
text-align: right;
|
||||
}
|
||||
/* name */
|
||||
|
@ -51,7 +51,7 @@ td:last-child {
|
|||
#clear-reports {
|
||||
float: right;
|
||||
}
|
||||
#clear-reports[chromedir="rtl"] {
|
||||
#clear-reports:-moz-locale-dir(rtl) {
|
||||
float: left;
|
||||
}
|
||||
|
||||
|
|
|
@ -130,12 +130,11 @@ function populateReportList() {
|
|||
}
|
||||
|
||||
var clearReports = async function() {
|
||||
let bundle = Services.strings.createBundle("chrome://global/locale/crashes.properties");
|
||||
|
||||
if (!Services.
|
||||
prompt.confirm(window,
|
||||
bundle.GetStringFromName("deleteconfirm.title"),
|
||||
bundle.GetStringFromName("deleteconfirm.description"))) {
|
||||
const [title, description] = await document.l10n.formatValues([
|
||||
{id: "delete-confirm-title"},
|
||||
{id: "delete-confirm-description"},
|
||||
]);
|
||||
if (!Services.prompt.confirm(window, title, description)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,33 +3,28 @@
|
|||
- 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/. -->
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
||||
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"
|
||||
[
|
||||
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
|
||||
<!ENTITY % crashesDTD SYSTEM "chrome://global/locale/crashes.dtd">
|
||||
%globalDTD;
|
||||
%crashesDTD;
|
||||
]>
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<link rel="localization" href="crashreporter/aboutcrashes.ftl"/>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://global/content/crashes.css"/>
|
||||
<link rel="stylesheet" media="screen, projection" type="text/css"
|
||||
href="chrome://global/skin/in-content/common.css"/>
|
||||
<script type="application/javascript" src="chrome://global/content/crashes.js"/>
|
||||
<script type="text/javascript" src="chrome://global/content/l10n.js"/>
|
||||
|
||||
<title>&crashReports.title;</title>
|
||||
</head><body dir="&locale.dir;">
|
||||
<button chromedir="&locale.dir;" id="clear-reports">&clearAllReports.label;</button>
|
||||
<title data-l10n-id="crash-reports-title"></title>
|
||||
</head><body>
|
||||
<button id="clear-reports" data-l10n-id="clear-all-reports-label"></button>
|
||||
<div id="reportList">
|
||||
<div id="reportListUnsubmitted">
|
||||
<h1>&crashesUnsubmitted.label;</h1>
|
||||
<h1 data-l10n-id="crashes-unsubmitted-label"></h1>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th chromedir="&locale.dir;">&id.heading;</th>
|
||||
<th chromedir="&locale.dir;" colspan="2">&dateCrashed.heading;</th>
|
||||
<th data-l10n-id="id-heading"></th>
|
||||
<th colspan="2" data-l10n-id="date-crashed-heading"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="unsubmitted">
|
||||
|
@ -37,12 +32,12 @@
|
|||
</table>
|
||||
</div>
|
||||
<div id="reportListSubmitted">
|
||||
<h1>&crashesSubmitted.label;</h1>
|
||||
<h1 data-l10n-id="crashes-submitted-label"></h1>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th chromedir="&locale.dir;">&id.heading;</th>
|
||||
<th chromedir="&locale.dir;" colspan="2">&dateSubmitted.heading;</th>
|
||||
<th data-l10n-id="id-heading"></th>
|
||||
<th colspan="2" data-l10n-id="date-submitted-heading"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="submitted">
|
||||
|
@ -50,7 +45,7 @@
|
|||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<p id="noReports" style="display: none">&noReports.label;</p>
|
||||
<p id="noConfig" style="display: none">&noConfig.label;</p>
|
||||
<p id="noReports" style="display: none" data-l10n-id="no-reports-label"></p>
|
||||
<p id="noConfig" style="display: none" data-l10n-id="no-config-label"></p>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
<!ENTITY aboutSupport.crashes.title "Crash Reports">
|
||||
<!-- LOCALIZATION NOTE (aboutSupport.crashes.id):
|
||||
This is likely the same like id.heading in crashes.dtd. -->
|
||||
This is likely the same like id.heading in aboutcrashes.ftl. -->
|
||||
<!ENTITY aboutSupport.crashes.id "Report ID">
|
||||
<!ENTITY aboutSupport.crashes.sendDate "Submitted">
|
||||
<!ENTITY aboutSupport.crashes.allReports "All Crash Reports">
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# 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/-
|
||||
|
||||
crash-reports-title = Crash Reports
|
||||
|
||||
clear-all-reports-label = Remove All Reports
|
||||
delete-confirm-title = Are you sure?
|
||||
delete-confirm-description = This will delete all reports and cannot be undone.
|
||||
|
||||
crashes-unsubmitted-label = Unsubmitted Crash Reports
|
||||
id-heading = Report ID
|
||||
date-crashed-heading = Date Crashed
|
||||
|
||||
crashes-submitted-label = Submitted Crash Reports
|
||||
date-submitted-heading = Date Submitted
|
||||
|
||||
no-reports-label = No crash reports have been submitted.
|
||||
no-config-label = This application has not been configured to display crash reports. The preference <code>breakpad.reportURL</code> must be set.
|
|
@ -1,13 +0,0 @@
|
|||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- 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/. -->
|
||||
|
||||
<!ENTITY crashReports.title "Crash Reports">
|
||||
<!ENTITY crashesUnsubmitted.label "Unsubmitted Crash Reports">
|
||||
<!ENTITY crashesSubmitted.label "Submitted Crash Reports">
|
||||
<!ENTITY id.heading "Report ID">
|
||||
<!ENTITY dateCrashed.heading "Date Crashed">
|
||||
<!ENTITY dateSubmitted.heading "Date Submitted">
|
||||
<!ENTITY noReports.label "No crash reports have been submitted.">
|
||||
<!ENTITY noConfig.label "This application has not been configured to display crash reports. The preference <code>breakpad.reportURL</code> must be set.">
|
||||
<!ENTITY clearAllReports.label "Remove All Reports">
|
|
@ -1,7 +0,0 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# 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/.
|
||||
|
||||
deleteconfirm.title=Are you sure?
|
||||
deleteconfirm.description=This will delete all reports and cannot be undone.
|
||||
|
|
@ -4,6 +4,7 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
[localization] @AB_CD@.jar:
|
||||
crashreporter (%crashreporter/**/*.ftl)
|
||||
toolkit (%toolkit/**/*.ftl)
|
||||
|
||||
@AB_CD@.jar:
|
||||
|
@ -76,8 +77,6 @@
|
|||
locale/@AB_CD@/global/viewSource.properties (%chrome/global/viewSource.properties)
|
||||
locale/@AB_CD@/global/wizard.dtd (%chrome/global/wizard.dtd)
|
||||
locale/@AB_CD@/global/wizard.properties (%chrome/global/wizard.properties)
|
||||
locale/@AB_CD@/global/crashes.dtd (%crashreporter/crashes.dtd)
|
||||
locale/@AB_CD@/global/crashes.properties (%crashreporter/crashes.properties)
|
||||
% locale global-platform @AB_CD@ %locale/@AB_CD@/global-platform/unix/ os=LikeUnix os=Android
|
||||
% locale global-platform @AB_CD@ %locale/@AB_CD@/global-platform/mac/ os=Darwin
|
||||
% locale global-platform @AB_CD@ %locale/@AB_CD@/global-platform/win/ os=WINNT
|
||||
|
|
Загрузка…
Ссылка в новой задаче