Backed out changeset be86ccde4f4a (bug 1352497) for bc failures on Windows 7 debug with e10s at docshell/test/browser/browser_bug1309900_crossProcessHistoryNavigation.js r=backout a=backout

This commit is contained in:
Cosmin Sabou 2017-11-26 01:36:44 +02:00
Родитель 64077545fa
Коммит 651cb90a8a
44 изменённых файлов: 971 добавлений и 10 удалений

Просмотреть файл

@ -275,6 +275,7 @@ mobile/android/tests/browser/chrome/tp5/**
# Uses `#filter substitution`
mobile/android/app/mobile.js
mobile/android/chrome/content/healthreport-prefs.js
# Uses `#expand`
mobile/android/chrome/content/about.js

Просмотреть файл

@ -0,0 +1,15 @@
* {
margin: 0;
padding: 0;
}
html, body {
height: 100%;
}
#remote-report {
width: 100%;
height: 100%;
border: 0;
display: flex;
}

Просмотреть файл

@ -0,0 +1,172 @@
/* 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/. */
"use strict";
var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
const PREF_REPORTING_URL = "datareporting.healthreport.about.reportUrl";
var healthReportWrapper = {
init() {
let iframe = document.getElementById("remote-report");
iframe.addEventListener("load", healthReportWrapper.initRemotePage);
iframe.src = this._getReportURI().spec;
XPCOMUtils.defineLazyPreferenceGetter(this, /* unused */ "_isUploadEnabled",
"datareporting.healthreport.uploadEnabled",
false, () => this.updatePrefState());
},
_getReportURI() {
let url = Services.urlFormatter.formatURLPref(PREF_REPORTING_URL);
return Services.io.newURI(url);
},
setDataSubmission(enabled) {
MozSelfSupport.healthReportDataSubmissionEnabled = enabled;
this.updatePrefState();
},
updatePrefState() {
try {
let prefsObj = {
enabled: MozSelfSupport.healthReportDataSubmissionEnabled,
};
healthReportWrapper.injectData("prefs", prefsObj);
} catch (ex) {
healthReportWrapper.reportFailure(healthReportWrapper.ERROR_PREFS_FAILED);
}
},
sendTelemetryPingList() {
console.log("AboutHealthReport: Collecting Telemetry ping list.");
MozSelfSupport.getTelemetryPingList().then((list) => {
console.log("AboutHealthReport: Sending Telemetry ping list.");
this.injectData("telemetry-ping-list", list);
}).catch((ex) => {
console.log("AboutHealthReport: Collecting ping list failed: " + ex);
});
},
sendTelemetryPingData(pingId) {
console.log("AboutHealthReport: Collecting Telemetry ping data.");
MozSelfSupport.getTelemetryPing(pingId).then((ping) => {
console.log("AboutHealthReport: Sending Telemetry ping data.");
this.injectData("telemetry-ping-data", {
id: pingId,
pingData: ping,
});
}).catch((ex) => {
console.log("AboutHealthReport: Loading ping data failed: " + ex);
this.injectData("telemetry-ping-data", {
id: pingId,
error: "error-generic",
});
});
},
sendCurrentEnvironment() {
console.log("AboutHealthReport: Sending Telemetry environment data.");
MozSelfSupport.getCurrentTelemetryEnvironment().then((environment) => {
this.injectData("telemetry-current-environment-data", environment);
}).catch((ex) => {
console.log("AboutHealthReport: Collecting current environment data failed: " + ex);
});
},
sendCurrentPingData() {
console.log("AboutHealthReport: Sending current Telemetry ping data.");
MozSelfSupport.getCurrentTelemetrySubsessionPing().then((ping) => {
this.injectData("telemetry-current-ping-data", ping);
}).catch((ex) => {
console.log("AboutHealthReport: Collecting current ping data failed: " + ex);
});
},
injectData(type, content) {
let report = this._getReportURI();
// file URIs can't be used for targetOrigin, so we use "*" for this special case
// in all other cases, pass in the URL to the report so we properly restrict the message dispatch
let reportUrl = report.scheme == "file" ? "*" : report.spec;
let data = {
type,
content
};
let iframe = document.getElementById("remote-report");
iframe.contentWindow.postMessage(data, reportUrl);
},
handleRemoteCommand(evt) {
// Do an origin check to harden against the frame content being loaded from unexpected locations.
let allowedPrincipal = Services.scriptSecurityManager.createCodebasePrincipal(this._getReportURI(), {});
let targetPrincipal = evt.target.nodePrincipal;
if (!allowedPrincipal.equals(targetPrincipal)) {
Cu.reportError(`Origin check failed for message "${evt.detail.command}": ` +
`target origin is "${targetPrincipal.origin}", expected "${allowedPrincipal.origin}"`);
return;
}
switch (evt.detail.command) {
case "DisableDataSubmission":
this.setDataSubmission(false);
break;
case "EnableDataSubmission":
this.setDataSubmission(true);
break;
case "RequestCurrentPrefs":
this.updatePrefState();
break;
case "RequestTelemetryPingList":
this.sendTelemetryPingList();
break;
case "RequestTelemetryPingData":
this.sendTelemetryPingData(evt.detail.id);
break;
case "RequestCurrentEnvironment":
this.sendCurrentEnvironment();
break;
case "RequestCurrentPingData":
this.sendCurrentPingData();
break;
default:
Cu.reportError("Unexpected remote command received: " + evt.detail.command + ". Ignoring command.");
break;
}
},
initRemotePage() {
let iframe = document.getElementById("remote-report").contentDocument;
iframe.addEventListener("RemoteHealthReportCommand",
function onCommand(e) { healthReportWrapper.handleRemoteCommand(e); });
healthReportWrapper.updatePrefState();
},
// error handling
ERROR_INIT_FAILED: 1,
ERROR_PAYLOAD_FAILED: 2,
ERROR_PREFS_FAILED: 3,
reportFailure(error) {
let details = {
errorType: error,
};
healthReportWrapper.injectData("error", details);
},
handleInitFailure() {
healthReportWrapper.reportFailure(healthReportWrapper.ERROR_INIT_FAILED);
},
handlePayloadFailure() {
healthReportWrapper.reportFailure(healthReportWrapper.ERROR_PAYLOAD_FAILED);
},
};
window.addEventListener("load", function() { healthReportWrapper.init(); });

