tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 23de81b2e543adfdc48d9f095eee12e6271c1b9e
parent 27f4f8868129f4aa133d2c60abad61aa2ff4419c
Author: Nicolas Chevobbe <nchevobbe@mozilla.com>
Date:   Thu, 11 Dec 2025 10:45:57 +0000

Bug 2002203 - [devtools] Make utm params for MDN links more consistent over the codebase. r=devtools-reviewers,ochameau

Differential Revision: https://phabricator.services.mozilla.com/D275771

Diffstat:
Mdevtools/client/accessibility/constants.js | 15++++++++++-----
Mdevtools/client/accessibility/test/chrome/contrast.snapshots.js | 6+++---
Mdevtools/client/application/src/components/manifest/ManifestEmpty.js | 7+++++--
Mdevtools/client/application/src/components/service-workers/RegistrationListEmpty.js | 8+++++---
Mdevtools/client/inspector/compatibility/components/IssueItem.js | 9++++-----
Mdevtools/client/inspector/computed/computed.js | 8+++++---
Mdevtools/client/netmonitor/src/utils/doc-utils.js | 6++++--
Mdevtools/client/netmonitor/test/xpcshell/test_doc-utils.js | 12++++++------
Mdevtools/client/shared/widgets/tooltip/inactive-css-tooltip-helper.js | 12+++++++-----
Mdevtools/client/webconsole/test/browser/head.js | 4++--
Mdevtools/client/webconsole/test/node/fixtures/stubs/evaluationResult.js | 124++++++++++++++++++++++++++++++++++++++++----------------------------------------
Mdevtools/client/webconsole/test/node/fixtures/stubs/pageError.js | 18+++++++++---------
Mdevtools/server/actors/errordocs.js | 13++++++++-----
Mdevtools/shared/commands/resource/tests/browser_resources_error_messages.js | 6+++++-
Adevtools/shared/mdn.mjs | 17+++++++++++++++++
Mdevtools/shared/moz.build | 1+
16 files changed, 153 insertions(+), 113 deletions(-)

