chrome-devtools-frontend 1.0.1566234 → 1.0.1567721
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/contributing/performance.md +24 -0
- package/front_end/core/common/Base64.ts +21 -2
- package/front_end/core/common/ResourceType.ts +7 -0
- package/front_end/core/host/InspectorFrontendHostStub.ts +3 -0
- package/front_end/core/host/UserMetrics.ts +20 -0
- package/front_end/core/sdk/NetworkManager.ts +3 -3
- package/front_end/entrypoints/main/MainImpl.ts +1 -7
- package/front_end/generated/Deprecation.ts +0 -8
- package/front_end/generated/InspectorBackendCommands.ts +1 -1
- package/front_end/generated/SupportedCSSProperties.js +39 -49
- package/front_end/generated/protocol.ts +4 -0
- package/front_end/models/ai_assistance/agents/AiAgent.ts +2 -1
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +98 -105
- package/front_end/models/emulation/DeviceModeModel.ts +1 -1
- package/front_end/models/formatter/FormatterWorkerPool.ts +8 -6
- package/front_end/models/javascript_metadata/NativeFunctions.js +4 -9
- package/front_end/models/persistence/PersistenceImpl.ts +8 -0
- package/front_end/models/text_utils/TextUtils.snapshot.txt +83 -0
- package/front_end/panels/ai_assistance/ai_assistance-meta.ts +0 -1
- package/front_end/panels/ai_assistance/components/ArtifactsViewer.ts +28 -4
- package/front_end/panels/ai_assistance/components/ChatView.ts +52 -169
- package/front_end/panels/ai_assistance/components/CollapsibleAssistanceContentWidget.ts +27 -8
- package/front_end/panels/ai_assistance/components/PerformanceAgentMarkdownRenderer.ts +19 -4
- package/front_end/panels/application/ApplicationPanelSidebar.ts +1 -0
- package/front_end/panels/application/DeviceBoundSessionsModel.ts +42 -0
- package/front_end/panels/application/DeviceBoundSessionsTreeElement.ts +60 -11
- package/front_end/panels/application/DeviceBoundSessionsView.ts +947 -103
- package/front_end/panels/application/ResourcesPanel.ts +7 -0
- package/front_end/panels/application/deviceBoundSessionsView.css +10 -1
- package/front_end/panels/common/AiCodeGenerationUpgradeDialog.ts +115 -0
- package/front_end/panels/common/aiCodeGenerationUpgradeDialog.css +79 -0
- package/front_end/panels/common/common.ts +1 -0
- package/front_end/panels/console/ConsoleInsightTeaser.ts +17 -3
- package/front_end/panels/issues/AffectedSourcesView.ts +0 -1
- package/front_end/panels/issues/IssuesPane.ts +0 -4
- package/front_end/panels/network/RequestTimingView.ts +5 -20
- package/front_end/panels/network/networkTimingTable.css +5 -5
- package/front_end/panels/recorder/components/StepEditor.ts +15 -8
- package/front_end/panels/settings/AISettingsTab.ts +31 -2
- package/front_end/panels/sources/InplaceFormatterEditorAction.ts +8 -6
- package/front_end/panels/sources/UISourceCodeFrame.ts +9 -3
- package/front_end/panels/timeline/TimelinePanel.ts +12 -4
- package/front_end/panels/timeline/components/insights/DuplicatedJavaScript.ts +1 -1
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/puppeteer/README.chromium +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.d.ts +9 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts +8 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.js +8 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Browser.d.ts +2 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Browser.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BrowserContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BrowserContext.js +3 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BrowserContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Frame.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Frame.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Frame.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.js +3 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/UserContext.d.ts +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/UserContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/UserContext.js +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/UserContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.js +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js +33 -31
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/WebWorker.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/WebWorker.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/WebWorker.js +1 -4
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/WebWorker.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts +7 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.js +11 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Cookie.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +13 -4
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +62 -42
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.d.ts +9 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts +8 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.js +8 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Browser.d.ts +2 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Browser.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BrowserContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BrowserContext.js +3 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BrowserContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Frame.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Frame.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Frame.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.js +3 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/UserContext.d.ts +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/UserContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/UserContext.js +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/UserContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.js +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js +33 -31
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/WebWorker.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/WebWorker.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/WebWorker.js +1 -4
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/WebWorker.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConsoleMessage.d.ts +7 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConsoleMessage.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConsoleMessage.js +11 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConsoleMessage.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Cookie.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/types.d.ts +13 -4
- package/front_end/third_party/puppeteer/package/package.json +3 -3
- package/front_end/third_party/puppeteer/package/src/api/Browser.ts +11 -3
- package/front_end/third_party/puppeteer/package/src/api/Page.ts +9 -0
- package/front_end/third_party/puppeteer/package/src/bidi/Browser.ts +3 -3
- package/front_end/third_party/puppeteer/package/src/bidi/BrowserContext.ts +3 -1
- package/front_end/third_party/puppeteer/package/src/bidi/Frame.ts +1 -0
- package/front_end/third_party/puppeteer/package/src/bidi/core/BrowsingContext.ts +3 -5
- package/front_end/third_party/puppeteer/package/src/bidi/core/UserContext.ts +2 -0
- package/front_end/third_party/puppeteer/package/src/cdp/Browser.ts +1 -0
- package/front_end/third_party/puppeteer/package/src/cdp/Page.ts +43 -45
- package/front_end/third_party/puppeteer/package/src/cdp/WebWorker.ts +3 -11
- package/front_end/third_party/puppeteer/package/src/common/ConsoleMessage.ts +12 -0
- package/front_end/third_party/puppeteer/package/src/common/Cookie.ts +2 -2
- package/front_end/third_party/puppeteer/package/src/revisions.ts +2 -2
- package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
- package/front_end/third_party/source-map-scopes-codec/README.chromium +2 -5
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/builder.d.ts +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/builder.d.ts.map +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/safe_builder.d.ts +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/safe_builder.d.ts.map +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/decode/decode.d.ts +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/decode/decode.d.ts.map +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/encode/encode.d.ts +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/encode/encode.d.ts.map +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/mod.d.ts +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/mod.d.ts.map +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/scopes.d.ts +130 -0
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/scopes.d.ts.map +1 -0
- package/front_end/third_party/source-map-scopes-codec/package/deno.json +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/package.json +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/src/builder/builder.ts +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/src/builder/safe_builder.ts +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/src/codec.js +4 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/codec.js.map +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/src/codec.ts +4 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.js +30 -13
- package/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.js.map +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.ts +35 -17
- package/front_end/third_party/source-map-scopes-codec/package/src/encode/encode.ts +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.js +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.js.map +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.ts +2 -2
- package/front_end/third_party/source-map-scopes-codec/package/src/mod.ts +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/src/scopes.js +7 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/scopes.js.map +1 -0
- package/front_end/third_party/source-map-scopes-codec/package/src/util.ts +1 -1
- package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +4 -0
- package/front_end/ui/visual_logging/KnownContextValues.ts +11 -0
- package/mcp/mcp.ts +1 -0
- package/package.json +1 -2
- package/front_end/third_party/source-map-scopes-codec/package/src/scopes-tsconfig.json +0 -8
- /package/front_end/third_party/source-map-scopes-codec/package/src/{scopes.d.ts → scopes.ts} +0 -0
|
@@ -234,14 +234,22 @@ export type WindowId = string;
|
|
|
234
234
|
/**
|
|
235
235
|
* @public
|
|
236
236
|
*/
|
|
237
|
-
export type CreatePageOptions =
|
|
237
|
+
export type CreatePageOptions = (
|
|
238
238
|
| {
|
|
239
|
-
type
|
|
239
|
+
type?: 'tab';
|
|
240
240
|
}
|
|
241
241
|
| {
|
|
242
242
|
type: 'window';
|
|
243
243
|
windowBounds?: WindowBounds;
|
|
244
|
-
}
|
|
244
|
+
}
|
|
245
|
+
) & {
|
|
246
|
+
/**
|
|
247
|
+
* Whether to create the page in the background.
|
|
248
|
+
*
|
|
249
|
+
* @defaultValue `false`
|
|
250
|
+
*/
|
|
251
|
+
background?: boolean;
|
|
252
|
+
};
|
|
245
253
|
|
|
246
254
|
/**
|
|
247
255
|
* @public
|
|
@@ -704,6 +704,15 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
|
|
704
704
|
*/
|
|
705
705
|
_timeoutSettings = new TimeoutSettings();
|
|
706
706
|
|
|
707
|
+
/**
|
|
708
|
+
* Internal API to get an implementation-specific identifier
|
|
709
|
+
* for the tab. In Chrome, it is a tab target id. If unknown,
|
|
710
|
+
* returns an empty string.
|
|
711
|
+
*
|
|
712
|
+
* @internal
|
|
713
|
+
*/
|
|
714
|
+
_tabId = '';
|
|
715
|
+
|
|
707
716
|
#requestHandlers = new WeakMap<Handler<HTTPRequest>, Handler<HTTPRequest>>();
|
|
708
717
|
|
|
709
718
|
#inflight$ = new ReplaySubject<number>(1);
|
|
@@ -8,7 +8,7 @@ import type {ChildProcess} from 'node:child_process';
|
|
|
8
8
|
|
|
9
9
|
import * as Bidi from 'webdriver-bidi-protocol';
|
|
10
10
|
|
|
11
|
-
import type {BrowserEvents} from '../api/Browser.js';
|
|
11
|
+
import type {BrowserEvents, CreatePageOptions} from '../api/Browser.js';
|
|
12
12
|
import {
|
|
13
13
|
Browser,
|
|
14
14
|
BrowserEvent,
|
|
@@ -282,8 +282,8 @@ export class BidiBrowser extends Browser {
|
|
|
282
282
|
return this.#browserContexts.get(this.#browserCore.defaultUserContext)!;
|
|
283
283
|
}
|
|
284
284
|
|
|
285
|
-
override newPage(): Promise<Page> {
|
|
286
|
-
return this.defaultBrowserContext().newPage();
|
|
285
|
+
override newPage(options?: CreatePageOptions): Promise<Page> {
|
|
286
|
+
return this.defaultBrowserContext().newPage(options);
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
override installExtension(path: string): Promise<string> {
|
|
@@ -189,7 +189,9 @@ export class BidiBrowserContext extends BrowserContext {
|
|
|
189
189
|
? Bidi.BrowsingContext.CreateType.Window
|
|
190
190
|
: Bidi.BrowsingContext.CreateType.Tab;
|
|
191
191
|
|
|
192
|
-
const context = await this.userContext.createBrowsingContext(type
|
|
192
|
+
const context = await this.userContext.createBrowsingContext(type, {
|
|
193
|
+
background: options?.background,
|
|
194
|
+
});
|
|
193
195
|
const page = this.#pages.get(context)!;
|
|
194
196
|
if (!page) {
|
|
195
197
|
throw new Error('Page is not found');
|
|
@@ -415,11 +415,9 @@ export class BrowsingContext extends EventEmitter<{
|
|
|
415
415
|
return context.#reason!;
|
|
416
416
|
})
|
|
417
417
|
async close(promptUnload?: boolean): Promise<void> {
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
}),
|
|
422
|
-
);
|
|
418
|
+
// The WebDriver BiDi specification only allows closing top-level browsing contexts.
|
|
419
|
+
// Closing a top-level context automatically closes all its children, so there is
|
|
420
|
+
// no need to explicitly close nested contexts.
|
|
423
421
|
await this.#session.send('browsingContext.close', {
|
|
424
422
|
context: this.id,
|
|
425
423
|
promptUnload,
|
|
@@ -23,6 +23,7 @@ export type CreateBrowsingContextOptions = Omit<
|
|
|
23
23
|
'type' | 'referenceContext'
|
|
24
24
|
> & {
|
|
25
25
|
referenceContext?: BrowsingContext;
|
|
26
|
+
background?: boolean;
|
|
26
27
|
};
|
|
27
28
|
|
|
28
29
|
/**
|
|
@@ -147,6 +148,7 @@ export class UserContext extends EventEmitter<{
|
|
|
147
148
|
type,
|
|
148
149
|
...options,
|
|
149
150
|
referenceContext: options.referenceContext?.id,
|
|
151
|
+
background: options.background,
|
|
150
152
|
userContext: this.#id,
|
|
151
153
|
});
|
|
152
154
|
|
|
@@ -378,6 +378,7 @@ export class CdpBrowser extends BrowserBase {
|
|
|
378
378
|
windowState: windowBounds?.windowState,
|
|
379
379
|
// Works around crbug.com/454825274.
|
|
380
380
|
newWindow: hasTargets && options?.type === 'window' ? true : undefined,
|
|
381
|
+
background: options?.background,
|
|
381
382
|
});
|
|
382
383
|
const target = (await this.waitForTarget(t => {
|
|
383
384
|
return (t as CdpTarget)._targetId === targetId;
|
|
@@ -151,6 +151,7 @@ export class CdpPage extends Page {
|
|
|
151
151
|
assert(this.#tabTargetClient, 'Tab target session is not defined.');
|
|
152
152
|
this.#tabTarget = (this.#tabTargetClient as CdpCDPSession).target();
|
|
153
153
|
assert(this.#tabTarget, 'Tab target is not defined.');
|
|
154
|
+
this._tabId = this.#tabTarget._getTargetInfo().targetId;
|
|
154
155
|
this.#primaryTarget = target;
|
|
155
156
|
this.#targetManager = target._targetManager();
|
|
156
157
|
this.#keyboard = new CdpKeyboard(client);
|
|
@@ -345,7 +346,7 @@ export class CdpPage extends Page {
|
|
|
345
346
|
session.target().url(),
|
|
346
347
|
session.target()._targetId,
|
|
347
348
|
session.target().type(),
|
|
348
|
-
this.#
|
|
349
|
+
this.#onConsoleAPI.bind(this),
|
|
349
350
|
this.#handleException.bind(this),
|
|
350
351
|
this.#frameManager.networkManager,
|
|
351
352
|
);
|
|
@@ -519,6 +520,7 @@ export class CdpPage extends Page {
|
|
|
519
520
|
[{url, lineNumber}],
|
|
520
521
|
undefined,
|
|
521
522
|
stackTrace,
|
|
523
|
+
this.#primaryTarget._targetId,
|
|
522
524
|
),
|
|
523
525
|
);
|
|
524
526
|
}
|
|
@@ -842,46 +844,9 @@ export class CdpPage extends Page {
|
|
|
842
844
|
const values = event.args.map(arg => {
|
|
843
845
|
return world.createCdpHandle(arg);
|
|
844
846
|
});
|
|
845
|
-
this.#addConsoleMessage(
|
|
846
|
-
convertConsoleMessageLevel(event.type),
|
|
847
|
-
values,
|
|
848
|
-
event.stackTrace,
|
|
849
|
-
);
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
async #onBindingCalled(
|
|
853
|
-
world: IsolatedWorld,
|
|
854
|
-
event: Protocol.Runtime.BindingCalledEvent,
|
|
855
|
-
): Promise<void> {
|
|
856
|
-
let payload: BindingPayload;
|
|
857
|
-
try {
|
|
858
|
-
payload = JSON.parse(event.payload);
|
|
859
|
-
} catch {
|
|
860
|
-
// The binding was either called by something in the page or it was
|
|
861
|
-
// called before our wrapper was initialized.
|
|
862
|
-
return;
|
|
863
|
-
}
|
|
864
|
-
const {type, name, seq, args, isTrivial} = payload;
|
|
865
|
-
if (type !== 'exposedFun') {
|
|
866
|
-
return;
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
const context = world.context;
|
|
870
|
-
if (!context) {
|
|
871
|
-
return;
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
const binding = this.#bindings.get(name);
|
|
875
|
-
await binding?.run(context, seq, args, isTrivial);
|
|
876
|
-
}
|
|
877
847
|
|
|
878
|
-
#addConsoleMessage(
|
|
879
|
-
eventType: string,
|
|
880
|
-
args: JSHandle[],
|
|
881
|
-
stackTrace?: Protocol.Runtime.StackTrace,
|
|
882
|
-
): void {
|
|
883
848
|
if (!this.listenerCount(PageEvent.Console)) {
|
|
884
|
-
|
|
849
|
+
values.forEach(arg => {
|
|
885
850
|
return arg.dispose();
|
|
886
851
|
});
|
|
887
852
|
return;
|
|
@@ -889,7 +854,7 @@ export class CdpPage extends Page {
|
|
|
889
854
|
const textTokens = [];
|
|
890
855
|
// eslint-disable-next-line max-len -- The comment is long.
|
|
891
856
|
// eslint-disable-next-line @puppeteer/use-using -- These are not owned by this function.
|
|
892
|
-
for (const arg of
|
|
857
|
+
for (const arg of values) {
|
|
893
858
|
const remoteObject = arg.remoteObject();
|
|
894
859
|
if (remoteObject.objectId) {
|
|
895
860
|
textTokens.push(arg.toString());
|
|
@@ -898,8 +863,8 @@ export class CdpPage extends Page {
|
|
|
898
863
|
}
|
|
899
864
|
}
|
|
900
865
|
const stackTraceLocations = [];
|
|
901
|
-
if (stackTrace) {
|
|
902
|
-
for (const callFrame of stackTrace.callFrames) {
|
|
866
|
+
if (event.stackTrace) {
|
|
867
|
+
for (const callFrame of event.stackTrace.callFrames) {
|
|
903
868
|
stackTraceLocations.push({
|
|
904
869
|
url: callFrame.url,
|
|
905
870
|
lineNumber: callFrame.lineNumber,
|
|
@@ -907,17 +872,50 @@ export class CdpPage extends Page {
|
|
|
907
872
|
});
|
|
908
873
|
}
|
|
909
874
|
}
|
|
875
|
+
|
|
876
|
+
let targetId;
|
|
877
|
+
if (world.environment.client instanceof CdpCDPSession) {
|
|
878
|
+
targetId = world.environment.client.target()._targetId;
|
|
879
|
+
}
|
|
880
|
+
|
|
910
881
|
const message = new ConsoleMessage(
|
|
911
|
-
convertConsoleMessageLevel(
|
|
882
|
+
convertConsoleMessageLevel(event.type),
|
|
912
883
|
textTokens.join(' '),
|
|
913
|
-
|
|
884
|
+
values,
|
|
914
885
|
stackTraceLocations,
|
|
915
886
|
undefined,
|
|
916
|
-
stackTrace,
|
|
887
|
+
event.stackTrace,
|
|
888
|
+
targetId,
|
|
917
889
|
);
|
|
918
890
|
this.emit(PageEvent.Console, message);
|
|
919
891
|
}
|
|
920
892
|
|
|
893
|
+
async #onBindingCalled(
|
|
894
|
+
world: IsolatedWorld,
|
|
895
|
+
event: Protocol.Runtime.BindingCalledEvent,
|
|
896
|
+
): Promise<void> {
|
|
897
|
+
let payload: BindingPayload;
|
|
898
|
+
try {
|
|
899
|
+
payload = JSON.parse(event.payload);
|
|
900
|
+
} catch {
|
|
901
|
+
// The binding was either called by something in the page or it was
|
|
902
|
+
// called before our wrapper was initialized.
|
|
903
|
+
return;
|
|
904
|
+
}
|
|
905
|
+
const {type, name, seq, args, isTrivial} = payload;
|
|
906
|
+
if (type !== 'exposedFun') {
|
|
907
|
+
return;
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
const context = world.context;
|
|
911
|
+
if (!context) {
|
|
912
|
+
return;
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
const binding = this.#bindings.get(name);
|
|
916
|
+
await binding?.run(context, seq, args, isTrivial);
|
|
917
|
+
}
|
|
918
|
+
|
|
921
919
|
#onDialog(event: Protocol.Page.JavascriptDialogOpeningEvent): void {
|
|
922
920
|
const type = validateDialogType(event.type);
|
|
923
921
|
const dialog = new CdpDialog(
|
|
@@ -14,16 +14,14 @@ import {debugError} from '../common/util.js';
|
|
|
14
14
|
|
|
15
15
|
import {ExecutionContext} from './ExecutionContext.js';
|
|
16
16
|
import {IsolatedWorld} from './IsolatedWorld.js';
|
|
17
|
-
import {CdpJSHandle} from './JSHandle.js';
|
|
18
17
|
import type {NetworkManager} from './NetworkManager.js';
|
|
19
18
|
|
|
20
19
|
/**
|
|
21
20
|
* @internal
|
|
22
21
|
*/
|
|
23
22
|
export type ConsoleAPICalledCallback = (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
trace?: Protocol.Runtime.StackTrace,
|
|
23
|
+
world: IsolatedWorld,
|
|
24
|
+
event: Protocol.Runtime.ConsoleAPICalledEvent,
|
|
27
25
|
) => void;
|
|
28
26
|
|
|
29
27
|
/**
|
|
@@ -64,13 +62,7 @@ export class CdpWebWorker extends WebWorker {
|
|
|
64
62
|
});
|
|
65
63
|
this.#world.emitter.on('consoleapicalled', async event => {
|
|
66
64
|
try {
|
|
67
|
-
return consoleAPICalled(
|
|
68
|
-
event.type,
|
|
69
|
-
event.args.map((object: Protocol.Runtime.RemoteObject) => {
|
|
70
|
-
return new CdpJSHandle(this.#world, object);
|
|
71
|
-
}),
|
|
72
|
-
event.stackTrace,
|
|
73
|
-
);
|
|
65
|
+
return consoleAPICalled(this.#world, event);
|
|
74
66
|
} catch (err) {
|
|
75
67
|
debugError(err);
|
|
76
68
|
}
|
|
@@ -65,6 +65,7 @@ export class ConsoleMessage {
|
|
|
65
65
|
#stackTraceLocations: ConsoleMessageLocation[];
|
|
66
66
|
#frame?: Frame;
|
|
67
67
|
#rawStackTrace?: Protocol.Runtime.StackTrace;
|
|
68
|
+
#targetId?: string;
|
|
68
69
|
|
|
69
70
|
/**
|
|
70
71
|
* @internal
|
|
@@ -76,6 +77,7 @@ export class ConsoleMessage {
|
|
|
76
77
|
stackTraceLocations: ConsoleMessageLocation[],
|
|
77
78
|
frame?: Frame,
|
|
78
79
|
rawStackTrace?: Protocol.Runtime.StackTrace,
|
|
80
|
+
targetId?: string,
|
|
79
81
|
) {
|
|
80
82
|
this.#type = type;
|
|
81
83
|
this.#text = text;
|
|
@@ -83,6 +85,7 @@ export class ConsoleMessage {
|
|
|
83
85
|
this.#stackTraceLocations = stackTraceLocations;
|
|
84
86
|
this.#frame = frame;
|
|
85
87
|
this.#rawStackTrace = rawStackTrace;
|
|
88
|
+
this.#targetId = targetId;
|
|
86
89
|
}
|
|
87
90
|
|
|
88
91
|
/**
|
|
@@ -131,4 +134,13 @@ export class ConsoleMessage {
|
|
|
131
134
|
_rawStackTrace(): Protocol.Runtime.StackTrace | undefined {
|
|
132
135
|
return this.#rawStackTrace;
|
|
133
136
|
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* The targetId from which this console message originated.
|
|
140
|
+
*
|
|
141
|
+
* @internal
|
|
142
|
+
*/
|
|
143
|
+
_targetId(): string | undefined {
|
|
144
|
+
return this.#targetId;
|
|
145
|
+
}
|
|
134
146
|
}
|
|
@@ -133,7 +133,7 @@ export interface CookieParam {
|
|
|
133
133
|
*/
|
|
134
134
|
priority?: CookiePriority;
|
|
135
135
|
/**
|
|
136
|
-
*
|
|
136
|
+
* @deprecated Always ignored.
|
|
137
137
|
*/
|
|
138
138
|
sameParty?: boolean;
|
|
139
139
|
/**
|
|
@@ -193,7 +193,7 @@ export interface CookieData {
|
|
|
193
193
|
*/
|
|
194
194
|
priority?: CookiePriority;
|
|
195
195
|
/**
|
|
196
|
-
*
|
|
196
|
+
* @deprecated Always set to false. Supported only in Chrome.
|
|
197
197
|
*/
|
|
198
198
|
sameParty?: boolean;
|
|
199
199
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Name: source-map-scopes-codec
|
|
2
2
|
Short Name: source-map-scopes-codec
|
|
3
3
|
URL: https://github.com/ChromeDevTools/source-map-scopes-codec
|
|
4
|
-
Version: 0.
|
|
5
|
-
Revision:
|
|
4
|
+
Version: 0.6.1
|
|
5
|
+
Revision: d37113f9300493afbffea7b960afd8ba2e9d816a
|
|
6
6
|
License: BSD-3-Clause
|
|
7
7
|
License File: LICENSE
|
|
8
8
|
Security Critical: no
|
|
@@ -26,6 +26,3 @@ then (use the URL shown by the above command)
|
|
|
26
26
|
rm -rf package
|
|
27
27
|
wget -qO- https://npm.jsr.io/\~/11/@jsr/chrome-devtools__source-map-scopes-codec/0.3.1.tgz | tar xzf -
|
|
28
28
|
```
|
|
29
|
-
|
|
30
|
-
Modifications:
|
|
31
|
-
Added a BUILD.gn file to package/src as esbuild would place output files otherwise in the wrong location.
|
package/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/builder.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Binding, GeneratedRange, OriginalPosition, OriginalScope, ScopeInfo } from "
|
|
1
|
+
import type { Binding, GeneratedRange, OriginalPosition, OriginalScope, ScopeInfo } from "../scopes.js";
|
|
2
2
|
/**
|
|
3
3
|
* Small utility class to build scope and range trees.
|
|
4
4
|
*
|
package/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/builder.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.d.ts","sources":["../../../src/builder/builder.ts"],"names":[],"mappings":"AAIA,cACE,OAAO,EACP,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,SAAS,
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sources":["../../../src/builder/builder.ts"],"names":[],"mappings":"AAIA,cACE,OAAO,EACP,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,SAAS,uBACW;AAEtB;;;;;;;;;CASC,GACD,OAAO,cAAM;EAWX,gBAAgB,IAAI;EAKpB,WACE,MAAM,MAAM,EACZ,QAAQ,MAAM,EACd;IACE,OAAO,MAAM;IACb,OAAO,MAAM;IACb,eAAe,OAAO;IACtB,YAAY,MAAM;IAClB,MAAM;GACP,GACA,IAAI;EAsBP,aAAa,MAAM,MAAM,GAAG,IAAI;EAMhC,aAAa,MAAM,MAAM,GAAG,IAAI;EAMhC,mBAAmB,cAAc,OAAO,GAAG,IAAI;EAM/C,kBAAkB,WAAW,MAAM,EAAE,GAAG,IAAI;EAO5C,SAAS,MAAM,MAAM,EAAE,QAAQ,MAAM,GAAG,IAAI;EAgB5C;;GAEC,GACD,gBAAgB,gBAAgB,IAAI;EAIpC;;GAEC,GACD,aAAa,gBAAgB,IAAI;EAIjC;;;GAGC,GACD,WACE,MAAM,MAAM,EACZ,QAAQ,MAAM,EACd;IACE,QAAQ;IACR,WAAW;IACX,eAAe,OAAO;IACtB,WAAW,OAAO;IAClB,SAAS;IACT,WAAW;GACZ,GACA,IAAI;EA6BP,wBAAwB,OAAO,aAAa,GAAG,IAAI;EAMnD,2BAA2B,UAAU,QAAQ,GAAG,IAAI;EAMpD,mBAAmB,cAAc,OAAO,GAAG,IAAI;EAO/C,eAAe,UAAU,OAAO,GAAG,IAAI;EAOvC,eAAe,QAAQ,SAAS,GAAG,IAAI;EAOvC,iBAAiB,UAAU,gBAAgB,GAAG,IAAI;EAOlD,SAAS,MAAM,MAAM,EAAE,QAAQ,MAAM,GAAG,IAAI;EAe5C,SAAS;EAUT,cAAc,cAAc,cAAc;EAI1C,cAAc,cAAc,cAAc;EAI1C,UAAU,aAAa,OAAO,aAAa,GAAG,OAAO;EAIrD,UAAU,gBAAgB,KAAK,QAAQ,GAAG,OAAO;EAIjD,UAAU,mBAAmB,KAAK,QAAQ,GAAG;AAG/C;AAEA;;;;;CAKC,GACD,YAAY,WAAW,OAAO"}
|
package/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/safe_builder.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Binding, OriginalPosition, OriginalScope, ScopeInfo } from "
|
|
1
|
+
import type { Binding, OriginalPosition, OriginalScope, ScopeInfo } from "../scopes.js";
|
|
2
2
|
import { ScopeInfoBuilder, type ScopeKey } from "./builder.js";
|
|
3
3
|
/**
|
|
4
4
|
* Similar to `ScopeInfoBuilder`, but with checks that scopes/ranges are well
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safe_builder.d.ts","sources":["../../../src/builder/safe_builder.ts"],"names":[],"mappings":"AAIA,cACE,OAAO,EACP,gBAAgB,EAChB,aAAa,EAEb,SAAS,
|
|
1
|
+
{"version":3,"file":"safe_builder.d.ts","sources":["../../../src/builder/safe_builder.ts"],"names":[],"mappings":"AAIA,cACE,OAAO,EACP,gBAAgB,EAChB,aAAa,EAEb,SAAS,uBACW;AAEtB,SAAS,gBAAgB,EAAE,KAAK,QAAQ,uBAAuB;AAE/D;;;CAGC,GACD,OAAO,cAAM,6BAA6B;EACxC,SAAS,gBAAgB,IAAI;EAQ7B,SAAS,WACP,MAAM,MAAM,EACZ,QAAQ,MAAM,EACd;IACE,OAAO,MAAM;IACb,OAAO,MAAM;IACb,eAAe,OAAO;IACtB,YAAY,MAAM;IAClB,MAAM;GACP,GACA,IAAI;EA2BP,SAAS,aAAa,MAAM,MAAM,GAAG,IAAI;EAQzC,SAAS,aAAa,MAAM,MAAM,GAAG,IAAI;EAQzC,SAAS,mBAAmB,cAAc,OAAO,GAAG,IAAI;EAQxD,SAAS,kBAAkB,WAAW,MAAM,EAAE,GAAG,IAAI;EAQrD,SAAS,SAAS,MAAM,MAAM,EAAE,QAAQ,MAAM,GAAG,IAAI;EAkBrD,SAAS,WACP,MAAM,MAAM,EACZ,QAAQ,MAAM,EACd;IACE,QAAQ;IACR,WAAW;IACX,eAAe,OAAO;IACtB,WAAW,OAAO;IAClB,SAAS;IACT,WAAW;GACZ,GACA,IAAI;EA6DP,SAAS,wBAAwB,OAAO,aAAa,GAAG,IAAI;EAc5D,SAAS,2BAA2B,UAAU,QAAQ,GAAG,IAAI;EAc7D,SAAS,mBAAmB,cAAc,OAAO,GAAG,IAAI;EAQxD,SAAS,eAAe,UAAU,OAAO,GAAG,IAAI;EAQhD,SAAS,eAAe,QAAQ,SAAS,GAAG,IAAI;EAmBhD,SAAS,iBAAiB,UAAU,gBAAgB,GAAG,IAAI;EAQ3D,SAAS,SAAS,MAAM,MAAM,EAAE,QAAQ,MAAM,GAAG,IAAI;EAmBrD,SAAS,SAAS;AAkFpB"}
|
package/front_end/third_party/source-map-scopes-codec/package/_dist/src/decode/decode.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decode.d.ts","sources":["../../../src/decode/decode.ts"],"names":[],"mappings":"AAWA,cAIE,QAAQ,EACR,SAAS,EACT,SAAS,
|
|
1
|
+
{"version":3,"file":"decode.d.ts","sources":["../../../src/decode/decode.ts"],"names":[],"mappings":"AAWA,cAIE,QAAQ,EACR,SAAS,EACT,SAAS,uBAGW;AAGtB;;;;;;;;;;;;;CAaC,GACD,0BAAkB;EAChB,SAAS;EACT,MAAM;;AAGR,iBAAiB;EACf,MAAM;EAEN;;;;;GAKC,GACD,iBAAiB;;AAQnB,OAAO,iBAAS,OACd,WAAW,SAAS,EACpB,UAAS,QAAQ,cAAuC,GACvD"}
|
package/front_end/third_party/source-map-scopes-codec/package/_dist/src/encode/encode.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encode.d.ts","sources":["../../../src/encode/encode.ts"],"names":[],"mappings":"AAIA,cAAc,SAAS,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"encode.d.ts","sources":["../../../src/encode/encode.ts"],"names":[],"mappings":"AAIA,cAAc,SAAS,EAAE,aAAa,uBAAuB;AAG7D;;;;;CAKC,GACD,OAAO,iBAAS,OACd,YAAY,SAAS,EACrB,iBAAiB,aAAa,GAC7B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { Binding, GeneratedRange, OriginalPosition, OriginalScope, Position, ScopeInfo, SourceMapJson, SubRangeBinding } from "
|
|
1
|
+
export type { Binding, GeneratedRange, OriginalPosition, OriginalScope, Position, ScopeInfo, SourceMapJson, SubRangeBinding } from "./scopes.js";
|
|
2
2
|
export { encode } from "./encode/encode.js";
|
|
3
3
|
export { decode, DecodeMode } from "./decode/decode.js";
|
|
4
4
|
export { ScopeInfoBuilder } from "./builder/builder.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sources":["../../src/mod.ts"],"names":[],"mappings":"AAIA,cACE,OAAO,EACP,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,QAAQ,EACR,SAAS,EACT,aAAa,EACb,eAAe,
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sources":["../../src/mod.ts"],"names":[],"mappings":"AAIA,cACE,OAAO,EACP,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,QAAQ,EACR,SAAS,EACT,aAAa,EACb,eAAe,sBACI;AAErB,SAAS,MAAM,6BAA6B;AAC5C,SAAS,MAAM,EAAE,UAAU,6BAA6B;AAExD,SAAS,gBAAgB,+BAA+B;AACxD,SAAS,oBAAoB,oCAAoC"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The decoded scopes information found in a source map.
|
|
3
|
+
*/ export interface ScopeInfo {
|
|
4
|
+
/**
|
|
5
|
+
* The length of {@linkcode scopes} must match the length of "sources" in the source map JSON. Each entry describes the scope tree of the corresponding source file.
|
|
6
|
+
*/ scopes: (OriginalScope | null)[];
|
|
7
|
+
/**
|
|
8
|
+
* The range tree of the generated bundle. Multiple top-level ranges are allowed but must not overlap source position wise.
|
|
9
|
+
*/ ranges: GeneratedRange[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A scope in the authored source.
|
|
13
|
+
*/ export interface OriginalScope {
|
|
14
|
+
/** The beginning of this scope (inclusive). */ start: Position;
|
|
15
|
+
/** The end of this scope (exclusive) */ end: Position;
|
|
16
|
+
/**
|
|
17
|
+
* The name of this scope. For function scopes this is the function name.
|
|
18
|
+
*
|
|
19
|
+
* Constructors may put the class name here.
|
|
20
|
+
*/ name?: string;
|
|
21
|
+
/**
|
|
22
|
+
* JavaScript-like languages are encouraged to use 'Global', 'Class', 'Function' and 'Block'.
|
|
23
|
+
*
|
|
24
|
+
* The "kind" is only used in debuggers as a label for scope UI views, but does not have any
|
|
25
|
+
* semantic significance.
|
|
26
|
+
*/ kind?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Whether this scope is something that can be called and results in stack frame (e.g. functions, methods, etc.).
|
|
29
|
+
*/ isStackFrame: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* All variable names that this scope declares.
|
|
32
|
+
*/ variables: string[];
|
|
33
|
+
/**
|
|
34
|
+
* The child scopes. When manually building scopes, {@linkcode children} must be sorted, not
|
|
35
|
+
* overlap each other and be contained within [start, end).
|
|
36
|
+
*/ children: OriginalScope[];
|
|
37
|
+
/** The parent scope or `undefined` for top-level scopes. */ parent?: OriginalScope;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A range (can be a scope) in the generated JavaScript/WASM.
|
|
41
|
+
*
|
|
42
|
+
* The name "range" was chosen deliberately as a GeneratedRange does not necessarily
|
|
43
|
+
* correspond to a lexical JavaScript scope. E.g. inlining, or concatenating multiple
|
|
44
|
+
* bundles can result in generated ranges that are not lexical scopes.
|
|
45
|
+
*/ export interface GeneratedRange {
|
|
46
|
+
/** The beginning of this range (inclusive) */ start: Position;
|
|
47
|
+
/** The end of this range (exclusive) */ end: Position;
|
|
48
|
+
/**
|
|
49
|
+
* The corresponding scope in the authored source.
|
|
50
|
+
*/ originalScope?: OriginalScope;
|
|
51
|
+
/**
|
|
52
|
+
* Whether this generated range is an actual JavaScript/WASM function in the generated code.
|
|
53
|
+
*/ isStackFrame: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Whether calls to this generated range should be hidden from stack traces even if
|
|
56
|
+
* this range has an `originalScope`.
|
|
57
|
+
*/ isHidden: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* If this `GeneratedRange` is the result of inlining `originalScope`, then `callSite`
|
|
60
|
+
* refers to where `originalScope` was called in the original ("authored") code.
|
|
61
|
+
*
|
|
62
|
+
* If this field is present than `originalScope` is present as well and `isStackFrame` is `false`.
|
|
63
|
+
*/ callSite?: OriginalPosition;
|
|
64
|
+
/**
|
|
65
|
+
* Expressions that compute the values of the variables of this OriginalScope. The length
|
|
66
|
+
* of `values` matches the length of `originalScope.variables`.
|
|
67
|
+
*/ values: Binding[];
|
|
68
|
+
/**
|
|
69
|
+
* The child ranges. When manually building ranges, {@linkcode children} must be sorted,
|
|
70
|
+
* not overlap each other and be contained within [start, end).
|
|
71
|
+
*/ children: GeneratedRange[];
|
|
72
|
+
/** The parent range or `undefined` for top-level ranges. */ parent?: GeneratedRange;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* For each variable, this can either be:
|
|
76
|
+
*
|
|
77
|
+
* 1) A single expression (valid for a full `GeneratedRange`).
|
|
78
|
+
*
|
|
79
|
+
* 2) `null` if this variable is unavailable in the whole range. This can
|
|
80
|
+
* happen e.g. when the variable was optimized out and can't be recomputed.
|
|
81
|
+
*
|
|
82
|
+
* 3) A list of `SubRangeBinding`s. Used when computing the value requires different
|
|
83
|
+
* expressions throughout the `GeneratedRange` or if the variable is unavailable in
|
|
84
|
+
* parts of the `GeneratedRange`.
|
|
85
|
+
*
|
|
86
|
+
* Note: The decoder produces `SubRangeBindings` where the "from" of the first `SubRangeBinding`
|
|
87
|
+
* and the "to" of the last `SubRangeBinding` are equal to the `GeneratedRange`s "start" and "end"
|
|
88
|
+
* position respectively.
|
|
89
|
+
*/ export type Binding = string | null | SubRangeBinding[];
|
|
90
|
+
export interface SubRangeBinding {
|
|
91
|
+
value?: string;
|
|
92
|
+
from: Position;
|
|
93
|
+
to: Position;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* A position with 0-based line and column numbers.
|
|
97
|
+
*
|
|
98
|
+
* A {@linkcode Position} object by itself does not imply a position in original source
|
|
99
|
+
* or generated code. It is used in both and normally it is clear from context.
|
|
100
|
+
*/ export interface Position {
|
|
101
|
+
line: number;
|
|
102
|
+
column: number;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* A position with 0-based line and column numbers in a specific original source file.
|
|
106
|
+
*/ export interface OriginalPosition extends Position {
|
|
107
|
+
/** The 0-based index into "sources" in the source map. Or into {@linkcode ScopeInfo.scopes}. */ sourceIndex: number;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* A standard source map, or index source map as per https://tc39.es/ecma426.
|
|
111
|
+
*/ export type SourceMap = SourceMapJson | IndexSourceMapJson;
|
|
112
|
+
/**
|
|
113
|
+
* A standard index source map json object as per https://tc39.es/ecma426.
|
|
114
|
+
*/ export interface IndexSourceMapJson {
|
|
115
|
+
version: 3;
|
|
116
|
+
sections: Array<{
|
|
117
|
+
offset: Position;
|
|
118
|
+
map: SourceMapJson;
|
|
119
|
+
}>;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* A standard source map json object as per https://tc39.es/ecma426.
|
|
123
|
+
*/ export interface SourceMapJson {
|
|
124
|
+
version: 3;
|
|
125
|
+
sources: (string | null)[];
|
|
126
|
+
mappings: string;
|
|
127
|
+
names?: string[];
|
|
128
|
+
scopes?: string;
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=scopes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scopes.d.ts","sources":["../../src/scopes.ts"],"names":[],"mappings":"AAIA;;CAEC,GACD,iBAAiB;EACf;;GAEC,GACD,SAAS,gBAAgB,IAAI;EAE7B;;GAEC,GACD,QAAQ;;AAGV;;CAEC,GACD,iBAAiB;EACf,6CAA6C,GAC7C,OAAO;EAEP,sCAAsC,GACtC,KAAK;EAEL;;;;GAIC,GACD,OAAO,MAAM;EAEb;;;;;GAKC,GACD,OAAO,MAAM;EAEb;;GAEC,GACD,cAAc,OAAO;EAErB;;GAEC,GACD,WAAW,MAAM;EAEjB;;;GAGC,GACD,UAAU;EAEV,0DAA0D,GAC1D,SAAS;;AAGX;;;;;;CAMC,GACD,iBAAiB;EACf,4CAA4C,GAC5C,OAAO;EAEP,sCAAsC,GACtC,KAAK;EAEL;;GAEC,GACD,gBAAgB;EAEhB;;GAEC,GACD,cAAc,OAAO;EAErB;;;GAGC,GACD,UAAU,OAAO;EAEjB;;;;;GAKC,GACD,WAAW;EAEX;;;GAGC,GACD,QAAQ;EAER;;;GAGC,GACD,UAAU;EAEV,0DAA0D,GAC1D,SAAS;;AAGX;;;;;;;;;;;;;;;CAeC,GACD,YAAY,UAAU,MAAM,GAAG,IAAI,GAAG;AAEtC,iBAAiB;EACf,QAAQ,MAAM;EACd,MAAM;EACN,IAAI;;AAGN;;;;;CAKC,GACD,iBAAiB;EACf,MAAM,MAAM;EACZ,QAAQ,MAAM;;AAGhB;;CAEC,GACD,iBAAiB,yBAAyB;EACxC,8FAA8F,GAC9F,aAAa,MAAM;;AAGrB;;CAEC,GACD,YAAY,YAAY,gBAAgB;AAExC;;CAEC,GACD,iBAAiB;EACf,SAAS;EACT,UAAU;IAAQ,QAAQ;IAAU,KAAK;;;AAG3C;;CAEC,GACD,iBAAiB;EACf,SAAS;EACT,UAAU,MAAM,GAAG,IAAI;EACvB,UAAU,MAAM;EAChB,QAAQ,MAAM;EACd,SAAS,MAAM"}
|