Просмотреть файл

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 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/. -->
<!DOCTYPE html [
<!ENTITY % htmlDTD PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
%htmlDTD;
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
%brandDTD;
<!ENTITY % securityPrefsDTD SYSTEM "chrome://browser/locale/preferences/security.dtd">
%securityPrefsDTD;
<!ENTITY % aboutHealthReportDTD SYSTEM "chrome://browser/locale/aboutHealthReport.dtd">
%aboutHealthReportDTD;
]>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>&abouthealth.pagetitle;</title>
<link rel="icon" type="image/png" id="favicon"
href="chrome://branding/content/icon32.png"/>
<link rel="stylesheet"
href="chrome://browser/content/abouthealthreport/abouthealth.css"
type="text/css" />
<script type="text/javascript"
src="chrome://browser/content/abouthealthreport/abouthealth.js" />
</head>
<body>
<iframe id="remote-report"/>
</body>
</html>

Просмотреть файл

@ -61,6 +61,13 @@
onclick="checkForMiddleClick(this, event);"
label="&helpKeyboardShortcuts.label;"
accesskey="&helpKeyboardShortcuts.accesskey;"/>
#ifdef MOZ_SERVICES_HEALTHREPORT
<menuitem id="healthReport"
label="&healthReport2.label;"
accesskey="&healthReport2.accesskey;"
oncommand="openHealthReport()"
onclick="checkForMiddleClick(this, event);"/>
#endif
<menuitem id="troubleShooting"
accesskey="&helpTroubleshootingInfo.accesskey;"
label="&helpTroubleshootingInfo.label;"

Просмотреть файл

@ -7,6 +7,9 @@
with Files("**"):
BUG_COMPONENT = ("Firefox", "General")
with Files("abouthealthreport/**"):
BUG_COMPONENT = ("Firefox Health Report", "Client: Desktop")
with Files("defaultthemes/**"):
BUG_COMPONENT = ("Firefox", "Theme")

Просмотреть файл

@ -2,6 +2,8 @@
support-files =
aboutHome_content_script.js
head.js
healthreport_pingData.js
healthreport_testRemoteCommands.html
print_postdata.sjs
searchSuggestionEngine.sjs
searchSuggestionEngine.xml
@ -9,6 +11,8 @@ support-files =
POSTSearchEngine.xml
[browser_aboutCertError.js]
[browser_aboutHealthReport.js]
skip-if = os == "linux" # Bug 924307
[browser_aboutHome_imitate.js]
[browser_aboutHome_input.js]
skip-if = os == "win" && debug && !e10s # Bug 1399648

Просмотреть файл

@ -0,0 +1,129 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
const CHROME_BASE = "chrome://mochitests/content/browser/browser/base/content/test/about/";
const HTTPS_BASE = "https://example.com/browser/browser/base/content/test/about/";
const TELEMETRY_LOG_PREF = "toolkit.telemetry.log.level";
const telemetryOriginalLogPref = Services.prefs.getStringPref(TELEMETRY_LOG_PREF, null);
const originalReportUrl = Services.prefs.getCharPref("datareporting.healthreport.about.reportUrl");
registerCleanupFunction(function() {
// Ensure we don't pollute prefs for next tests.
if (telemetryOriginalLogPref) {
Services.prefs.setStringPref(TELEMETRY_LOG_PREF, telemetryOriginalLogPref);
} else {
Services.prefs.clearUserPref(TELEMETRY_LOG_PREF);
}
try {
Services.prefs.setCharPref("datareporting.healthreport.about.reportUrl", originalReportUrl);
Services.prefs.setBoolPref("datareporting.healthreport.uploadEnabled", true);
} catch (ex) {}
});
function fakeTelemetryNow(...args) {
let date = new Date(...args);
let scope = {};
const modules = [
Cu.import("resource://gre/modules/TelemetrySession.jsm", scope),
Cu.import("resource://gre/modules/TelemetryEnvironment.jsm", scope),
Cu.import("resource://gre/modules/TelemetryController.jsm", scope),
];
for (let m of modules) {
m.Policy.now = () => new Date(date);
}
return date;
}
async function setupPingArchive() {
let scope = {};
Cu.import("resource://gre/modules/TelemetryController.jsm", scope);
Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader)
.loadSubScript(CHROME_BASE + "healthreport_pingData.js", scope);
for (let p of scope.TEST_PINGS) {
fakeTelemetryNow(p.date);
p.id = await scope.TelemetryController.submitExternalPing(p.type, p.payload);
}
}
var gTests = [
{
desc: "Test the remote commands",
async setup() {
Services.prefs.setStringPref(TELEMETRY_LOG_PREF, "Trace");
await setupPingArchive();
Services.prefs.setCharPref("datareporting.healthreport.about.reportUrl",
HTTPS_BASE + "healthreport_testRemoteCommands.html");
},
run(iframe) {
return new Promise((resolve, reject) => {
let results = 0;
try {
iframe.contentWindow.addEventListener("FirefoxHealthReportTestResponse", function evtHandler(event) {
let data = event.detail.data;
if (data.type == "testResult") {
ok(data.pass, data.info);
results++;
} else if (data.type == "testsComplete") {
is(results, data.count, "Checking number of results received matches the number of tests that should have run");
iframe.contentWindow.removeEventListener("FirefoxHealthReportTestResponse", evtHandler, true);
resolve();
}
}, true);
} catch (e) {
ok(false, "Failed to get all commands");
reject();
}
});
}
},
]; // gTests
function test() {
waitForExplicitFinish();
// xxxmpc leaving this here until we resolve bug 854038 and bug 854060
requestLongerTimeout(10);
(async function() {
for (let testCase of gTests) {
info(testCase.desc);
await testCase.setup();
let iframe = await promiseNewTabLoadEvent("about:healthreport");
await testCase.run(iframe);
gBrowser.removeCurrentTab();
}
finish();
})();
}
function promiseNewTabLoadEvent(aUrl, aEventType = "load") {
return new Promise(resolve => {
let tab = gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, aUrl);
tab.linkedBrowser.addEventListener(aEventType, function(event) {
let iframe = tab.linkedBrowser.contentDocument.getElementById("remote-report");
iframe.addEventListener("load", function frameLoad(e) {
if (iframe.contentWindow.location.href == "about:blank" ||
e.target != iframe) {
return;
}
iframe.removeEventListener("load", frameLoad);
resolve(iframe);
});
}, {capture: true, once: true});
});
}

