зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1279195 - Update error doc URLs and add GA parameters; r=bgrins
This commit is contained in:
Родитель
28a5659e30
Коммит
d33e806413
|
@ -316,7 +316,7 @@ JSTerm.prototype = {
|
||||||
errorDocLink = this.hud.document.createElementNS(XHTML_NS, "a");
|
errorDocLink = this.hud.document.createElementNS(XHTML_NS, "a");
|
||||||
errorDocLink.className = "learn-more-link webconsole-learn-more-link";
|
errorDocLink.className = "learn-more-link webconsole-learn-more-link";
|
||||||
errorDocLink.textContent = `[${l10n.getStr("webConsoleMoreInfoLabel")}]`;
|
errorDocLink.textContent = `[${l10n.getStr("webConsoleMoreInfoLabel")}]`;
|
||||||
errorDocLink.title = errorDocURL;
|
errorDocLink.title = errorDocURL.split("?")[0];
|
||||||
errorDocLink.href = "#";
|
errorDocLink.href = "#";
|
||||||
errorDocLink.draggable = false;
|
errorDocLink.draggable = false;
|
||||||
errorDocLink.addEventListener("click", () => {
|
errorDocLink.addEventListener("click", () => {
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
|
|
||||||
const TEST_URI = "https://example.com/browser/devtools/client/webconsole/" +
|
const TEST_URI = "https://example.com/browser/devtools/client/webconsole/" +
|
||||||
"test/test-mixedcontent-securityerrors.html";
|
"test/test-mixedcontent-securityerrors.html";
|
||||||
const LEARN_MORE_URI = "https://developer.mozilla.org/docs/Security/" +
|
const LEARN_MORE_URI = "https://developer.mozilla.org/docs/Web/Security/" +
|
||||||
"MixedContent";
|
"Mixed_content" + DOCS_GA_PARAMS;
|
||||||
|
|
||||||
add_task(function* () {
|
add_task(function* () {
|
||||||
yield pushPrefEnv();
|
yield pushPrefEnv();
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
|
|
||||||
const TEST_URI = "https://example.com/browser/devtools/client/webconsole/" +
|
const TEST_URI = "https://example.com/browser/devtools/client/webconsole/" +
|
||||||
"test/test-mixedcontent-securityerrors.html";
|
"test/test-mixedcontent-securityerrors.html";
|
||||||
const LEARN_MORE_URI = "https://developer.mozilla.org/docs/Security/" +
|
const LEARN_MORE_URI = "https://developer.mozilla.org/docs/Web/Security/" +
|
||||||
"MixedContent";
|
"Mixed_content" + DOCS_GA_PARAMS;
|
||||||
|
|
||||||
add_task(function* () {
|
add_task(function* () {
|
||||||
yield pushPrefEnv();
|
yield pushPrefEnv();
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
const TEST_URI = "data:text/html;charset=utf8,Web Console mixed content test";
|
const TEST_URI = "data:text/html;charset=utf8,Web Console mixed content test";
|
||||||
const TEST_HTTPS_URI = "https://example.com/browser/devtools/client/" +
|
const TEST_HTTPS_URI = "https://example.com/browser/devtools/client/" +
|
||||||
"webconsole/test/test-bug-737873-mixedcontent.html";
|
"webconsole/test/test-bug-737873-mixedcontent.html";
|
||||||
const LEARN_MORE_URI = "https://developer.mozilla.org/docs/Security/" +
|
const LEARN_MORE_URI = "https://developer.mozilla.org/docs/Web/Security/" +
|
||||||
"MixedContent";
|
"Mixed_content";
|
||||||
|
|
||||||
add_task(function* () {
|
add_task(function* () {
|
||||||
Services.prefs.setBoolPref("security.mixed_content.block_display_content",
|
Services.prefs.setBoolPref("security.mixed_content.block_display_content",
|
||||||
|
|
|
@ -19,8 +19,8 @@ const INSECURE_FORM_ACTION_MSG = "Password fields present in a form with an " +
|
||||||
const INSECURE_IFRAME_MSG = "Password fields present on an insecure " +
|
const INSECURE_IFRAME_MSG = "Password fields present on an insecure " +
|
||||||
"(http://) iframe. This is a security risk that allows " +
|
"(http://) iframe. This is a security risk that allows " +
|
||||||
"user login credentials to be stolen.";
|
"user login credentials to be stolen.";
|
||||||
const INSECURE_PASSWORDS_URI = "https://developer.mozilla.org/docs/Security/" +
|
const INSECURE_PASSWORDS_URI = "https://developer.mozilla.org/docs/Web/" +
|
||||||
"InsecurePasswords";
|
"Security/Insecure_passwords" + DOCS_GA_PARAMS;
|
||||||
|
|
||||||
add_task(function* () {
|
add_task(function* () {
|
||||||
yield loadTab(TEST_URI);
|
yield loadTab(TEST_URI);
|
||||||
|
|
|
@ -13,7 +13,7 @@ const TEST_URI = "data:text/html;charset=utf-8,Web Console HPKP invalid " +
|
||||||
const SJS_URL = "https://example.com/browser/devtools/client/webconsole/" +
|
const SJS_URL = "https://example.com/browser/devtools/client/webconsole/" +
|
||||||
"test/test_hpkp-invalid-headers.sjs";
|
"test/test_hpkp-invalid-headers.sjs";
|
||||||
const LEARN_MORE_URI = "https://developer.mozilla.org/docs/Web/Security/" +
|
const LEARN_MORE_URI = "https://developer.mozilla.org/docs/Web/Security/" +
|
||||||
"Public_Key_Pinning";
|
"Public_Key_Pinning" + DOCS_GA_PARAMS;
|
||||||
const NON_BUILTIN_ROOT_PREF = "security.cert_pinning.process_headers_from_" +
|
const NON_BUILTIN_ROOT_PREF = "security.cert_pinning.process_headers_from_" +
|
||||||
"non_builtin_roots";
|
"non_builtin_roots";
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,8 @@ const TEST_URI = "data:text/html;charset=utf-8,Web Console HSTS invalid " +
|
||||||
"header test";
|
"header test";
|
||||||
const SJS_URL = "https://example.com/browser/devtools/client/webconsole/" +
|
const SJS_URL = "https://example.com/browser/devtools/client/webconsole/" +
|
||||||
"test/test_hsts-invalid-headers.sjs";
|
"test/test_hsts-invalid-headers.sjs";
|
||||||
const LEARN_MORE_URI = "https://developer.mozilla.org/docs/Security/" +
|
const LEARN_MORE_URI = "https://developer.mozilla.org/docs/Web/Security/" +
|
||||||
"HTTP_Strict_Transport_Security";
|
"HTTP_strict_transport_security" + DOCS_GA_PARAMS;
|
||||||
|
|
||||||
add_task(function* () {
|
add_task(function* () {
|
||||||
yield loadTab(TEST_URI);
|
yield loadTab(TEST_URI);
|
||||||
|
|
|
@ -180,13 +180,13 @@ function* testJSTerm(hud) {
|
||||||
};
|
};
|
||||||
|
|
||||||
for (let errorMessageName of Object.keys(ErrorDocStatements)) {
|
for (let errorMessageName of Object.keys(ErrorDocStatements)) {
|
||||||
let url = ErrorDocs.GetURL({ errorMessageName });
|
let title = ErrorDocs.GetURL({ errorMessageName }).split("?")[0];
|
||||||
|
|
||||||
jsterm.clearOutput();
|
jsterm.clearOutput();
|
||||||
yield jsterm.execute(ErrorDocStatements[errorMessageName]);
|
yield jsterm.execute(ErrorDocStatements[errorMessageName]);
|
||||||
yield checkResult((node) => {
|
yield checkResult((node) => {
|
||||||
return node.parentNode.getElementsByTagName("a")[0].title == url;
|
return node.parentNode.getElementsByTagName("a")[0].title == title;
|
||||||
}, `error links to ${url}`);
|
}, `error links to ${title}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure that dom errors, with error numbers outside of the range
|
// Ensure that dom errors, with error numbers outside of the range
|
||||||
|
|
|
@ -8,9 +8,12 @@
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const TEST_URI = "http://tracking.example.org/browser/devtools/client/webconsole/test/test-trackingprotection-securityerrors.html";
|
const TEST_URI = "http://tracking.example.org/browser/devtools/client/" +
|
||||||
const LEARN_MORE_URI = "https://developer.mozilla.org/Firefox/Privacy/Tracking_Protection";
|
"webconsole/test/test-trackingprotection-securityerrors.html";
|
||||||
|
const LEARN_MORE_URI = "https://developer.mozilla.org/Firefox/Privacy/" +
|
||||||
|
"Tracking_Protection" + DOCS_GA_PARAMS;
|
||||||
const PREF = "privacy.trackingprotection.enabled";
|
const PREF = "privacy.trackingprotection.enabled";
|
||||||
|
|
||||||
const {UrlClassifierTestUtils} = Cu.import("resource://testing-common/UrlClassifierTestUtils.jsm", {});
|
const {UrlClassifierTestUtils} = Cu.import("resource://testing-common/UrlClassifierTestUtils.jsm", {});
|
||||||
|
|
||||||
registerCleanupFunction(function () {
|
registerCleanupFunction(function () {
|
||||||
|
@ -31,7 +34,8 @@ add_task(function* testMessagesAppear() {
|
||||||
messages: [
|
messages: [
|
||||||
{
|
{
|
||||||
name: "Was blocked because tracking protection is enabled",
|
name: "Was blocked because tracking protection is enabled",
|
||||||
text: "The resource at \u201chttp://tracking.example.com/\u201d was blocked because tracking protection is enabled",
|
text: "The resource at \u201chttp://tracking.example.com/\u201d was " +
|
||||||
|
"blocked because tracking protection is enabled",
|
||||||
category: CATEGORY_SECURITY,
|
category: CATEGORY_SECURITY,
|
||||||
severity: SEVERITY_WARNING,
|
severity: SEVERITY_WARNING,
|
||||||
objects: true,
|
objects: true,
|
||||||
|
|
|
@ -41,6 +41,10 @@ const WEBCONSOLE_STRINGS_URI = "chrome://devtools/locale/" +
|
||||||
"webconsole.properties";
|
"webconsole.properties";
|
||||||
var WCUL10n = new WebConsoleUtils.L10n(WEBCONSOLE_STRINGS_URI);
|
var WCUL10n = new WebConsoleUtils.L10n(WEBCONSOLE_STRINGS_URI);
|
||||||
|
|
||||||
|
const DOCS_GA_PARAMS = "?utm_source=mozilla" +
|
||||||
|
"&utm_medium=firefox-console-errors" +
|
||||||
|
"&utm_campaign=default";
|
||||||
|
|
||||||
DevToolsUtils.testing = true;
|
DevToolsUtils.testing = true;
|
||||||
|
|
||||||
function loadTab(url) {
|
function loadTab(url) {
|
||||||
|
|
|
@ -44,7 +44,7 @@ var l10n = new WebConsoleUtils.L10n(STRINGS_URI);
|
||||||
|
|
||||||
const XHTML_NS = "http://www.w3.org/1999/xhtml";
|
const XHTML_NS = "http://www.w3.org/1999/xhtml";
|
||||||
|
|
||||||
const MIXED_CONTENT_LEARN_MORE = "https://developer.mozilla.org/docs/Security/MixedContent";
|
const MIXED_CONTENT_LEARN_MORE = "https://developer.mozilla.org/docs/Web/Security/Mixed_content";
|
||||||
|
|
||||||
const IGNORED_SOURCE_URLS = ["debugger eval code"];
|
const IGNORED_SOURCE_URLS = ["debugger eval code"];
|
||||||
|
|
||||||
|
@ -1675,7 +1675,7 @@ WebConsoleFrame.prototype = {
|
||||||
let moreInfoLabel = "[" + l10n.getStr("webConsoleMoreInfoLabel") + "]";
|
let moreInfoLabel = "[" + l10n.getStr("webConsoleMoreInfoLabel") + "]";
|
||||||
|
|
||||||
let warningNode = this.document.createElementNS(XHTML_NS, "a");
|
let warningNode = this.document.createElementNS(XHTML_NS, "a");
|
||||||
warningNode.title = url;
|
warningNode.title = url.split("?")[0];
|
||||||
warningNode.href = url;
|
warningNode.href = url;
|
||||||
warningNode.draggable = false;
|
warningNode.draggable = false;
|
||||||
warningNode.textContent = moreInfoLabel;
|
warningNode.textContent = moreInfoLabel;
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const baseURL = "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/";
|
const baseURL = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Errors/";
|
||||||
|
const params = "?utm_source=mozilla&utm_medium=firefox-console-errors&utm_campaign=default";
|
||||||
const ErrorDocs = {
|
const ErrorDocs = {
|
||||||
JSMSG_READ_ONLY: "Read-only",
|
JSMSG_READ_ONLY: "Read-only",
|
||||||
JSMSG_BAD_ARRAY_LENGTH: "Invalid_array_length",
|
JSMSG_BAD_ARRAY_LENGTH: "Invalid_array_length",
|
||||||
|
@ -49,12 +50,12 @@ const ErrorDocs = {
|
||||||
JSMSG_CURLY_AFTER_LIST: "Missing_curly_after_property_list",
|
JSMSG_CURLY_AFTER_LIST: "Missing_curly_after_property_list",
|
||||||
};
|
};
|
||||||
|
|
||||||
const MIXED_CONTENT_LEARN_MORE = "https://developer.mozilla.org/docs/Security/MixedContent";
|
const MIXED_CONTENT_LEARN_MORE = "https://developer.mozilla.org/docs/Web/Security/Mixed_content";
|
||||||
const TRACKING_PROTECTION_LEARN_MORE = "https://developer.mozilla.org/Firefox/Privacy/Tracking_Protection";
|
const TRACKING_PROTECTION_LEARN_MORE = "https://developer.mozilla.org/Firefox/Privacy/Tracking_Protection";
|
||||||
const INSECURE_PASSWORDS_LEARN_MORE = "https://developer.mozilla.org/docs/Security/InsecurePasswords";
|
const INSECURE_PASSWORDS_LEARN_MORE = "https://developer.mozilla.org/docs/Web/Security/Insecure_passwords";
|
||||||
const PUBLIC_KEY_PINS_LEARN_MORE = "https://developer.mozilla.org/docs/Web/Security/Public_Key_Pinning";
|
const PUBLIC_KEY_PINS_LEARN_MORE = "https://developer.mozilla.org/docs/Web/Security/Public_Key_Pinning";
|
||||||
const STRICT_TRANSPORT_SECURITY_LEARN_MORE = "https://developer.mozilla.org/docs/Security/HTTP_Strict_Transport_Security";
|
const STRICT_TRANSPORT_SECURITY_LEARN_MORE = "https://developer.mozilla.org/docs/Web/Security/HTTP_strict_transport_security";
|
||||||
const WEAK_SIGNATURE_ALGORITHM_LEARN_MORE = "https://developer.mozilla.org/docs/Security/Weak_Signature_Algorithm";
|
const WEAK_SIGNATURE_ALGORITHM_LEARN_MORE = "https://developer.mozilla.org/docs/Web/Security/Weak_Signature_Algorithm";
|
||||||
const ErrorCategories = {
|
const ErrorCategories = {
|
||||||
"Insecure Password Field": INSECURE_PASSWORDS_LEARN_MORE,
|
"Insecure Password Field": INSECURE_PASSWORDS_LEARN_MORE,
|
||||||
"Mixed Content Message": MIXED_CONTENT_LEARN_MORE,
|
"Mixed Content Message": MIXED_CONTENT_LEARN_MORE,
|
||||||
|
@ -72,11 +73,11 @@ exports.GetURL = (error) => {
|
||||||
|
|
||||||
let doc = ErrorDocs[error.errorMessageName];
|
let doc = ErrorDocs[error.errorMessageName];
|
||||||
if (doc) {
|
if (doc) {
|
||||||
return baseURL + doc;
|
return baseURL + doc + params;
|
||||||
}
|
}
|
||||||
|
|
||||||
let categoryURL = ErrorCategories[error.category];
|
let categoryURL = ErrorCategories[error.category];
|
||||||
if (categoryURL) {
|
if (categoryURL) {
|
||||||
return categoryURL;
|
return categoryURL + params;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Загрузка…
Ссылка в новой задаче