diff --git a/devtools/client/accessibility/constants.js b/devtools/client/accessibility/constants.js @@ -39,6 +39,10 @@ const { }, } = require("resource://devtools/shared/constants.js"); +const { getMdnLinkParams } = ChromeUtils.importESModule( + "resource://devtools/shared/mdn.mjs" +); + // Used in accessible component for properties tree rendering. exports.TREE_ROW_HEIGHT = 21; @@ -117,13 +121,14 @@ exports.A11Y_LEARN_MORE_LINK = "https://firefox-source-docs.mozilla.org/devtools-user/accessibility_inspector/"; exports.A11Y_CONTRAST_LEARN_MORE_LINK = "https://developer.mozilla.org/docs/Web/Accessibility/Guides/Understanding_WCAG/Perceivable/" + - "Color_contrast?utm_source=devtools&utm_medium=a11y-panel-checks-color-contrast"; + "Color_contrast?" + + getMdnLinkParams("a11y-panel-checks-color-contrast"); exports.A11Y_SIMULATION_DOCUMENTATION_LINK = "https://firefox-source-docs.mozilla.org/devtools-user/accessibility_inspector/simulation/"; const A11Y_TEXT_LABEL_LINK_BASE = - "https://developer.mozilla.org/docs/Web/Accessibility/Guides/Understanding_WCAG/Text_labels_and_names" + - "?utm_source=devtools&utm_medium=a11y-panel-checks-text-label"; + "https://developer.mozilla.org/docs/Web/Accessibility/Guides/Understanding_WCAG/Text_labels_and_names?" + + getMdnLinkParams("a11y-panel-checks-text-label"); const A11Y_TEXT_LABEL_LINK_IDS = { [AREA_NO_NAME_FROM_ALT]: @@ -157,8 +162,8 @@ for (const key in A11Y_TEXT_LABEL_LINK_IDS) { exports.A11Y_TEXT_LABEL_LINKS = A11Y_TEXT_LABEL_LINKS; const A11Y_KEYBOARD_LINK_BASE = - "https://developer.mozilla.org/docs/Web/Accessibility/Guides/Understanding_WCAG/Keyboard" + - "?utm_source=devtools&utm_medium=a11y-panel-checks-keyboard"; + "https://developer.mozilla.org/docs/Web/Accessibility/Guides/Understanding_WCAG/Keyboard?" + + getMdnLinkParams("a11y-panel-checks-keyboard"); const A11Y_KEYBOARD_LINK_IDS = { [FOCUSABLE_NO_SEMANTICS]: diff --git a/devtools/client/accessibility/test/chrome/contrast.snapshots.js b/devtools/client/accessibility/test/chrome/contrast.snapshots.js @@ -90,7 +90,7 @@ window._snapshots = { href: "https://developer.mozilla.org/docs/Web/Accessibility/Guides/" + "Understanding_WCAG/Perceivable/Color_contrast?utm_source=" + - "devtools&utm_medium=a11y-panel-checks-color-contrast", + "devtools&utm_medium=a11y-panel-checks-color-contrast&utm_campaign=default", onClick: "openDocOnClick(event) {\n event.preventDefault();\n " + "openDocLink(event.target.href);\n }", @@ -174,7 +174,7 @@ window._snapshots = { href: "https://developer.mozilla.org/docs/Web/Accessibility/Guides/" + "Understanding_WCAG/Perceivable/Color_contrast?utm_source=" + - "devtools&utm_medium=a11y-panel-checks-color-contrast", + "devtools&utm_medium=a11y-panel-checks-color-contrast&utm_campaign=default", onClick: "openDocOnClick(event) {\n event.preventDefault();\n " + "openDocLink(event.target.href);\n }", @@ -247,7 +247,7 @@ window._snapshots = { href: "https://developer.mozilla.org/docs/Web/Accessibility/Guides/" + "Understanding_WCAG/Perceivable/Color_contrast?utm_source=" + - "devtools&utm_medium=a11y-panel-checks-color-contrast", + "devtools&utm_medium=a11y-panel-checks-color-contrast&utm_campaign=default", onClick: "openDocOnClick(event) {\n event.preventDefault();\n " + "openDocLink(event.target.href);\n }", diff --git a/devtools/client/application/src/components/manifest/ManifestEmpty.js b/devtools/client/application/src/components/manifest/ManifestEmpty.js @@ -23,9 +23,12 @@ const { const FluentReact = require("resource://devtools/client/shared/vendor/fluent-react.js"); const Localized = createFactory(FluentReact.Localized); +const { getMdnLinkParams } = ChromeUtils.importESModule( + "resource://devtools/shared/mdn.mjs" +); const DOC_URL = - "https://developer.mozilla.org/en-US/docs/Web/Manifest" + - "?utm_source=devtools&utm_medium=sw-panel-blank"; + "https://developer.mozilla.org/docs/Web/Progressive_web_apps/Manifest?" + + getMdnLinkParams("sw-panel-blank"); /** * This component displays help information when no manifest is found for the diff --git a/devtools/client/application/src/components/service-workers/RegistrationListEmpty.js b/devtools/client/application/src/components/service-workers/RegistrationListEmpty.js @@ -28,10 +28,12 @@ const Localized = createFactory(FluentReact.Localized); const { services, } = require("resource://devtools/client/application/src/modules/application-services.js"); - +const { getMdnLinkParams } = ChromeUtils.importESModule( + "resource://devtools/shared/mdn.mjs" +); const DOC_URL = - "https://developer.mozilla.org/docs/Web/API/Service_Worker_API/Using_Service_Workers" + - "?utm_source=devtools&utm_medium=sw-panel-blank"; + "https://developer.mozilla.org/docs/Web/API/Service_Worker_API/Using_Service_Workers?" + + getMdnLinkParams("sw-panel-blank"); /** * This component displays help information when no service workers are found for the diff --git a/devtools/client/inspector/compatibility/components/IssueItem.js b/devtools/client/inspector/compatibility/components/IssueItem.js @@ -39,11 +39,10 @@ loader.lazyRequireGetter( true ); -const MDN_LINK_PARAMS = new URLSearchParams({ - utm_source: "devtools", - utm_medium: "inspector-compatibility", - utm_campaign: "default", -}); +const { getMdnLinkParams } = ChromeUtils.importESModule( + "resource://devtools/shared/mdn.mjs" +); +const MDN_LINK_PARAMS = getMdnLinkParams("inspector-compatibility"); class IssueItem extends PureComponent { static get propTypes() { diff --git a/devtools/client/inspector/computed/computed.js b/devtools/client/inspector/computed/computed.js @@ -46,6 +46,10 @@ loader.lazyRequireGetter( "resource://devtools/client/shared/link.js", true ); +const lazy = {}; +ChromeUtils.defineESModuleGetters(lazy, { + getMdnLinkParams: "resource://devtools/shared/mdn.mjs", +}); const STYLE_INSPECTOR_PROPERTIES = "devtools/shared/locales/styleinspector.properties"; @@ -1040,9 +1044,7 @@ class PropertyView { this.isCustomProperty = isCustomProperty; if (!this.isCustomProperty) { - this.link = - "https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/" + - name; + this.link = `https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/${name}?${lazy.getMdnLinkParams("computed-panel")}`; } this.#propertyInfo = new PropertyInfo(tree, name); diff --git a/devtools/client/netmonitor/src/utils/doc-utils.js b/devtools/client/netmonitor/src/utils/doc-utils.js @@ -7,7 +7,9 @@ const { SUPPORTED_HTTP_CODES, } = require("resource://devtools/client/netmonitor/src/constants.js"); - +const { getMdnLinkParams } = ChromeUtils.importESModule( + "resource://devtools/shared/mdn.mjs" +); /** * A mapping of header names to external documentation. Any header included * here will show a MDN link alongside it. @@ -125,7 +127,7 @@ const SUPPORTED_HEADERS = [ const MDN_URL = "https://developer.mozilla.org/docs/"; const MDN_STATUS_CODES_LIST_URL = `${MDN_URL}Web/HTTP/Reference/Status`; const getGAParams = (panelId = "netmonitor") => { - return `?utm_source=mozilla&utm_medium=devtools-${panelId}&utm_campaign=default`; + return `?` + getMdnLinkParams(`devtools-${panelId}`); }; // Base URL to DevTools user docs diff --git a/devtools/client/netmonitor/test/xpcshell/test_doc-utils.js b/devtools/client/netmonitor/test/xpcshell/test_doc-utils.js @@ -9,13 +9,13 @@ function run_test() { const { require } = ChromeUtils.importESModule( "resource://devtools/shared/loader/Loader.sys.mjs" ); + const { getMdnLinkParams } = ChromeUtils.importESModule( + "resource://devtools/shared/mdn.mjs" + ); + const MDN_URL = "https://developer.mozilla.org/docs/"; - const GTM_PARAMS_NM = - "?utm_source=mozilla" + - "&utm_medium=devtools-netmonitor&utm_campaign=default"; - const GTM_PARAMS_WC = - "?utm_source=mozilla" + - "&utm_medium=devtools-webconsole&utm_campaign=default"; + const GTM_PARAMS_NM = `?${getMdnLinkParams("devtools-netmonitor")}`; + const GTM_PARAMS_WC = `?${getMdnLinkParams("devtools-webconsole")}`; const USER_DOC_URL = "https://firefox-source-docs.mozilla.org/devtools-user/"; const { diff --git a/devtools/client/shared/widgets/tooltip/inactive-css-tooltip-helper.js b/devtools/client/shared/widgets/tooltip/inactive-css-tooltip-helper.js @@ -10,6 +10,9 @@ loader.lazyRequireGetter( "resource://devtools/client/shared/link.js", true ); +const { getMdnLinkParams } = ChromeUtils.importESModule( + "resource://devtools/shared/mdn.mjs" +); class InactiveCssTooltipHelper { constructor() { @@ -61,13 +64,12 @@ class InactiveCssTooltipHelper { const { doc } = tooltip; const documentUrl = new URL( - learnMoreURL || - `https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/${property}` + (learnMoreURL || + `https://developer.mozilla.org/docs/Web/CSS/Reference/Properties/${property}`) + + "?" + + getMdnLinkParams("inspector-inactive-css") ); this._currentTooltip = tooltip; - const { searchParams } = documentUrl; - searchParams.append("utm_source", "devtools"); - searchParams.append("utm_medium", "inspector-inactive-css"); this._currentUrl = documentUrl.toString(); const templateNode = doc.createElementNS(XHTML_NS, "template"); diff --git a/devtools/client/webconsole/test/browser/head.js b/devtools/client/webconsole/test/browser/head.js @@ -29,12 +29,12 @@ var { var WCUL10n = require("resource://devtools/client/webconsole/utils/l10n.js"); const DOCS_GA_PARAMS = `?${new URLSearchParams({ - utm_source: "mozilla", + utm_source: "devtools", utm_medium: "firefox-console-errors", utm_campaign: "default", })}`; const GA_PARAMS = `?${new URLSearchParams({ - utm_source: "mozilla", + utm_source: "devtools", utm_medium: "devtools-webconsole", utm_campaign: "default", })}`; diff --git a/devtools/client/webconsole/test/node/fixtures/stubs/evaluationResult.js b/devtools/client/webconsole/test/node/fixtures/stubs/evaluationResult.js @@ -25,7 +25,7 @@ rawPackets.set(`new Date(0)`, { "result": { "_grip": { "type": "object", - "actor": "server0.conn0.windowGlobal12884901889/obj20", + "actor": "server0.conn0.watcher2.process2//obj21", "class": "Date", "ownPropertyLength": 0, "extensible": true, @@ -36,7 +36,7 @@ rawPackets.set(`new Date(0)`, { "timestamp": 0 } }, - "actorID": "server0.conn0.windowGlobal12884901889/obj20" + "actorID": "server0.conn0.watcher2.process2//obj21" }, "startTime": 1572867483805, "timestamp": 1572867483805 @@ -48,7 +48,7 @@ rawPackets.set(`asdf()`, { "exception": { "_grip": { "type": "object", - "actor": "server0.conn0.windowGlobal12884901889/obj22", + "actor": "server0.conn0.watcher2.process2//obj23", "class": "ReferenceError", "ownPropertyLength": 4, "extensible": true, @@ -65,10 +65,10 @@ rawPackets.set(`asdf()`, { "columnNumber": 1 } }, - "actorID": "server0.conn0.windowGlobal12884901889/obj22" + "actorID": "server0.conn0.watcher2.process2//obj23" }, "exceptionMessage": "ReferenceError: asdf is not defined", - "exceptionDocURL": "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Errors/Not_defined?utm_source=mozilla&utm_medium=firefox-console-errors&utm_campaign=default", + "exceptionDocURL": "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Errors/Not_defined?utm_source=devtools&utm_medium=firefox-console-errors&utm_campaign=default", "exceptionStack": [ { "filename": "debugger eval code", @@ -98,7 +98,7 @@ rawPackets.set(`1 + @`, { "exception": { "_grip": { "type": "object", - "actor": "server0.conn0.windowGlobal12884901889/obj23", + "actor": "server0.conn0.watcher2.process2//obj24", "class": "SyntaxError", "ownPropertyLength": 4, "extensible": true, @@ -115,10 +115,10 @@ rawPackets.set(`1 + @`, { "columnNumber": 5 } }, - "actorID": "server0.conn0.windowGlobal12884901889/obj23" + "actorID": "server0.conn0.watcher2.process2//obj24" }, "exceptionMessage": "SyntaxError: illegal character U+0040", - "exceptionDocURL": "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Errors/Illegal_character?utm_source=mozilla&utm_medium=firefox-console-errors&utm_campaign=default", + "exceptionDocURL": "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Errors/Illegal_character?utm_source=devtools&utm_medium=firefox-console-errors&utm_campaign=default", "hasException": true, "frame": { "source": "debugger eval code", @@ -142,7 +142,7 @@ rawPackets.set(`inspect({a: 1})`, { "object": { "_grip": { "type": "object", - "actor": "server0.conn0.windowGlobal12884901889/obj25", + "actor": "server0.conn0.watcher2.process2//obj26", "class": "Object", "ownPropertyLength": 1, "extensible": true, @@ -162,7 +162,7 @@ rawPackets.set(`inspect({a: 1})`, { "ownPropertiesLength": 1 } }, - "actorID": "server0.conn0.windowGlobal12884901889/obj25" + "actorID": "server0.conn0.watcher2.process2//obj26" }, "forceExpandInConsole": false }, @@ -190,7 +190,7 @@ rawPackets.set(`longString message Error`, { "exception": { "_grip": { "type": "object", - "actor": "server0.conn0.windowGlobal12884901889/obj28", + "actor": "server0.conn0.watcher2.process2//obj29", "class": "Error", "ownPropertyLength": 4, "extensible": true, @@ -203,11 +203,11 @@ rawPackets.set(`longString message Error`, { "message": { "_grip": { "type": "longString", - "actor": "server0.conn0.windowGlobal12884901889/longstractor29", + "actor": "server0.conn0.watcher2.process2//longstractor30", "length": 110000, "initial": "Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error" }, - "actorID": "server0.conn0.windowGlobal12884901889/longstractor29" + "actorID": "server0.conn0.watcher2.process2//longstractor30" }, "stack": "@debugger eval code:1:7\n", "fileName": "debugger eval code", @@ -215,16 +215,16 @@ rawPackets.set(`longString message Error`, { "columnNumber": 7 } }, - "actorID": "server0.conn0.windowGlobal12884901889/obj28" + "actorID": "server0.conn0.watcher2.process2//obj29" }, "exceptionMessage": { "_grip": { "type": "longString", - "actor": "server0.conn0.windowGlobal12884901889/longstractor30", + "actor": "server0.conn0.watcher2.process2//longstractor31", "length": 110007, "initial": "Error: Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Lon" }, - "actorID": "server0.conn0.windowGlobal12884901889/longstractor30" + "actorID": "server0.conn0.watcher2.process2//longstractor31" }, "exceptionStack": [ { @@ -426,7 +426,7 @@ rawPackets.set(`eval throw Symbol`, { "resultID": "1588154003077-13", "exception": { "type": "symbol", - "actor": "server0.conn0.windowGlobal12884901889/symbol38", + "actor": "server0.conn0.watcher2.process2//symbol39", "name": "potato" }, "exceptionMessage": "Symbol(potato)", @@ -459,7 +459,7 @@ rawPackets.set(`eval throw Object`, { "exception": { "_grip": { "type": "object", - "actor": "server0.conn0.windowGlobal12884901889/obj40", + "actor": "server0.conn0.watcher2.process2//obj41", "class": "Object", "ownPropertyLength": 1, "extensible": true, @@ -479,7 +479,7 @@ rawPackets.set(`eval throw Object`, { "ownPropertiesLength": 1 } }, - "actorID": "server0.conn0.windowGlobal12884901889/obj40" + "actorID": "server0.conn0.watcher2.process2//obj41" }, "exceptionMessage": "[object Object]", "exceptionStack": [ @@ -511,7 +511,7 @@ rawPackets.set(`eval throw Error Object`, { "exception": { "_grip": { "type": "object", - "actor": "server0.conn0.windowGlobal12884901889/obj42", + "actor": "server0.conn0.watcher2.process2//obj43", "class": "Error", "ownPropertyLength": 4, "extensible": true, @@ -528,7 +528,7 @@ rawPackets.set(`eval throw Error Object`, { "columnNumber": 7 } }, - "actorID": "server0.conn0.windowGlobal12884901889/obj42" + "actorID": "server0.conn0.watcher2.process2//obj43" }, "exceptionMessage": "Error: pumpkin", "exceptionStack": [ @@ -560,7 +560,7 @@ rawPackets.set(`eval throw Error Object with custom name`, { "exception": { "_grip": { "type": "object", - "actor": "server0.conn0.windowGlobal12884901889/obj44", + "actor": "server0.conn0.watcher2.process2//obj45", "class": "Error", "ownPropertyLength": 6, "extensible": true, @@ -577,7 +577,7 @@ rawPackets.set(`eval throw Error Object with custom name`, { "columnNumber": 15 } }, - "actorID": "server0.conn0.windowGlobal12884901889/obj44" + "actorID": "server0.conn0.watcher2.process2//obj45" }, "exceptionMessage": "JuicyError: pineapple", "exceptionStack": [ @@ -609,7 +609,7 @@ rawPackets.set(`eval throw Error Object with error cause`, { "exception": { "_grip": { "type": "object", - "actor": "server0.conn0.windowGlobal12884901889/obj46", + "actor": "server0.conn0.watcher2.process2//obj47", "class": "Error", "ownPropertyLength": 5, "extensible": true, @@ -626,7 +626,7 @@ rawPackets.set(`eval throw Error Object with error cause`, { "columnNumber": 15, "cause": { "type": "object", - "actor": "server0.conn0.windowGlobal12884901889/obj47", + "actor": "server0.conn0.watcher2.process2//obj48", "class": "SyntaxError", "ownPropertyLength": 4, "extensible": true, @@ -645,7 +645,7 @@ rawPackets.set(`eval throw Error Object with error cause`, { } } }, - "actorID": "server0.conn0.windowGlobal12884901889/obj46" + "actorID": "server0.conn0.watcher2.process2//obj47" }, "exceptionMessage": "Error: something went wrong", "exceptionStack": [ @@ -677,7 +677,7 @@ rawPackets.set(`eval throw Error Object with cause chain`, { "exception": { "_grip": { "type": "object", - "actor": "server0.conn0.windowGlobal12884901889/obj49", + "actor": "server0.conn0.watcher2.process2//obj50", "class": "Error", "ownPropertyLength": 5, "extensible": true, @@ -694,7 +694,7 @@ rawPackets.set(`eval throw Error Object with cause chain`, { "columnNumber": 16, "cause": { "type": "object", - "actor": "server0.conn0.windowGlobal12884901889/obj50", + "actor": "server0.conn0.watcher2.process2//obj51", "class": "Error", "ownPropertyLength": 5, "extensible": true, @@ -711,7 +711,7 @@ rawPackets.set(`eval throw Error Object with cause chain`, { "columnNumber": 16, "cause": { "type": "object", - "actor": "server0.conn0.windowGlobal12884901889/obj51", + "actor": "server0.conn0.watcher2.process2//obj52", "class": "Error", "ownPropertyLength": 5, "extensible": true, @@ -728,7 +728,7 @@ rawPackets.set(`eval throw Error Object with cause chain`, { "columnNumber": 16, "cause": { "type": "object", - "actor": "server0.conn0.windowGlobal12884901889/obj52", + "actor": "server0.conn0.watcher2.process2//obj53", "class": "Error", "ownPropertyLength": 4, "extensible": true, @@ -751,7 +751,7 @@ rawPackets.set(`eval throw Error Object with cause chain`, { } } }, - "actorID": "server0.conn0.windowGlobal12884901889/obj49" + "actorID": "server0.conn0.watcher2.process2//obj50" }, "exceptionMessage": "Error: err-d", "exceptionStack": [ @@ -783,7 +783,7 @@ rawPackets.set(`eval throw Error Object with cyclical cause chain`, { "exception": { "_grip": { "type": "object", - "actor": "server0.conn0.windowGlobal12884901889/obj54", + "actor": "server0.conn0.watcher2.process2//obj55", "class": "Error", "ownPropertyLength": 5, "extensible": true, @@ -800,7 +800,7 @@ rawPackets.set(`eval throw Error Object with cyclical cause chain`, { "columnNumber": 16, "cause": { "type": "object", - "actor": "server0.conn0.windowGlobal12884901889/obj55", + "actor": "server0.conn0.watcher2.process2//obj56", "class": "Error", "ownPropertyLength": 5, "extensible": true, @@ -822,7 +822,7 @@ rawPackets.set(`eval throw Error Object with cyclical cause chain`, { } } }, - "actorID": "server0.conn0.windowGlobal12884901889/obj54" + "actorID": "server0.conn0.watcher2.process2//obj55" }, "exceptionMessage": "Error: err-y", "exceptionStack": [ @@ -854,7 +854,7 @@ rawPackets.set(`eval throw Error Object with falsy cause`, { "exception": { "_grip": { "type": "object", - "actor": "server0.conn0.windowGlobal12884901889/obj57", + "actor": "server0.conn0.watcher2.process2//obj58", "class": "Error", "ownPropertyLength": 5, "extensible": true, @@ -872,7 +872,7 @@ rawPackets.set(`eval throw Error Object with falsy cause`, { "cause": false } }, - "actorID": "server0.conn0.windowGlobal12884901889/obj57" + "actorID": "server0.conn0.watcher2.process2//obj58" }, "exceptionMessage": "Error: false cause", "exceptionStack": [ @@ -904,7 +904,7 @@ rawPackets.set(`eval throw Error Object with null cause`, { "exception": { "_grip": { "type": "object", - "actor": "server0.conn0.windowGlobal12884901889/obj59", + "actor": "server0.conn0.watcher2.process2//obj60", "class": "Error", "ownPropertyLength": 5, "extensible": true, @@ -924,7 +924,7 @@ rawPackets.set(`eval throw Error Object with null cause`, { } } }, - "actorID": "server0.conn0.windowGlobal12884901889/obj59" + "actorID": "server0.conn0.watcher2.process2//obj60" }, "exceptionMessage": "Error: null cause", "exceptionStack": [ @@ -956,7 +956,7 @@ rawPackets.set(`eval throw Error Object with undefined cause`, { "exception": { "_grip": { "type": "object", - "actor": "server0.conn0.windowGlobal12884901889/obj61", + "actor": "server0.conn0.watcher2.process2//obj62", "class": "Error", "ownPropertyLength": 5, "extensible": true, @@ -976,7 +976,7 @@ rawPackets.set(`eval throw Error Object with undefined cause`, { } } }, - "actorID": "server0.conn0.windowGlobal12884901889/obj61" + "actorID": "server0.conn0.watcher2.process2//obj62" }, "exceptionMessage": "Error: undefined cause", "exceptionStack": [ @@ -1008,7 +1008,7 @@ rawPackets.set(`eval throw Error Object with number cause`, { "exception": { "_grip": { "type": "object", - "actor": "server0.conn0.windowGlobal12884901889/obj63", + "actor": "server0.conn0.watcher2.process2//obj64", "class": "Error", "ownPropertyLength": 5, "extensible": true, @@ -1026,7 +1026,7 @@ rawPackets.set(`eval throw Error Object with number cause`, { "cause": 0 } }, - "actorID": "server0.conn0.windowGlobal12884901889/obj63" + "actorID": "server0.conn0.watcher2.process2//obj64" }, "exceptionMessage": "Error: number cause", "exceptionStack": [ @@ -1058,7 +1058,7 @@ rawPackets.set(`eval throw Error Object with string cause`, { "exception": { "_grip": { "type": "object", - "actor": "server0.conn0.windowGlobal12884901889/obj65", + "actor": "server0.conn0.watcher2.process2//obj66", "class": "Error", "ownPropertyLength": 5, "extensible": true, @@ -1076,7 +1076,7 @@ rawPackets.set(`eval throw Error Object with string cause`, { "cause": "cause message" } }, - "actorID": "server0.conn0.windowGlobal12884901889/obj65" + "actorID": "server0.conn0.watcher2.process2//obj66" }, "exceptionMessage": "Error: string cause", "exceptionStack": [ @@ -1108,7 +1108,7 @@ rawPackets.set(`eval throw Error Object with object cause`, { "exception": { "_grip": { "type": "object", - "actor": "server0.conn0.windowGlobal12884901889/obj67", + "actor": "server0.conn0.watcher2.process2//obj68", "class": "Error", "ownPropertyLength": 5, "extensible": true, @@ -1125,7 +1125,7 @@ rawPackets.set(`eval throw Error Object with object cause`, { "columnNumber": 7, "cause": { "type": "object", - "actor": "server0.conn0.windowGlobal12884901889/obj68", + "actor": "server0.conn0.watcher2.process2//obj69", "class": "Object", "ownPropertyLength": 2, "extensible": true, @@ -1135,7 +1135,7 @@ rawPackets.set(`eval throw Error Object with object cause`, { } } }, - "actorID": "server0.conn0.windowGlobal12884901889/obj67" + "actorID": "server0.conn0.watcher2.process2//obj68" }, "exceptionMessage": "Error: object cause", "exceptionStack": [ @@ -1169,7 +1169,7 @@ rawPackets.set(`eval pending promise`, { "result": { "_grip": { "type": "object", - "actor": "server0.conn0.windowGlobal12884901889/obj70", + "actor": "server0.conn0.watcher2.process2//obj71", "class": "Promise", "ownPropertyLength": 0, "extensible": true, @@ -1186,7 +1186,7 @@ rawPackets.set(`eval pending promise`, { "ownPropertiesLength": 1 } }, - "actorID": "server0.conn0.windowGlobal12884901889/obj70" + "actorID": "server0.conn0.watcher2.process2//obj71" }, "startTime": 1572867483805, "timestamp": 1572867483805 @@ -1199,7 +1199,7 @@ rawPackets.set(`eval Promise.resolve`, { "result": { "_grip": { "type": "object", - "actor": "server0.conn0.windowGlobal12884901889/obj72", + "actor": "server0.conn0.watcher2.process2//obj73", "class": "Promise", "ownPropertyLength": 0, "extensible": true, @@ -1219,7 +1219,7 @@ rawPackets.set(`eval Promise.resolve`, { "ownPropertiesLength": 2 } }, - "actorID": "server0.conn0.windowGlobal12884901889/obj72" + "actorID": "server0.conn0.watcher2.process2//obj73" }, "startTime": 1572867483805, "timestamp": 1572867483805 @@ -1232,7 +1232,7 @@ rawPackets.set(`eval Promise.reject`, { "result": { "_grip": { "type": "object", - "actor": "server0.conn0.windowGlobal12884901889/obj74", + "actor": "server0.conn0.watcher2.process2//obj75", "class": "Promise", "ownPropertyLength": 0, "extensible": true, @@ -1252,7 +1252,7 @@ rawPackets.set(`eval Promise.reject`, { "ownPropertiesLength": 2 } }, - "actorID": "server0.conn0.windowGlobal12884901889/obj74" + "actorID": "server0.conn0.watcher2.process2//obj75" }, "startTime": 1572867483805, "timestamp": 1572867483805 @@ -1265,7 +1265,7 @@ rawPackets.set(`eval resolved promise`, { "result": { "_grip": { "type": "object", - "actor": "server0.conn0.windowGlobal12884901889/obj76", + "actor": "server0.conn0.watcher2.process2//obj77", "class": "Promise", "ownPropertyLength": 0, "extensible": true, @@ -1285,7 +1285,7 @@ rawPackets.set(`eval resolved promise`, { "ownPropertiesLength": 2 } }, - "actorID": "server0.conn0.windowGlobal12884901889/obj76" + "actorID": "server0.conn0.watcher2.process2//obj77" }, "startTime": 1572867483805, "timestamp": 1572867483805 @@ -1298,7 +1298,7 @@ rawPackets.set(`eval rejected promise`, { "result": { "_grip": { "type": "object", - "actor": "server0.conn0.windowGlobal12884901889/obj78", + "actor": "server0.conn0.watcher2.process2//obj79", "class": "Promise", "ownPropertyLength": 0, "extensible": true, @@ -1314,7 +1314,7 @@ rawPackets.set(`eval rejected promise`, { "<reason>": { "value": { "type": "object", - "actor": "server0.conn0.windowGlobal12884901889/obj79", + "actor": "server0.conn0.watcher2.process2//obj80", "class": "ReferenceError", "ownPropertyLength": 4, "extensible": true, @@ -1336,7 +1336,7 @@ rawPackets.set(`eval rejected promise`, { "ownPropertiesLength": 2 } }, - "actorID": "server0.conn0.windowGlobal12884901889/obj78" + "actorID": "server0.conn0.watcher2.process2//obj79" }, "startTime": 1572867483805, "timestamp": 1572867483805 @@ -1349,7 +1349,7 @@ rawPackets.set(`eval rejected promise with Error`, { "result": { "_grip": { "type": "object", - "actor": "server0.conn0.windowGlobal12884901889/obj82", + "actor": "server0.conn0.watcher2.process2//obj83", "class": "Promise", "ownPropertyLength": 0, "extensible": true, @@ -1365,7 +1365,7 @@ rawPackets.set(`eval rejected promise with Error`, { "<reason>": { "value": { "type": "object", - "actor": "server0.conn0.windowGlobal12884901889/obj83", + "actor": "server0.conn0.watcher2.process2//obj84", "class": "Error", "ownPropertyLength": 5, "extensible": true, @@ -1382,7 +1382,7 @@ rawPackets.set(`eval rejected promise with Error`, { "columnNumber": 15, "cause": { "type": "object", - "actor": "server0.conn0.windowGlobal12884901889/obj84", + "actor": "server0.conn0.watcher2.process2//obj85", "class": "ReferenceError", "ownPropertyLength": 4, "extensible": true, @@ -1406,7 +1406,7 @@ rawPackets.set(`eval rejected promise with Error`, { "ownPropertiesLength": 2 } }, - "actorID": "server0.conn0.windowGlobal12884901889/obj82" + "actorID": "server0.conn0.watcher2.process2//obj83" }, "startTime": 1572867483805, "timestamp": 1572867483805 diff --git a/devtools/client/webconsole/test/node/fixtures/stubs/pageError.js b/devtools/client/webconsole/test/node/fixtures/stubs/pageError.js @@ -22,7 +22,7 @@ rawPackets.set(`ReferenceError: asdf is not defined`, { "pageError": { "errorMessage": "ReferenceError: asdf is not defined", "errorMessageName": "JSMSG_NOT_DEFINED", - "exceptionDocURL": "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Errors/Not_defined?utm_source=mozilla&utm_medium=firefox-console-errors&utm_campaign=default", + "exceptionDocURL": "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Errors/Not_defined?utm_source=devtools&utm_medium=firefox-console-errors&utm_campaign=default", "sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", "sourceId": "server0.conn0.child1/source22", "lineNumber": 3, @@ -86,7 +86,7 @@ rawPackets.set(`ReferenceError: asdf is not defined`, { "exception": { "_grip": { "type": "object", - "actor": "server0.conn0.watcher2.process9//obj22", + "actor": "server0.conn0.watcher2.process8//obj21", "class": "ReferenceError", "ownPropertyLength": 4, "extensible": true, @@ -103,7 +103,7 @@ rawPackets.set(`ReferenceError: asdf is not defined`, { "columnNumber": 5 } }, - "actorID": "server0.conn0.watcher2.process9//obj22" + "actorID": "server0.conn0.watcher2.process8//obj21" }, "hasException": true }, @@ -116,11 +116,11 @@ rawPackets.set(`TypeError longString message`, { "errorMessage": { "_grip": { "type": "longString", - "actor": "server0.conn0.watcher2.process9//longstractor24", + "actor": "server0.conn0.watcher2.process8//longstractor23", "length": 110007, "initial": "Error: Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Lon" }, - "actorID": "server0.conn0.watcher2.process9//longstractor24" + "actorID": "server0.conn0.watcher2.process8//longstractor23" }, "errorMessageName": "", "sourceName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", @@ -172,7 +172,7 @@ rawPackets.set(`TypeError longString message`, { "exception": { "_grip": { "type": "object", - "actor": "server0.conn0.watcher2.process9//obj25", + "actor": "server0.conn0.watcher2.process8//obj24", "class": "Error", "ownPropertyLength": 4, "extensible": true, @@ -185,11 +185,11 @@ rawPackets.set(`TypeError longString message`, { "message": { "_grip": { "type": "longString", - "actor": "server0.conn0.watcher2.process9//longstractor26", + "actor": "server0.conn0.watcher2.process8//longstractor25", "length": 110000, "initial": "Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error Long error" }, - "actorID": "server0.conn0.watcher2.process9//longstractor26" + "actorID": "server0.conn0.watcher2.process8//longstractor25" }, "stack": "@https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html:1:7\n", "fileName": "https://example.com/browser/devtools/client/webconsole/test/browser/test-console-api.html", @@ -197,7 +197,7 @@ rawPackets.set(`TypeError longString message`, { "columnNumber": 7 } }, - "actorID": "server0.conn0.watcher2.process9//obj25" + "actorID": "server0.conn0.watcher2.process8//obj24" }, "hasException": true }, diff --git a/devtools/server/actors/errordocs.js b/devtools/server/actors/errordocs.js @@ -31,10 +31,14 @@ loader.lazyGetter(this, "supportBaseURL", () => { return url; }); +const { getMdnLinkParams } = ChromeUtils.importESModule( + "resource://devtools/shared/mdn.mjs", + { global: "contextual" } +); + const baseErrorURL = "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Errors/"; -const params = - "?utm_source=mozilla&utm_medium=firefox-console-errors&utm_campaign=default"; +const params = "?" + getMdnLinkParams("firefox-console-errors"); const ErrorDocs = { JSMSG_READ_ONLY: "Read-only", @@ -162,8 +166,7 @@ const ErrorCategories = { const baseCorsErrorUrl = "https://developer.mozilla.org/docs/Web/HTTP/Guides/CORS/Errors/"; -const corsParams = - "?utm_source=devtools&utm_medium=firefox-cors-errors&utm_campaign=default"; +const corsParams = "?" + getMdnLinkParams("firefox-cors-errors"); const CorsErrorDocs = { CORSDisabled: "CORSDisabled", CORSDidNotSucceed2: "CORSDidNotSucceed", @@ -185,7 +188,7 @@ const CorsErrorDocs = { const baseStorageAccessPolicyErrorUrl = "https://developer.mozilla.org/docs/Web/Privacy/Guides/Storage_Access_Policy/Errors/"; const storageAccessPolicyParams = - "?utm_source=devtools&utm_medium=firefox-cookie-errors&utm_campaign=default"; + "?" + getMdnLinkParams("firefox-cookie-errors"); const StorageAccessPolicyErrorDocs = { cookieBlockedPermission: "CookieBlockedByPermission", cookieBlockedTracker: "CookieBlockedTracker", diff --git a/devtools/shared/commands/resource/tests/browser_resources_error_messages.js b/devtools/shared/commands/resource/tests/browser_resources_error_messages.js @@ -15,6 +15,10 @@ httpServer.registerPathHandler(`/test_page_errors.html`, (req, res) => { const TEST_URI = `http://localhost:${httpServer.identity.primaryPort}/test_page_errors.html`; +const { getMdnLinkParams } = ChromeUtils.importESModule( + "resource://devtools/shared/mdn.mjs" +); + add_task(async function () { // Disable the preloaded process as it creates processes intermittently // which forces the emission of RDP requests we aren't correctly waiting for. @@ -225,7 +229,7 @@ const NUMBER_REGEX = /^\d+$/; const FRACTIONAL_NUMBER_REGEX = /^\d+(\.\d{1,3})?$/; const mdnUrl = path => - `https://developer.mozilla.org/${path}?utm_source=mozilla&utm_medium=firefox-console-errors&utm_campaign=default`; + `https://developer.mozilla.org/${path}?${getMdnLinkParams("firefox-console-errors")}`; const expectedPageErrors = new Map([ [ diff --git a/devtools/shared/mdn.mjs b/devtools/shared/mdn.mjs @@ -0,0 +1,17 @@ +/* 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/. */ + +/** + * Get a URLSearchParams instance with the proper utm_* parameters + * + * @param {string} utmMedium: value for the "utm_medium" parameter + * @returns {URLSearchParams} + */ +export function getMdnLinkParams(utmMedium) { + return new URLSearchParams({ + utm_source: "devtools", + utm_medium: utmMedium, + utm_campaign: "default", + }); +} diff --git a/devtools/shared/moz.build b/devtools/shared/moz.build @@ -64,6 +64,7 @@ DevToolsModules( "indentation.js", "indexed-db.js", "l10n.js", + "mdn.mjs", "natural-sort.js", "path.js", "picker-constants.js",