Просмотреть файл

@ -0,0 +1,17 @@
var TEST_PINGS = [
{
type: "test-telemetryArchive-1",
payload: { foo: "bar" },
date: new Date(2010, 1, 1, 10, 0, 0),
},
{
type: "test-telemetryArchive-2",
payload: { x: { y: "z"} },
date: new Date(2010, 1, 1, 11, 0, 0),
},
{
type: "test-telemetryArchive-3",
payload: { moo: "meh" },
date: new Date(2010, 1, 1, 12, 0, 0),
},
];

Просмотреть файл

@ -0,0 +1,243 @@
<html>
<head>
<meta charset="utf-8">
<script type="application/javascript"
src="healthreport_pingData.js">
</script>
<script type="application/javascript">
/* import-globals-from healthreport_pingData.js */
function init() {
window.addEventListener("message", doTest);
doTest();
}
function checkSubmissionValue(payload, expectedValue) {
return payload.enabled == expectedValue;
}
function isArray(arg) {
return Object.prototype.toString.call(arg) === "[object Array]";
}
function writeDiagnostic(text) {
let node = document.createTextNode(text);
let br = document.createElement("br");
document.body.appendChild(node);
document.body.appendChild(br);
}
function validateCurrentTelemetryEnvironment(data) {
// Simple check for now: check that the received object has the expected
// top-level properties.
const expectedKeys = ["profile", "settings", "system", "build", "partner", "addons"];
return expectedKeys.every(key => (key in data));
}
function validateCurrentTelemetryPingData(ping) {
// Simple check for now: check that the received object has the expected
// top-level properties and that the type and reason match.
const expectedKeys = ["environment", "clientId", "payload", "application",
"version", "type", "id"];
return expectedKeys.every(key => (key in ping)) &&
(ping.type == "main") &&
("info" in ping.payload) &&
("reason" in ping.payload.info) &&
(ping.payload.info.reason == "gather-subsession-payload");
}
function validateTelemetryPingList(list) {
if (!isArray(list)) {
console.log("Telemetry ping list is not an array.");
return false;
}
// Telemetry may generate other pings (e.g. "deletion" pings), so filter those
// out.
const TEST_TYPES_REGEX = /^test-telemetryArchive/;
list = list.filter(p => TEST_TYPES_REGEX.test(p.type));
if (list.length != TEST_PINGS.length) {
console.log("Telemetry ping length is not correct.");
return false;
}
let valid = true;
for (let i = 0; i < list.length; ++i) {
let received = list[i];
let expected = TEST_PINGS[i];
if (received.type != expected.type ||
received.timestampCreated != expected.date.getTime()) {
writeDiagnostic("Telemetry ping " + i + " does not match.");
writeDiagnostic("Expected: " + JSON.stringify(expected));
writeDiagnostic("Received: " + JSON.stringify(received));
valid = false;
} else {
writeDiagnostic("Telemetry ping " + i + " matches.");
}
}
return valid;
}
function validateTelemetryPingData(expected, received) {
const receivedDate = new Date(received.creationDate);
if (received.id != expected.id ||
received.type != expected.type ||
receivedDate.getTime() != expected.date.getTime()) {
writeDiagnostic("Telemetry ping data for " + expected.id + " doesn't match.");
writeDiagnostic("Expected: " + JSON.stringify(expected));
writeDiagnostic("Received: " + JSON.stringify(received));
return false;
}
writeDiagnostic("Telemetry ping data for " + expected.id + " matched.");
return true;
}
var tests = [
{
info: "Checking initial value is enabled",
event: "RequestCurrentPrefs",
payloadType: "prefs",
validateResponse(payload) {
return checkSubmissionValue(payload, true);
},
},
{
info: "Verifying disabling works",
event: "DisableDataSubmission",
payloadType: "prefs",
validateResponse(payload) {
return checkSubmissionValue(payload, false);
},
},
{
info: "Verifying we're still disabled",
event: "RequestCurrentPrefs",
payloadType: "prefs",
validateResponse(payload) {
return checkSubmissionValue(payload, false);
},
},
{
info: "Verifying that we can get the current ping data while submission is disabled",
event: "RequestCurrentPingData",
payloadType: "telemetry-current-ping-data",
validateResponse(payload) {
return validateCurrentTelemetryPingData(payload);
},
},
{
info: "Verifying enabling works",
event: "EnableDataSubmission",
payloadType: "prefs",
validateResponse(payload) {
return checkSubmissionValue(payload, true);
},
},
{
info: "Verifying we're still re-enabled",
event: "RequestCurrentPrefs",
payloadType: "prefs",
validateResponse(payload) {
return checkSubmissionValue(payload, true);
},
},
{
info: "Verifying that we can get the current Telemetry environment data",
event: "RequestCurrentEnvironment",
payloadType: "telemetry-current-environment-data",
validateResponse(payload) {
return validateCurrentTelemetryEnvironment(payload);
},
},
{
info: "Verifying that we can get the current Telemetry ping data",
event: "RequestCurrentPingData",
payloadType: "telemetry-current-ping-data",
validateResponse(payload) {
return validateCurrentTelemetryPingData(payload);
},
},
{
info: "Verifying that we get the proper Telemetry ping list",
event: "RequestTelemetryPingList",
payloadType: "telemetry-ping-list",
validateResponse(payload) {
// Validate the ping list
if (!validateTelemetryPingList(payload)) {
return false;
}
// Now that we received the ping ids, set up additional test tasks
// that check loading the individual pings.
for (let i = 0; i < TEST_PINGS.length; ++i) {
TEST_PINGS[i].id = payload[i].id;
tests.push({
info: "Verifying that we can get the proper Telemetry ping data #" + (i + 1),
event: "RequestTelemetryPingData",
eventData: { id: TEST_PINGS[i].id },
payloadType: "telemetry-ping-data",
validateResponse(payload2) {
return validateTelemetryPingData(TEST_PINGS[i], payload2.pingData);
},
});
}
return true;
},
},
];
var currentTest = -1;
function doTest(evt) {
if (evt) {
if (currentTest < 0 || !evt.data.content)
return; // not yet testing
var test = tests[currentTest];
if (evt.data.type != test.payloadType)
return; // skip unrequested events
var error = JSON.stringify(evt.data.content);
var pass = false;
try {
pass = test.validateResponse(evt.data.content);
} catch (e) {}
reportResult(test.info, pass, error);
}
// start the next test if there are any left
if (tests[++currentTest])
sendToBrowser(tests[currentTest].event, tests[currentTest].eventData);
else
reportFinished();
}
function reportResult(info, pass, error) {
var data = {type: "testResult", info, pass, error};
var event = new CustomEvent("FirefoxHealthReportTestResponse", {detail: {data}, bubbles: true});
document.dispatchEvent(event);
}
function reportFinished(cmd) {
var data = {type: "testsComplete", count: tests.length};
var event = new CustomEvent("FirefoxHealthReportTestResponse", {detail: {data}, bubbles: true});
document.dispatchEvent(event);
}
function sendToBrowser(type, eventData) {
eventData = eventData || {};
let detail = {command: type};
for (let key of Object.keys(eventData)) {
detail[key] = eventData[key];
}
var event = new CustomEvent("RemoteHealthReportCommand", {detail, bubbles: true});
document.dispatchEvent(event);
}
</script>
</head>
<body onload="init()">
</body>
</html>

