From 1e663371a0ffa7fb3f282e4fe2e8d1f8b85fd63e Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Mon, 16 Nov 2026 06:07:46 +0800 Subject: [PATCH] refactor(inspector): declare the V8 inspector's use of the browser Electron file scope (#11529) --- scripts/lib/module-layers.baseline.json | 1 - scripts/lib/module-layers.mjs | 6 +++++- tests/evaluation/moduleLayers.test.ts | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/lib/module-layers.baseline.json b/scripts/lib/module-layers.baseline.json index 2fb90e096e..c58df70edf 100644 --- a/scripts/lib/module-layers.baseline.json +++ b/scripts/lib/module-layers.baseline.json @@ -23,7 +23,6 @@ "flutter -> artifacts": 1, "gpu -> artifacts": 2, "il2cpp -> ghidra": 1, - "inspector -> browser": 2, "model -> artifacts": 1, "native -> artifacts": 2 }, diff --git a/scripts/lib/module-layers.mjs b/scripts/lib/module-layers.mjs index 0b7ec0c313..c043e8d3c0 100644 --- a/scripts/lib/module-layers.mjs +++ b/scripts/lib/module-layers.mjs @@ -408,12 +408,16 @@ export const PROVIDER_DEPENDENCIES = Object.freeze([ "CdpEndpoint.ts", "CdpScriptContextFacts.ts", "CdpTargetSessionOwner.ts", + "ElectronFileScope.ts", "protocol/CdpEvents.ts", ]), // The V8 inspector speaks the Chrome DevTools Protocol. It reuses // browser's CDP client (endpoint discovery, connection, target sessions // and captured value projection) instead of keeping a second client. - reason: "the V8 inspector reuses the browser provider's CDP client", + // For Electron targets it authorizes script files inside app.asar with + // browser's Electron file scope, which owns the ASAR descriptors. + reason: + "the V8 inspector reuses the browser provider's CDP client and Electron file scope", }), Object.freeze({ from: "browser", diff --git a/tests/evaluation/moduleLayers.test.ts b/tests/evaluation/moduleLayers.test.ts index 556be7fea5..ced7e61fc3 100644 --- a/tests/evaluation/moduleLayers.test.ts +++ b/tests/evaluation/moduleLayers.test.ts @@ -174,7 +174,7 @@ describe("provider boundaries", () => { providerBoundaryFacts([ edge("src/inspector/A.ts", "src/browser/CdpConnection.js"), edge("src/inspector/A.ts", "src/browser/protocol/CdpEvents.js"), - edge("src/inspector/A.ts", "src/browser/ElectronFileScope.js"), + edge("src/inspector/A.ts", "src/browser/CdpBrowserProvider.js"), edge("src/electron/B.ts", "src/browser/CdpConnection.js"), ]).crossProvider, ).toEqual({ "electron -> browser": 1, "inspector -> browser": 1 });