From 58de75b2da9254659b1968806098454f074400a9 Mon Sep 17 00:00:00 2001 From: Julien Wajsberg Date: Mon, 13 Feb 2023 16:46:38 +0000 Subject: [PATCH] Bug 1811853 - Move symbolication files to the shared/ directory r=canaltinova Differential Revision: https://phabricator.services.mozilla.com/D167846 --- .eslintignore | 2 +- .../client/performance-new/@types/gecko.d.ts | 12 +++++++----- devtools/client/performance-new/initializer.js | 2 +- devtools/client/performance-new/moz.build | 3 --- .../performance-new/shared/background.jsm.js | 2 +- devtools/client/performance-new/shared/moz.build | 3 +++ .../{ => shared}/profiler_get_symbols.js | 0 .../{ => shared}/symbolication-worker.js | 6 +++--- .../{ => shared}/symbolication.jsm.js | 16 ++++++++-------- dom/security/nsContentSecurityUtils.cpp | 2 +- .../extensions/parent/ext-geckoProfiler.js | 2 +- tools/esmify/map.json | 4 ++-- 12 files changed, 28 insertions(+), 26 deletions(-) rename devtools/client/performance-new/{ => shared}/profiler_get_symbols.js (100%) rename devtools/client/performance-new/{ => shared}/symbolication-worker.js (97%) rename devtools/client/performance-new/{ => shared}/symbolication.jsm.js (94%) diff --git a/.eslintignore b/.eslintignore index edaf07d30d7c..15ed4091741b 100644 --- a/.eslintignore +++ b/.eslintignore @@ -91,7 +91,7 @@ devtools/server/tests/xpcshell/setBreakpoint* devtools/server/tests/xpcshell/sourcemapped.js # Ignore generated code from wasm-bindgen -devtools/client/performance-new/profiler_get_symbols.js +devtools/client/performance-new/shared/profiler_get_symbols.js # Testing syntax error devtools/client/webconsole/test/browser/test-syntaxerror-worklet.js diff --git a/devtools/client/performance-new/@types/gecko.d.ts b/devtools/client/performance-new/@types/gecko.d.ts index 645b0fe0f94f..4a29c6dc896c 100644 --- a/devtools/client/performance-new/@types/gecko.d.ts +++ b/devtools/client/performance-new/@types/gecko.d.ts @@ -27,11 +27,11 @@ declare namespace MockedExports { "resource:///modules/CustomizableWidgets.jsm": typeof import("resource:///modules/CustomizableWidgets.jsm"); "resource://devtools/shared/loader/Loader.sys.mjs": typeof import("resource://devtools/shared/loader/Loader.sys.mjs"); "resource://devtools/client/performance-new/shared/background.jsm.js": typeof import("resource://devtools/client/performance-new/shared/background.jsm.js"); + "resource://devtools/client/performance-new/shared/symbolication.jsm.js": typeof import("resource://devtools/client/performance-new/shared/symbolication.jsm.js"); "resource://devtools/shared/loader/browser-loader.js": any; "resource://devtools/client/performance-new/popup/menu-button.jsm.js": typeof import("resource://devtools/client/performance-new/popup/menu-button.jsm.js"); "resource://devtools/client/performance-new/typescript-lazy-load.jsm.js": typeof import("resource://devtools/client/performance-new/typescript-lazy-load.jsm.js"); "resource://devtools/client/performance-new/popup/panel.jsm.js": typeof import("resource://devtools/client/performance-new/popup/panel.jsm.js"); - "resource://devtools/client/performance-new/symbolication.jsm.js": typeof import("resource://devtools/client/performance-new/symbolication.jsm.js"); "resource:///modules/PanelMultiView.jsm": typeof import("resource:///modules/PanelMultiView.jsm"); } @@ -46,7 +46,9 @@ declare namespace MockedExports { * Then add the file path to the KnownModules above. */ import: (module: S) => KnownModules[S]; - importESModule: (module: S) => KnownModules[S]; + importESModule: ( + module: S + ) => KnownModules[S]; defineModuleGetter: (target: any, variable: string, path: string) => void; defineESModuleGetters: (target: any, mappings: any) => void; } @@ -151,7 +153,7 @@ declare namespace MockedExports { set: (name: string, value: string) => void; get: (name: string) => string; exists: (name: string) => boolean; - }, + }; prefs: nsIPrefBranch; profiler: { StartProfiler: ( @@ -332,8 +334,8 @@ declare module "resource://devtools/client/performance-new/shared/background.jsm export = Background; } -declare module "resource://devtools/client/performance-new/symbolication.jsm.js" { - import * as PerfSymbolication from "devtools/client/performance-new/symbolication.jsm.js"; +declare module "resource://devtools/client/performance-new/shared/symbolication.jsm.js" { + import * as PerfSymbolication from "devtools/client/performance-new/shared/symbolication.jsm.js"; export = PerfSymbolication; } diff --git a/devtools/client/performance-new/initializer.js b/devtools/client/performance-new/initializer.js index 522e447ca948..e23283228f16 100644 --- a/devtools/client/performance-new/initializer.js +++ b/devtools/client/performance-new/initializer.js @@ -70,7 +70,7 @@ const { sharedLibrariesFromProfile, } = require("resource://devtools/client/performance-new/browser.js"); const { createLocalSymbolicationService } = ChromeUtils.import( - "resource://devtools/client/performance-new/symbolication.jsm.js" + "resource://devtools/client/performance-new/shared/symbolication.jsm.js" ); const { presets, diff --git a/devtools/client/performance-new/moz.build b/devtools/client/performance-new/moz.build index 5483e83dd8fe..0599981c4091 100644 --- a/devtools/client/performance-new/moz.build +++ b/devtools/client/performance-new/moz.build @@ -15,9 +15,6 @@ DevToolsModules( "browser.js", "initializer.js", "panel.js", - "profiler_get_symbols.js", - "symbolication-worker.js", - "symbolication.jsm.js", "typescript-lazy-load.jsm.js", "utils.js", ) diff --git a/devtools/client/performance-new/shared/background.jsm.js b/devtools/client/performance-new/shared/background.jsm.js index 3c05ac4731a4..22fdb0965ed5 100644 --- a/devtools/client/performance-new/shared/background.jsm.js +++ b/devtools/client/performance-new/shared/background.jsm.js @@ -95,7 +95,7 @@ const lazy = createLazyLoaders({ ChromeUtils.import("resource:///modules/CustomizableUI.jsm"), PerfSymbolication: () => ChromeUtils.import( - "resource://devtools/client/performance-new/symbolication.jsm.js" + "resource://devtools/client/performance-new/shared/symbolication.jsm.js" ), ProfilerMenuButton: () => ChromeUtils.import( diff --git a/devtools/client/performance-new/shared/moz.build b/devtools/client/performance-new/shared/moz.build index 4b80c0d7b47b..cc26b695b0a4 100644 --- a/devtools/client/performance-new/shared/moz.build +++ b/devtools/client/performance-new/shared/moz.build @@ -5,6 +5,9 @@ DevToolsModules( "background.jsm.js", + "profiler_get_symbols.js", + "symbolication-worker.js", + "symbolication.jsm.js", ) with Files("**"): diff --git a/devtools/client/performance-new/profiler_get_symbols.js b/devtools/client/performance-new/shared/profiler_get_symbols.js similarity index 100% rename from devtools/client/performance-new/profiler_get_symbols.js rename to devtools/client/performance-new/shared/profiler_get_symbols.js diff --git a/devtools/client/performance-new/symbolication-worker.js b/devtools/client/performance-new/shared/symbolication-worker.js similarity index 97% rename from devtools/client/performance-new/symbolication-worker.js rename to devtools/client/performance-new/shared/symbolication-worker.js index d50eb510ee01..4f2ee02f29cc 100644 --- a/devtools/client/performance-new/symbolication-worker.js +++ b/devtools/client/performance-new/shared/symbolication-worker.js @@ -14,12 +14,12 @@ /* import-globals-from profiler_get_symbols.js */ importScripts( - "resource://devtools/client/performance-new/profiler_get_symbols.js" + "resource://devtools/client/performance-new/shared/profiler_get_symbols.js" ); /** - * @typedef {import("./@types/perf").SymbolicationWorkerInitialMessage} SymbolicationWorkerInitialMessage - * @typedef {import("./@types/perf").FileHandle} FileHandle + * @typedef {import("../@types/perf").SymbolicationWorkerInitialMessage} SymbolicationWorkerInitialMessage + * @typedef {import("../@types/perf").FileHandle} FileHandle */ // This worker uses the wasm module that was generated from https://github.com/mstange/profiler-get-symbols. diff --git a/devtools/client/performance-new/symbolication.jsm.js b/devtools/client/performance-new/shared/symbolication.jsm.js similarity index 94% rename from devtools/client/performance-new/symbolication.jsm.js rename to devtools/client/performance-new/shared/symbolication.jsm.js index 0bad3f72818b..6420f87ee64f 100644 --- a/devtools/client/performance-new/symbolication.jsm.js +++ b/devtools/client/performance-new/shared/symbolication.jsm.js @@ -8,16 +8,16 @@ const lazy = {}; /** - * @typedef {import("./@types/perf").Library} Library - * @typedef {import("./@types/perf").PerfFront} PerfFront - * @typedef {import("./@types/perf").SymbolTableAsTuple} SymbolTableAsTuple - * @typedef {import("./@types/perf").SymbolicationService} SymbolicationService - * @typedef {import("./@types/perf").SymbolicationWorkerInitialMessage} SymbolicationWorkerInitialMessage + * @typedef {import("../@types/perf").Library} Library + * @typedef {import("../@types/perf").PerfFront} PerfFront + * @typedef {import("../@types/perf").SymbolTableAsTuple} SymbolTableAsTuple + * @typedef {import("../@types/perf").SymbolicationService} SymbolicationService + * @typedef {import("../@types/perf").SymbolicationWorkerInitialMessage} SymbolicationWorkerInitialMessage */ /** * @template R - * @typedef {import("./@types/perf").SymbolicationWorkerReplyData} SymbolicationWorkerReplyData + * @typedef {import("../@types/perf").SymbolicationWorkerReplyData} SymbolicationWorkerReplyData */ ChromeUtils.defineESModuleGetters(lazy, { @@ -234,7 +234,7 @@ class LocalSymbolicationService { module, }; return getResultFromWorker( - "resource://devtools/client/performance-new/symbolication-worker.js", + "resource://devtools/client/performance-new/shared/symbolication-worker.js", initialMessage ); } @@ -258,7 +258,7 @@ class LocalSymbolicationService { module, }; return getResultFromWorker( - "resource://devtools/client/performance-new/symbolication-worker.js", + "resource://devtools/client/performance-new/shared/symbolication-worker.js", initialMessage ); } diff --git a/dom/security/nsContentSecurityUtils.cpp b/dom/security/nsContentSecurityUtils.cpp index 4b90f9bbab41..dbebde4134a9 100644 --- a/dom/security/nsContentSecurityUtils.cpp +++ b/dom/security/nsContentSecurityUtils.cpp @@ -614,7 +614,7 @@ bool nsContentSecurityUtils::IsEvalAllowed(JSContext* cx, // The profiler's symbolication code uses a wasm module to extract symbols // from the binary files result of local builds. // See bug 1777479 - "resource://devtools/client/performance-new/symbolication.jsm.js"_ns, + "resource://devtools/client/performance-new/shared/symbolication.jsm.js"_ns, // The Browser Toolbox/Console "debugger"_ns, diff --git a/toolkit/components/extensions/parent/ext-geckoProfiler.js b/toolkit/components/extensions/parent/ext-geckoProfiler.js index 41dff3be76ff..f7bcead7c185 100644 --- a/toolkit/components/extensions/parent/ext-geckoProfiler.js +++ b/toolkit/components/extensions/parent/ext-geckoProfiler.js @@ -22,7 +22,7 @@ var { ExtensionError } = ExtensionUtils; XPCOMUtils.defineLazyGetter(this, "symbolicationService", () => { let { createLocalSymbolicationService } = ChromeUtils.import( - "resource://devtools/client/performance-new/symbolication.jsm.js" + "resource://devtools/client/performance-new/shared/symbolication.jsm.js" ); return createLocalSymbolicationService(Services.profiler.sharedLibraries, []); }); diff --git a/tools/esmify/map.json b/tools/esmify/map.json index 3324aad9e907..4335335fc17f 100644 --- a/tools/esmify/map.json +++ b/tools/esmify/map.json @@ -737,8 +737,8 @@ "devtools/client/performance-new/popup/menu-button.jsm.js", "resource://devtools/client/performance-new/popup/panel.jsm.js": "devtools/client/performance-new/popup/panel.jsm.js", - "resource://devtools/client/performance-new/symbolication.jsm.js": - "devtools/client/performance-new/symbolication.jsm.js", + "resource://devtools/client/performance-new/shared/symbolication.jsm.js": + "devtools/client/performance-new/shared/symbolication.jsm.js", "resource://devtools/client/performance-new/typescript-lazy-load.jsm.js": "devtools/client/performance-new/typescript-lazy-load.jsm.js", "resource://devtools/client/storage/VariablesView.jsm":