Просмотреть файл

@ -817,6 +817,14 @@ function openTroubleshootingPage() {
openUILinkIn("about:support", "tab");
}
/**
* Opens the troubleshooting information (about:support) page for this version
* of the application.
*/
function openHealthReport() {
openUILinkIn("about:healthreport", "tab");
}
/**
* Opens the feedback page for this version of the application.
*/

Просмотреть файл

@ -42,6 +42,13 @@ browser.jar:
content/browser/illustrations/error-server-not-found.svg (content/illustrations/error-server-not-found.svg)
content/browser/illustrations/error-malformed-url.svg (content/illustrations/error-malformed-url.svg)
content/browser/aboutNetError.xhtml (content/aboutNetError.xhtml)
#ifdef MOZ_SERVICES_HEALTHREPORT
content/browser/abouthealthreport/abouthealth.xhtml (content/abouthealthreport/abouthealth.xhtml)
content/browser/abouthealthreport/abouthealth.js (content/abouthealthreport/abouthealth.js)
content/browser/abouthealthreport/abouthealth.css (content/abouthealthreport/abouthealth.css)
#endif
content/browser/aboutRobots-icon.png (content/aboutRobots-icon.png)
content/browser/aboutRobots-widget-left.png (content/aboutRobots-widget-left.png)
content/browser/aboutTabCrashed.css (content/aboutTabCrashed.css)

Просмотреть файл

@ -91,6 +91,10 @@ static const RedirEntry kRedirMap[] = {
nsIAboutModule::ALLOW_SCRIPT },
{ "downloads", "chrome://browser/content/downloads/contentAreaDownloadsView.xul",
nsIAboutModule::ALLOW_SCRIPT },
#ifdef MOZ_SERVICES_HEALTHREPORT
{ "healthreport", "chrome://browser/content/abouthealthreport/abouthealth.xhtml",
nsIAboutModule::ALLOW_SCRIPT },
#endif
{ "reader", "chrome://global/content/reader/aboutReader.html",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
nsIAboutModule::ALLOW_SCRIPT |

Просмотреть файл

@ -105,6 +105,9 @@ static const mozilla::Module::ContractIDEntry kBrowserContracts[] = {
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "newtab", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "preferences", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "downloads", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
#ifdef MOZ_SERVICES_HEALTHREPORT
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "healthreport", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
#endif
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "reader", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
#if defined(XP_WIN)
{ NS_IEHISTORYENUMERATOR_CONTRACTID, &kNS_WINIEHISTORYENUMERATOR_CID },

Просмотреть файл

@ -0,0 +1,6 @@
<!-- 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/. -->
<!-- LOCALIZATION NOTE (abouthealth.pagetitle): Firefox Health Report is a proper noun in en-US, please keep this in mind. -->
<!ENTITY abouthealth.pagetitle "&brandShortName; Health Report">

Просмотреть файл

@ -28,6 +28,9 @@
<!ENTITY helpSafeMode.stop.label "Restart with Add-ons Enabled">
<!ENTITY helpSafeMode.stop.accesskey "R">
<!ENTITY healthReport2.label "&brandShorterName; Health Report">
<!ENTITY healthReport2.accesskey "e">
<!ENTITY helpTroubleshootingInfo.label "Troubleshooting Information">
<!ENTITY helpTroubleshootingInfo.accesskey "T">

Просмотреть файл

@ -19,6 +19,9 @@
locale/browser/aboutRobots.dtd (%chrome/browser/aboutRobots.dtd)
locale/browser/aboutHome.dtd (%chrome/browser/aboutHome.dtd)
locale/browser/accounts.properties (%chrome/browser/accounts.properties)
#ifdef MOZ_SERVICES_HEALTHREPORT
locale/browser/aboutHealthReport.dtd (%chrome/browser/aboutHealthReport.dtd)
#endif
locale/browser/aboutSearchReset.dtd (%chrome/browser/aboutSearchReset.dtd)
locale/browser/aboutSessionRestore.dtd (%chrome/browser/aboutSessionRestore.dtd)
locale/browser/aboutTabCrashed.dtd (%chrome/browser/aboutTabCrashed.dtd)

Просмотреть файл

@ -13,9 +13,9 @@ add_task(async function runTests() {
let browser = tab.linkedBrowser;
browser.loadURI("about:about");
browser.loadURI("about:healthreport");
let href = await BrowserTestUtils.browserLoaded(browser);
is(href, "about:about", "Check about:about loaded");
is(href, "about:healthreport", "Check about:healthreport loaded");
// Using a dummy onunload listener to disable the bfcache as that can prevent
// the test browser load detection mechanism from working.
@ -26,7 +26,7 @@ add_task(async function runTests() {
browser.goBack();
href = await BrowserTestUtils.browserLoaded(browser);
is(href, "about:about", "Check we've gone back to about:about");
is(href, "about:healthreport", "Check we've gone back to about:healthreport");
browser.goForward();
href = await BrowserTestUtils.browserLoaded(browser);

Просмотреть файл

@ -96,6 +96,11 @@
android:summary="@string/datareporting_fhr_summary2"
android:defaultValue="true" />
<org.mozilla.gecko.preferences.AlignRightLinkPreference android:key="android.not_a_preference.healthreport.link"
android:title="@string/datareporting_abouthr_title"
android:persistent="false"
url="about:healthreport" />
</PreferenceCategory>
</PreferenceScreen>

Просмотреть файл

@ -19,6 +19,7 @@ public class TestAboutPagesPreparer {
AboutPages.CONFIG,
AboutPages.DOWNLOADS,
AboutPages.FIREFOX,
AboutPages.HEALTHREPORT,
AboutPages.HOME
};

Просмотреть файл

@ -21,6 +21,7 @@ public class AboutPages {
public static final String CONFIG = "about:config";
public static final String DOWNLOADS = "about:downloads";
public static final String FIREFOX = "about:firefox";
public static final String HEALTHREPORT = "about:healthreport";
public static final String HOME = "about:home";
public static final String LOGINS = "about:logins";
public static final String PRIVATEBROWSING = "about:privatebrowsing";
@ -80,7 +81,8 @@ public class AboutPages {
ADDONS,
CONFIG,
DOWNLOADS,
FIREFOX
FIREFOX,
HEALTHREPORT
));
public static boolean isBuiltinIconPage(final String url) {

Просмотреть файл

@ -129,6 +129,7 @@ public class GeckoPreferences
private static final String PREFS_UPDATER_URL = "app.update.url.android";
private static final String PREFS_GEO_REPORTING = NON_PREF_PREFIX + "app.geo.reportdata";
private static final String PREFS_GEO_LEARN_MORE = NON_PREF_PREFIX + "geo.learn_more";
private static final String PREFS_HEALTHREPORT_LINK = NON_PREF_PREFIX + "healthreport.link";
public static final String PREFS_DEVTOOLS_REMOTE_USB_ENABLED = "devtools.remote.usb.enabled";
public static final String PREFS_DEVTOOLS_REMOTE_WIFI_ENABLED = "devtools.remote.wifi.enabled";
private static final String PREFS_DEVTOOLS_REMOTE_LINK = NON_PREF_PREFIX + "remote_debugging.link";
@ -674,7 +675,8 @@ public class GeckoPreferences
i--;
continue;
}
} else if (PREFS_HEALTHREPORT_UPLOAD_ENABLED.equals(key)) {
} else if (PREFS_HEALTHREPORT_UPLOAD_ENABLED.equals(key) ||
PREFS_HEALTHREPORT_LINK.equals(key)) {
if (!AppConstants.MOZ_SERVICES_HEALTHREPORT || !Restrictions.isAllowed(this, Restrictable.DATA_CHOICES)) {
preferences.removePreference(pref);
i--;

Просмотреть файл

@ -422,6 +422,7 @@
crashReporterDesc.label). -->
<!ENTITY datareporting_fhr_title "&brandShortName; Health Report">
<!ENTITY datareporting_fhr_summary2 "Shares data with &vendorShortName; about your browser health and helps you understand your browser performance">
<!ENTITY datareporting_abouthr_title "View my Health Report">
<!ENTITY datareporting_telemetry_title "Telemetry">
<!ENTITY datareporting_telemetry_summary "Shares performance, usage, hardware and customization data about your browser with &vendorShortName; to help us make &brandShortName; better">
<!ENTITY datareporting_crashreporter_summary "&brandShortName; submits crash reports to help &vendorShortName; make your browser more stable and secure">
@ -869,4 +870,4 @@ displayed when there are more than 3 actions available for a page.
See also https://bug1409261.bmoattachments.org/attachment.cgi?id=8919897 -->
<!ENTITY pwa_add_to_launcher_badge2 "Add to Home Screen">
<!ENTITY pwa_continue_to_website "Continue to Website">
<!ENTITY pwa_onboarding_sumo "You can easily add this website to your Home screen to have instant access and browse faster with an app-like experience.">
<!ENTITY pwa_onboarding_sumo "You can easily add this website to your Home screen to have instant access and browse faster with an app-like experience.">

Просмотреть файл

@ -337,6 +337,7 @@
<string name="datareporting_telemetry_summary">&datareporting_telemetry_summary;</string>
<string name="datareporting_fhr_title">&datareporting_fhr_title;</string>
<string name="datareporting_fhr_summary2">&datareporting_fhr_summary2;</string>
<string name="datareporting_abouthr_title">&datareporting_abouthr_title;</string>
<string name="datareporting_crashreporter_title_short">&datareporting_crashreporter_title_short;</string>
<string name="datareporting_crashreporter_summary">&datareporting_crashreporter_summary;</string>
<string name="datareporting_wifi_title">&datareporting_wifi_title2;</string>

Просмотреть файл

@ -0,0 +1,194 @@
// -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; js2-basic-offset: 2; js2-skip-preprocessor-directives: t; -*-
/* 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/. */
"use strict";
var { classes: Cc, interfaces: Ci, utils: Cu } = Components;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/SharedPreferences.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "EventDispatcher",
"resource://gre/modules/Messaging.jsm");
// Name of Android SharedPreference controlling whether to upload
// health reports.
const PREF_UPLOAD_ENABLED = "android.not_a_preference.healthreport.uploadEnabled";
// Name of Gecko Pref specifying report content location.
const PREF_REPORTURL = "datareporting.healthreport.about.reportUrl";
// Monotonically increasing wrapper API version number.
const WRAPPER_VERSION = 1;
const EVENT_HEALTH_REQUEST = "HealthReport:Request";
const EVENT_HEALTH_RESPONSE = "HealthReport:Response";
// about:healthreport prefs are stored in Firefox's default Android
// SharedPreferences.
var sharedPrefs = SharedPreferences.forApp();
var healthReportWrapper = {
init: function() {
let iframe = document.getElementById("remote-report");
iframe.addEventListener("load", healthReportWrapper.initRemotePage);
let report = this._getReportURI();
iframe.src = report.spec;
console.log("AboutHealthReport: loading content from " + report.spec);
sharedPrefs.addObserver(PREF_UPLOAD_ENABLED, this);
Services.obs.addObserver(this, EVENT_HEALTH_RESPONSE);
},
observe: function(subject, topic, data) {
if (topic == PREF_UPLOAD_ENABLED) {
this.updatePrefState();
} else if (topic == EVENT_HEALTH_RESPONSE) {
this.updatePayload(data);
}
},
uninit: function() {
sharedPrefs.removeObserver(PREF_UPLOAD_ENABLED, this);
Services.obs.removeObserver(this, EVENT_HEALTH_RESPONSE);
},
_getReportURI: function() {
let url = Services.urlFormatter.formatURLPref(PREF_REPORTURL);
// This handles URLs that already have query parameters.
let uri = Services.io.newURI(url).QueryInterface(Ci.nsIURL);
uri.query += ((uri.query != "") ? "&v=" : "v=") + WRAPPER_VERSION;
return uri;
},
onOptIn: function() {
console.log("AboutHealthReport: page sent opt-in command.");
sharedPrefs.setBoolPref(PREF_UPLOAD_ENABLED, true);
this.updatePrefState();
},
onOptOut: function() {
console.log("AboutHealthReport: page sent opt-out command.");
sharedPrefs.setBoolPref(PREF_UPLOAD_ENABLED, false);
this.updatePrefState();
},
updatePrefState: function() {
console.log("AboutHealthReport: sending pref state to page.");
try {
let prefs = {
enabled: sharedPrefs.getBoolPref(PREF_UPLOAD_ENABLED),
};
this.injectData("prefs", prefs);
} catch (e) {
this.reportFailure(this.ERROR_PREFS_FAILED);
}
},
refreshPayload: function() {
console.log("AboutHealthReport: page requested fresh payload.");
EventDispatcher.instance.sendRequest({
type: EVENT_HEALTH_REQUEST,
});
},
updatePayload: function(data) {
healthReportWrapper.injectData("payload", data);
// Data is supposed to be a string, so the length should be
// defined. Just in case, we do this after injecting the data.
console.log("AboutHealthReport: sending payload to page " +
"(" + typeof(data) + " of length " + data.length + ").");
},
injectData: function(type, content) {
let report = this._getReportURI();
// file: URIs can't be used for targetOrigin, so we use "*" for
// this special case. In all other cases, pass in the URL to the
// report so we properly restrict the message dispatch.
let reportUrl = (report.scheme == "file") ? "*" : report.spec;
let data = {
type: type,
content: content,
};
let iframe = document.getElementById("remote-report");
iframe.contentWindow.postMessage(data, reportUrl);
},
showSettings: function() {
console.log("AboutHealthReport: showing settings.");
EventDispatcher.instance.sendRequest({
type: "Settings:Show",
resource: "preferences_privacy",
});
},
launchUpdater: function() {
console.log("AboutHealthReport: launching updater.");
EventDispatcher.instance.sendRequest({
type: "Updater:Launch",
});
},
handleRemoteCommand: function(evt) {
switch (evt.detail.command) {
case "DisableDataSubmission":
this.onOptOut();
break;
case "EnableDataSubmission":
this.onOptIn();
break;
case "RequestCurrentPrefs":
this.updatePrefState();
break;
case "RequestCurrentPayload":
this.refreshPayload();
break;
case "ShowSettings":
this.showSettings();
break;
case "LaunchUpdater":
this.launchUpdater();
break;
default:
Cu.reportError("Unexpected remote command received: " + evt.detail.command +
". Ignoring command.");
break;
}
},
initRemotePage: function() {
let iframe = document.getElementById("remote-report").contentDocument;
iframe.addEventListener("RemoteHealthReportCommand",
function onCommand(e) { healthReportWrapper.handleRemoteCommand(e); });
healthReportWrapper.injectData("begin", null);
},
// error handling
ERROR_INIT_FAILED: 1,
ERROR_PAYLOAD_FAILED: 2,
ERROR_PREFS_FAILED: 3,
reportFailure: function(error) {
let details = {
errorType: error,
};
healthReportWrapper.injectData("error", details);
},
handleInitFailure: function() {
healthReportWrapper.reportFailure(healthReportWrapper.ERROR_INIT_FAILED);
},
handlePayloadFailure: function() {
healthReportWrapper.reportFailure(healthReportWrapper.ERROR_PAYLOAD_FAILED);
},
};
window.addEventListener("load", healthReportWrapper.init.bind(healthReportWrapper));
window.addEventListener("unload", healthReportWrapper.uninit.bind(healthReportWrapper));

Просмотреть файл

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
%brandDTD;
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
%globalDTD;
<!ENTITY % aboutHealthReportDTD SYSTEM "chrome://browser/locale/aboutHealthReport.dtd" >
%aboutHealthReportDTD;
]>
<!-- 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/. -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>&abouthealth.pagetitle;</title>
<link rel="icon" type="image/png" sizes="64x64"
href="chrome://branding/content/favicon64.png" />
<link rel="stylesheet"
href="chrome://browser/skin/aboutHealthReport.css"
type="text/css" />
<script type="text/javascript"
src="chrome://browser/content/aboutHealthReport.js" />
</head>
<body>
<iframe id="remote-report"/>
</body>
</html>

Просмотреть файл

@ -5533,7 +5533,7 @@ var IdentityHandler = {
return this.IDENTITY_MODE_IDENTIFIED;
}
let whitelist = /^about:(about|accounts|addons|buildconfig|cache|config|crashes|devices|downloads|fennec|firefox|feedback|home|license|logins|logo|memory|mozilla|networking|privatebrowsing|rights|serviceworkers|support|telemetry|webrtc)($|\?)/i;
let whitelist = /^about:(about|accounts|addons|buildconfig|cache|config|crashes|devices|downloads|fennec|firefox|feedback|healthreport|home|license|logins|logo|memory|mozilla|networking|privatebrowsing|rights|serviceworkers|support|telemetry|webrtc)($|\?)/i;
if (uri.schemeIs("about") && whitelist.test(uri.spec)) {
return this.IDENTITY_MODE_CHROMEUI;
}

Просмотреть файл

@ -0,0 +1,6 @@
#filter substitution
/* 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/. */
pref("datareporting.healthreport.about.reportUrl", "https://fhr.cdn.mozilla.net/%LOCALE%/mobile/");

Просмотреть файл

@ -43,6 +43,10 @@ chrome.jar:
content/Linkify.js (content/Linkify.js)
content/CastingApps.js (content/CastingApps.js)
content/RemoteDebugger.js (content/RemoteDebugger.js)
#ifdef MOZ_SERVICES_HEALTHREPORT
content/aboutHealthReport.xhtml (content/aboutHealthReport.xhtml)
content/aboutHealthReport.js (content/aboutHealthReport.js)
#endif
content/aboutAccounts.xhtml (content/aboutAccounts.xhtml)
content/aboutAccounts.js (content/aboutAccounts.js)
content/aboutLogins.xhtml (content/aboutLogins.xhtml)

Просмотреть файл

@ -72,6 +72,13 @@ var modules = {
},
};
if (AppConstants.MOZ_SERVICES_HEALTHREPORT) {
modules.healthreport = {
uri: "chrome://browser/content/aboutHealthReport.xhtml",
privileged: true
};
}
function AboutRedirector() {}
AboutRedirector.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]),

Просмотреть файл

@ -11,6 +11,9 @@ contract @mozilla.org/network/protocol/about;1?what=downloads {322ba47e-7047-4f7
contract @mozilla.org/network/protocol/about;1?what=reader {322ba47e-7047-4f71-aebf-cb7d69325cd9}
contract @mozilla.org/network/protocol/about;1?what=feedback {322ba47e-7047-4f71-aebf-cb7d69325cd9}
contract @mozilla.org/network/protocol/about;1?what=privatebrowsing {322ba47e-7047-4f71-aebf-cb7d69325cd9}
#ifdef MOZ_SERVICES_HEALTHREPORT
contract @mozilla.org/network/protocol/about;1?what=healthreport {322ba47e-7047-4f71-aebf-cb7d69325cd9}
#endif
contract @mozilla.org/network/protocol/about;1?what=blocked {322ba47e-7047-4f71-aebf-cb7d69325cd9}
contract @mozilla.org/network/protocol/about;1?what=accounts {322ba47e-7047-4f71-aebf-cb7d69325cd9}
contract @mozilla.org/network/protocol/about;1?what=logins {322ba47e-7047-4f71-aebf-cb7d69325cd9}

Просмотреть файл

@ -0,0 +1,6 @@
<!-- 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/. -->
<!-- LOCALIZATION NOTE (abouthealth.pagetitle): Firefox Health Report is a proper noun in en-US, please keep this in mind. -->
<!ENTITY abouthealth.pagetitle "&brandShortName; Health Report">

Просмотреть файл

@ -19,6 +19,9 @@
locale/@AB_CD@/browser/aboutHome.dtd (%chrome/aboutHome.dtd)
locale/@AB_CD@/browser/aboutHome.properties (%chrome/aboutHome.properties)
locale/@AB_CD@/browser/aboutPrivateBrowsing.dtd (%chrome/aboutPrivateBrowsing.dtd)
#ifdef MOZ_SERVICES_HEALTHREPORT
locale/@AB_CD@/browser/aboutHealthReport.dtd (%chrome/aboutHealthReport.dtd)
#endif
locale/@AB_CD@/browser/browser.properties (%chrome/browser.properties)
locale/@AB_CD@/browser/config.dtd (%chrome/config.dtd)
locale/@AB_CD@/browser/config.properties (%chrome/config.properties)

Просмотреть файл

@ -0,0 +1,15 @@
* {
margin: 0;
padding: 0;
}
html, body {
height: 100%;
}
#remote-report {
width: 100%;
height: 100%;
border: 0;
display: flex;
}

Просмотреть файл

@ -12,6 +12,9 @@ chrome.jar:
skin/aboutAddons.css (aboutAddons.css)
skin/aboutBase.css (aboutBase.css)
skin/aboutDownloads.css (aboutDownloads.css)
#ifdef MOZ_SERVICES_HEALTHREPORT
skin/aboutHealthReport.css (aboutHealthReport.css)
#endif
skin/aboutMemory.css (aboutMemory.css)
skin/aboutPrivateBrowsing.css (aboutPrivateBrowsing.css)
skin/aboutReader.css (aboutReader.css)

Просмотреть файл

@ -4,7 +4,9 @@
#include ../../toolkit/components/telemetry/datareporting-prefs.js
#endif
#ifdef MOZ_SERVICES_HEALTHREPORT
#if MOZ_WIDGET_TOOLKIT != android
#if MOZ_WIDGET_TOOLKIT == android
#include ../../mobile/android/chrome/content/healthreport-prefs.js
#else
#include ../../toolkit/components/telemetry/healthreport-prefs.js
#endif
#endif

Просмотреть файл

@ -1,7 +1,7 @@
use mozprofile::preferences::Pref;
lazy_static! {
pub static ref DEFAULT: [(&'static str, Pref); 80] = [
pub static ref DEFAULT: [(&'static str, Pref); 81] = [
// Disable automatic downloading of new releases
("app.update.auto", Pref::new(false)),
@ -118,6 +118,7 @@ lazy_static! {
// Do not show datareporting policy notifications which can
// interfere with tests
("datareporting.healthreport.about.reportUrl", Pref::new("http://%(server)s/dummy/abouthealthreport/")),
("datareporting.healthreport.documentServerURI", Pref::new("http://%(server)s/dummy/healthreport/")),
("datareporting.healthreport.logging.consoleEnabled", Pref::new(false)),
("datareporting.healthreport.service.enabled", Pref::new(false)),

Просмотреть файл

@ -27,6 +27,7 @@ class GeckoInstance(object):
# Do not send Firefox health reports to the production server
"datareporting.healthreport.documentServerURI": "http://%(server)s/dummy/healthreport/",
"datareporting.healthreport.about.reportUrl": "http://%(server)s/dummy/abouthealthreport/",
# Do not show datareporting policy notifications which can interfer with tests
"datareporting.policy.dataSubmissionPolicyBypassNotification": True,

Просмотреть файл

@ -200,6 +200,10 @@ const RECOMMENDED_PREFS = new Map([
// Do not show datareporting policy notifications which can
// interfere with tests
[
"datareporting.healthreport.about.reportUrl",
"http://%(server)s/dummy/abouthealthreport/",
],
[
"datareporting.healthreport.documentServerURI",
"http://%(server)s/dummy/healthreport/",

Просмотреть файл

@ -174,6 +174,10 @@ const RECOMMENDED_PREFS = new Map([
// Do not show datareporting policy notifications which can
// interfere with tests
[
"datareporting.healthreport.about.reportUrl",
"http://%(server)s/dummy/abouthealthreport/",
],
[
"datareporting.healthreport.documentServerURI",
"http://%(server)s/dummy/healthreport/",

Просмотреть файл

@ -170,6 +170,7 @@ user_pref("datareporting.policy.dataSubmissionPolicyBypassNotification", true);
// Point Firefox Health Report at a local server. We don't care if it actually
// works. It just can't hit the default production endpoint.
user_pref("datareporting.healthreport.documentServerURI", "http://%(server)s/healthreport/");
user_pref("datareporting.healthreport.about.reportUrl", "http://%(server)s/abouthealthreport/v4/");
// Make sure CSS error reporting is enabled for tests
user_pref("layout.css.report_errors", true);

Просмотреть файл

@ -181,6 +181,8 @@ DEFAULTS = dict(
'browser.contentHandlers.types.4.uri': 'http://127.0.0.1/rss?url=%s',
'browser.contentHandlers.types.5.uri': 'http://127.0.0.1/rss?url=%s',
'identity.fxaccounts.auth.uri': 'https://127.0.0.1/fxa-dummy/',
'datareporting.healthreport.about.reportUrl':
'http://127.0.0.1/abouthealthreport/',
'datareporting.healthreport.documentServerURI':
'http://127.0.0.1/healthreport/',
'datareporting.policy.dataSubmissionPolicyBypassNotification': True,

Просмотреть файл

@ -28,7 +28,10 @@ mozconfig Defines
When Defined (which it is on most platforms):
* includes ``toolkit/components/telemetry/healthreport-prefs.js`` (which sets ``datareporting.healthreport.{infoURL|uploadEnabled}``)
* Builds ``about:healthreport`` and associated underpinnings (see `healthreport <../fhr/index>`)
* Desktop: includes ``toolkit/components/telemetry/healthreport-prefs.js`` (which sets ``datareporting.healthreport.{infoURL|uploadEnabled|about.reportUrl}``)
* Android: enables ``datareporting.healthreport.uploadEnabled`` (which is unused on Android)
* Android: includes ``mobile/android/chrome/content/healthreport-prefs.js`` (which sets ``datareporting.healthreport.about.reportUrl``)
``MOZ_DATA_REPORTING``

Просмотреть файл

@ -8,3 +8,5 @@ pref("datareporting.healthreport.infoURL", "https://www.mozilla.org/legal/privac
// Health Report is enabled by default on all channels.
pref("datareporting.healthreport.uploadEnabled", true);
pref("datareporting.healthreport.about.reportUrl", "https://fhr.cdn.mozilla.net/%LOCALE%/v4/");