chrome-devtools-frontend 1.0.927127 → 1.0.928589
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/AUTHORS +1 -0
- package/config/gni/all_devtools_files.gni +0 -1
- package/config/gni/devtools_grd_files.gni +30 -4
- package/config/gni/devtools_image_files.gni +1 -0
- package/front_end/Images/src/ic_preview_feature.svg +3 -0
- package/front_end/Tests.js +2 -3
- package/front_end/core/common/Settings.ts +26 -45
- package/front_end/core/host/UserMetrics.ts +2 -2
- package/front_end/core/i18n/locales/en-US.json +60 -15
- package/front_end/core/i18n/locales/en-XL.json +60 -15
- package/front_end/core/platform/keyboard-utilities.ts +1 -0
- package/front_end/core/root/Runtime.ts +62 -61
- package/front_end/core/sdk/AccessibilityModel.ts +73 -73
- package/front_end/core/sdk/CPUProfileDataModel.ts +14 -14
- package/front_end/core/sdk/CPUProfilerModel.ts +33 -33
- package/front_end/core/sdk/CPUThrottlingManager.ts +8 -8
- package/front_end/core/sdk/CSSFontFace.ts +10 -10
- package/front_end/core/sdk/CSSMatchedStyles.ts +114 -114
- package/front_end/core/sdk/CSSMedia.ts +22 -22
- package/front_end/core/sdk/CSSMetadata.ts +53 -49
- package/front_end/core/sdk/CSSModel.ts +139 -135
- package/front_end/core/sdk/CSSProperty.ts +18 -18
- package/front_end/core/sdk/CSSRule.ts +15 -15
- package/front_end/core/sdk/CSSStyleDeclaration.ts +49 -47
- package/front_end/core/sdk/CSSStyleSheetHeader.ts +12 -12
- package/front_end/core/sdk/ChildTargetManager.ts +41 -40
- package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +10 -10
- package/front_end/core/sdk/Connections.ts +81 -81
- package/front_end/core/sdk/ConsoleModel.ts +68 -68
- package/front_end/core/sdk/Cookie.ts +48 -48
- package/front_end/core/sdk/CookieModel.ts +13 -13
- package/front_end/core/sdk/CookieParser.ts +45 -45
- package/front_end/core/sdk/DOMDebuggerModel.ts +131 -131
- package/front_end/core/sdk/DOMModel.ts +264 -252
- package/front_end/core/sdk/DebuggerModel.ts +209 -205
- package/front_end/core/sdk/EmulationModel.ts +76 -76
- package/front_end/core/sdk/FilmStripModel.ts +29 -29
- package/front_end/core/sdk/FrameManager.ts +43 -42
- package/front_end/core/sdk/HeapProfilerModel.ts +36 -36
- package/front_end/core/sdk/IsolateManager.ts +82 -82
- package/front_end/core/sdk/IssuesModel.ts +6 -6
- package/front_end/core/sdk/LayerTreeBase.ts +37 -37
- package/front_end/core/sdk/LogModel.ts +5 -5
- package/front_end/core/sdk/NetworkManager.ts +229 -225
- package/front_end/core/sdk/NetworkRequest.ts +368 -360
- package/front_end/core/sdk/OverlayColorGenerator.ts +9 -9
- package/front_end/core/sdk/OverlayModel.ts +155 -153
- package/front_end/core/sdk/OverlayPersistentHighlighter.ts +100 -101
- package/front_end/core/sdk/PageResourceLoader.ts +30 -30
- package/front_end/core/sdk/PaintProfiler.ts +16 -16
- package/front_end/core/sdk/PerformanceMetricsModel.ts +12 -12
- package/front_end/core/sdk/ProfileTreeModel.ts +3 -3
- package/front_end/core/sdk/RemoteObject.ts +108 -104
- package/front_end/core/sdk/Resource.ts +85 -84
- package/front_end/core/sdk/ResourceTreeModel.ts +150 -145
- package/front_end/core/sdk/RuntimeModel.ts +38 -34
- package/front_end/core/sdk/SDKModel.ts +3 -3
- package/front_end/core/sdk/ScreenCaptureModel.ts +19 -19
- package/front_end/core/sdk/Script.ts +29 -29
- package/front_end/core/sdk/SecurityOriginManager.ts +19 -19
- package/front_end/core/sdk/ServerTiming.ts +2 -2
- package/front_end/core/sdk/ServiceWorkerCacheModel.ts +43 -43
- package/front_end/core/sdk/ServiceWorkerManager.ts +72 -68
- package/front_end/core/sdk/SourceMap.ts +40 -36
- package/front_end/core/sdk/SourceMapManager.ts +57 -57
- package/front_end/core/sdk/Target.ts +64 -63
- package/front_end/core/sdk/TargetManager.ts +60 -56
- package/front_end/core/sdk/TracingManager.ts +39 -39
- package/front_end/core/sdk/TracingModel.ts +125 -125
- package/front_end/core/sdk/WebAuthnModel.ts +9 -9
- package/front_end/entrypoints/lighthouse_worker/{LighthouseService.js → LighthouseService.ts} +20 -45
- package/front_end/entrypoints/lighthouse_worker/{lighthouse_worker.js → lighthouse_worker.ts} +0 -0
- package/front_end/entrypoints/main/MainImpl.ts +7 -2
- package/front_end/legacy_test_runner/elements_test_runner/ElementsTestRunner.js +4 -4
- package/front_end/legacy_test_runner/sdk_test_runner/sdk_test_runner.js +1 -1
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +0 -6
- package/front_end/models/issues_manager/GenericIssue.ts +86 -0
- package/front_end/models/issues_manager/Issue.ts +24 -0
- package/front_end/models/issues_manager/IssuesManager.ts +18 -6
- package/front_end/models/issues_manager/descriptions/genericCrossOriginPortalPostMessageError.md +3 -0
- package/front_end/models/issues_manager/issues_manager.ts +2 -0
- package/front_end/models/javascript_metadata/NativeFunctions.js +5422 -1
- package/front_end/panels/console/ConsoleSidebar.ts +0 -3
- package/front_end/panels/elements/ElementsTreeElement.ts +53 -61
- package/front_end/panels/elements/ElementsTreeOutline.ts +0 -1
- package/front_end/panels/elements/components/LayoutPane.ts +5 -1
- package/front_end/panels/issues/GenericIssueDetailsView.ts +68 -0
- package/front_end/panels/issues/IssueAggregator.ts +16 -0
- package/front_end/panels/issues/IssueKindView.ts +95 -0
- package/front_end/panels/issues/IssueView.ts +6 -0
- package/front_end/panels/issues/IssuesPane.ts +81 -18
- package/front_end/panels/issues/issuesTree.css +8 -3
- package/front_end/panels/lighthouse/LighthouseController.ts +3 -1
- package/front_end/panels/network/NetworkItemView.ts +1 -1
- package/front_end/panels/network/networkLogView.css +5 -0
- package/front_end/panels/sensors/LocationsSettingsTab.ts +1 -1
- package/front_end/panels/settings/SettingsScreen.ts +1 -0
- package/front_end/panels/settings/settingsScreen.css +24 -0
- package/front_end/panels/snippets/SnippetsQuickOpen.ts +8 -3
- package/front_end/panels/sources/TabbedEditorContainer.ts +1 -1
- package/front_end/panels/sources/sources-meta.ts +22 -7
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/package.json +4 -4
- package/front_end/ui/components/code_highlighter/CodeHighlighter.ts +137 -0
- package/front_end/ui/components/code_highlighter/codeHighlighter.css +51 -0
- package/front_end/ui/components/code_highlighter/code_highlighter.ts +11 -0
- package/front_end/ui/components/docs/text_editor/basic.html +28 -0
- package/front_end/ui/components/docs/text_editor/basic.ts +14 -0
- package/front_end/ui/components/docs/text_prompt/basic.html +35 -0
- package/front_end/ui/components/docs/text_prompt/basic.ts +19 -0
- package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +1 -0
- package/front_end/ui/components/render_coordinator/RenderCoordinator.ts +17 -0
- package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +1 -0
- package/front_end/ui/components/text_editor/TextEditor.ts +161 -0
- package/front_end/ui/components/text_editor/config.ts +264 -0
- package/front_end/{panels/console/components/components.ts → ui/components/text_editor/text_editor.ts} +2 -5
- package/front_end/ui/components/text_editor/theme.ts +113 -0
- package/front_end/ui/components/text_prompt/TextPrompt.ts +144 -0
- package/front_end/ui/components/text_prompt/textPrompt.css +33 -0
- package/front_end/ui/components/text_prompt/text_prompt.ts +9 -0
- package/front_end/ui/legacy/ARIAUtils.ts +14 -11
- package/front_end/ui/legacy/TabbedPane.ts +32 -3
- package/front_end/ui/legacy/UIUtils.ts +3 -1
- package/front_end/ui/legacy/View.ts +6 -0
- package/front_end/ui/legacy/ViewManager.ts +5 -1
- package/front_end/ui/legacy/ViewRegistration.ts +5 -0
- package/front_end/ui/legacy/XLink.ts +1 -1
- package/front_end/ui/legacy/closeButton.css +6 -0
- package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +8 -3
- package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +38 -38
- package/front_end/ui/legacy/components/quick_open/HelpQuickOpen.ts +10 -4
- package/front_end/ui/legacy/components/quick_open/QuickOpen.ts +23 -6
- package/front_end/ui/legacy/components/quick_open/filteredListWidget.css +14 -16
- package/front_end/ui/legacy/filter.css +1 -0
- package/front_end/ui/legacy/tabbedPane.css +24 -0
- package/front_end/ui/legacy/toolbar.css +5 -0
- package/inspector_overlay/main.ts +2 -1
- package/inspector_overlay/tool_screenshot.ts +8 -1
- package/package.json +1 -1
- package/scripts/build/rollup.config.js +9 -0
- package/scripts/migration/class-fields/migrate.js +56 -0
- package/scripts/migration/class-fields/package.json +5 -0
- package/front_end/panels/console/components/SidebarDeprecation.ts +0 -58
- package/front_end/panels/console/components/sidebarDeprecation.css +0 -17
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
// Copyright 2021 The Chromium Authors. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
1
5
|
/*
|
|
2
6
|
* Copyright (C) 2012 Google Inc. All rights reserved.
|
|
3
7
|
*
|
|
@@ -11,7 +15,7 @@
|
|
|
11
15
|
* copyright notice, this list of conditions and the following disclaimer
|
|
12
16
|
* in the documentation and/or other materials provided with the
|
|
13
17
|
* distribution.
|
|
14
|
-
* * Neither the name of Google Inc. nor the names of its
|
|
18
|
+
* * Neither the #name of Google Inc. nor the names of its
|
|
15
19
|
* contributors may be used to endorse or promote products derived from
|
|
16
20
|
* this software without specific prior written permission.
|
|
17
21
|
*
|
|
@@ -44,18 +48,18 @@ import {SDKModel} from './SDKModel.js';
|
|
|
44
48
|
|
|
45
49
|
export class RuntimeModel extends SDKModel<EventTypes> {
|
|
46
50
|
readonly agent: ProtocolProxyApi.RuntimeApi;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
readonly #executionContextById: Map<number, ExecutionContext>;
|
|
52
|
+
#executionContextComparatorInternal: (arg0: ExecutionContext, arg1: ExecutionContext) => number;
|
|
53
|
+
#hasSideEffectSupportInternal: boolean|null;
|
|
50
54
|
constructor(target: Target) {
|
|
51
55
|
super(target);
|
|
52
56
|
|
|
53
57
|
this.agent = target.runtimeAgent();
|
|
54
58
|
this.target().registerRuntimeDispatcher(new RuntimeDispatcher(this));
|
|
55
59
|
this.agent.invoke_enable();
|
|
56
|
-
this
|
|
57
|
-
this
|
|
58
|
-
this
|
|
60
|
+
this.#executionContextById = new Map();
|
|
61
|
+
this.#executionContextComparatorInternal = ExecutionContext.comparator;
|
|
62
|
+
this.#hasSideEffectSupportInternal = null;
|
|
59
63
|
|
|
60
64
|
if (Common.Settings.Settings.instance().moduleSetting('customFormatters').get()) {
|
|
61
65
|
this.agent.invoke_setCustomObjectFormatterEnabled({enabled: true});
|
|
@@ -82,17 +86,17 @@ export class RuntimeModel extends SDKModel<EventTypes> {
|
|
|
82
86
|
}
|
|
83
87
|
|
|
84
88
|
executionContexts(): ExecutionContext[] {
|
|
85
|
-
return [...this
|
|
89
|
+
return [...this.#executionContextById.values()].sort(this.executionContextComparator());
|
|
86
90
|
}
|
|
87
91
|
|
|
88
92
|
setExecutionContextComparator(comparator: (arg0: ExecutionContext, arg1: ExecutionContext) => number): void {
|
|
89
|
-
this
|
|
93
|
+
this.#executionContextComparatorInternal = comparator;
|
|
90
94
|
}
|
|
91
95
|
|
|
92
96
|
/** comparator
|
|
93
97
|
*/
|
|
94
98
|
executionContextComparator(): (arg0: ExecutionContext, arg1: ExecutionContext) => number {
|
|
95
|
-
return this
|
|
99
|
+
return this.#executionContextComparatorInternal;
|
|
96
100
|
}
|
|
97
101
|
|
|
98
102
|
defaultExecutionContext(): ExecutionContext|null {
|
|
@@ -105,24 +109,24 @@ export class RuntimeModel extends SDKModel<EventTypes> {
|
|
|
105
109
|
}
|
|
106
110
|
|
|
107
111
|
executionContext(id: number): ExecutionContext|null {
|
|
108
|
-
return this
|
|
112
|
+
return this.#executionContextById.get(id) || null;
|
|
109
113
|
}
|
|
110
114
|
|
|
111
115
|
executionContextCreated(context: Protocol.Runtime.ExecutionContextDescription): void {
|
|
112
116
|
const data = context.auxData || {isDefault: true};
|
|
113
117
|
const executionContext = new ExecutionContext(
|
|
114
118
|
this, context.id, context.uniqueId, context.name, context.origin, data['isDefault'], data['frameId']);
|
|
115
|
-
this
|
|
119
|
+
this.#executionContextById.set(executionContext.id, executionContext);
|
|
116
120
|
this.dispatchEventToListeners(Events.ExecutionContextCreated, executionContext);
|
|
117
121
|
}
|
|
118
122
|
|
|
119
123
|
executionContextDestroyed(executionContextId: number): void {
|
|
120
|
-
const executionContext = this
|
|
124
|
+
const executionContext = this.#executionContextById.get(executionContextId);
|
|
121
125
|
if (!executionContext) {
|
|
122
126
|
return;
|
|
123
127
|
}
|
|
124
128
|
this.debuggerModel().executionContextDestroyed(executionContext);
|
|
125
|
-
this
|
|
129
|
+
this.#executionContextById.delete(executionContextId);
|
|
126
130
|
this.dispatchEventToListeners(Events.ExecutionContextDestroyed, executionContext);
|
|
127
131
|
}
|
|
128
132
|
|
|
@@ -133,7 +137,7 @@ export class RuntimeModel extends SDKModel<EventTypes> {
|
|
|
133
137
|
executionContextsCleared(): void {
|
|
134
138
|
this.debuggerModel().globalObjectCleared();
|
|
135
139
|
const contexts = this.executionContexts();
|
|
136
|
-
this
|
|
140
|
+
this.#executionContextById.clear();
|
|
137
141
|
for (let i = 0; i < contexts.length; ++i) {
|
|
138
142
|
this.dispatchEventToListeners(Events.ExecutionContextDestroyed, contexts[i]);
|
|
139
143
|
}
|
|
@@ -412,7 +416,7 @@ export class RuntimeModel extends SDKModel<EventTypes> {
|
|
|
412
416
|
}
|
|
413
417
|
|
|
414
418
|
hasSideEffectSupport(): boolean|null {
|
|
415
|
-
return this
|
|
419
|
+
return this.#hasSideEffectSupportInternal;
|
|
416
420
|
}
|
|
417
421
|
|
|
418
422
|
async checkSideEffectSupport(): Promise<boolean> {
|
|
@@ -428,9 +432,9 @@ export class RuntimeModel extends SDKModel<EventTypes> {
|
|
|
428
432
|
throwOnSideEffect: true,
|
|
429
433
|
});
|
|
430
434
|
|
|
431
|
-
this
|
|
435
|
+
this.#hasSideEffectSupportInternal = response.getError() ? false : RuntimeModel.isSideEffectFailure(response);
|
|
432
436
|
|
|
433
|
-
return this
|
|
437
|
+
return this.#hasSideEffectSupportInternal;
|
|
434
438
|
}
|
|
435
439
|
|
|
436
440
|
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
@@ -497,42 +501,42 @@ export type EventTypes = {
|
|
|
497
501
|
};
|
|
498
502
|
|
|
499
503
|
class RuntimeDispatcher implements ProtocolProxyApi.RuntimeDispatcher {
|
|
500
|
-
|
|
504
|
+
readonly #runtimeModel: RuntimeModel;
|
|
501
505
|
constructor(runtimeModel: RuntimeModel) {
|
|
502
|
-
this
|
|
506
|
+
this.#runtimeModel = runtimeModel;
|
|
503
507
|
}
|
|
504
508
|
|
|
505
509
|
executionContextCreated({context}: Protocol.Runtime.ExecutionContextCreatedEvent): void {
|
|
506
|
-
this
|
|
510
|
+
this.#runtimeModel.executionContextCreated(context);
|
|
507
511
|
}
|
|
508
512
|
|
|
509
513
|
executionContextDestroyed({executionContextId}: Protocol.Runtime.ExecutionContextDestroyedEvent): void {
|
|
510
|
-
this
|
|
514
|
+
this.#runtimeModel.executionContextDestroyed(executionContextId);
|
|
511
515
|
}
|
|
512
516
|
|
|
513
517
|
executionContextsCleared(): void {
|
|
514
|
-
this
|
|
518
|
+
this.#runtimeModel.executionContextsCleared();
|
|
515
519
|
}
|
|
516
520
|
|
|
517
521
|
exceptionThrown({timestamp, exceptionDetails}: Protocol.Runtime.ExceptionThrownEvent): void {
|
|
518
|
-
this
|
|
522
|
+
this.#runtimeModel.exceptionThrown(timestamp, exceptionDetails);
|
|
519
523
|
}
|
|
520
524
|
|
|
521
525
|
exceptionRevoked({exceptionId}: Protocol.Runtime.ExceptionRevokedEvent): void {
|
|
522
|
-
this
|
|
526
|
+
this.#runtimeModel.exceptionRevoked(exceptionId);
|
|
523
527
|
}
|
|
524
528
|
|
|
525
529
|
consoleAPICalled({type, args, executionContextId, timestamp, stackTrace, context}:
|
|
526
530
|
Protocol.Runtime.ConsoleAPICalledEvent): void {
|
|
527
|
-
this
|
|
531
|
+
this.#runtimeModel.consoleAPICalled(type, args, executionContextId, timestamp, stackTrace, context);
|
|
528
532
|
}
|
|
529
533
|
|
|
530
534
|
inspectRequested({object, hints, executionContextId}: Protocol.Runtime.InspectRequestedEvent): void {
|
|
531
|
-
this
|
|
535
|
+
this.#runtimeModel.inspectRequested(object, hints, executionContextId);
|
|
532
536
|
}
|
|
533
537
|
|
|
534
538
|
bindingCalled(event: Protocol.Runtime.BindingCalledEvent): void {
|
|
535
|
-
this
|
|
539
|
+
this.#runtimeModel.bindingCalled(event);
|
|
536
540
|
}
|
|
537
541
|
}
|
|
538
542
|
|
|
@@ -540,7 +544,7 @@ export class ExecutionContext {
|
|
|
540
544
|
id: Protocol.Runtime.ExecutionContextId;
|
|
541
545
|
uniqueId: string;
|
|
542
546
|
name: string;
|
|
543
|
-
|
|
547
|
+
#labelInternal: string|null;
|
|
544
548
|
origin: string;
|
|
545
549
|
isDefault: boolean;
|
|
546
550
|
runtimeModel: RuntimeModel;
|
|
@@ -552,7 +556,7 @@ export class ExecutionContext {
|
|
|
552
556
|
this.id = id;
|
|
553
557
|
this.uniqueId = uniqueId;
|
|
554
558
|
this.name = name;
|
|
555
|
-
this
|
|
559
|
+
this.#labelInternal = null;
|
|
556
560
|
this.origin = origin;
|
|
557
561
|
this.isDefault = isDefault;
|
|
558
562
|
this.runtimeModel = runtimeModel;
|
|
@@ -702,7 +706,7 @@ export class ExecutionContext {
|
|
|
702
706
|
}
|
|
703
707
|
|
|
704
708
|
label(): string|null {
|
|
705
|
-
return this
|
|
709
|
+
return this.#labelInternal;
|
|
706
710
|
}
|
|
707
711
|
|
|
708
712
|
setLabel(label: string): void {
|
|
@@ -712,15 +716,15 @@ export class ExecutionContext {
|
|
|
712
716
|
|
|
713
717
|
private setLabelInternal(label: string): void {
|
|
714
718
|
if (label) {
|
|
715
|
-
this
|
|
719
|
+
this.#labelInternal = label;
|
|
716
720
|
return;
|
|
717
721
|
}
|
|
718
722
|
if (this.name) {
|
|
719
|
-
this
|
|
723
|
+
this.#labelInternal = this.name;
|
|
720
724
|
return;
|
|
721
725
|
}
|
|
722
726
|
const parsedUrl = Common.ParsedURL.ParsedURL.fromString(this.origin);
|
|
723
|
-
this
|
|
727
|
+
this.#labelInternal = parsedUrl ? parsedUrl.lastPathComponentWithFragment() : '';
|
|
724
728
|
}
|
|
725
729
|
}
|
|
726
730
|
|
|
@@ -17,15 +17,15 @@ const registeredModels = new Map<new (arg1: Target) => SDKModel, RegistrationInf
|
|
|
17
17
|
// all event emitters and sinks have been migrated.
|
|
18
18
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
19
|
export class SDKModel<Events = any> extends Common.ObjectWrapper.ObjectWrapper<Events> {
|
|
20
|
-
|
|
20
|
+
readonly #targetInternal: Target;
|
|
21
21
|
|
|
22
22
|
constructor(target: Target) {
|
|
23
23
|
super();
|
|
24
|
-
this
|
|
24
|
+
this.#targetInternal = target;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
target(): Target {
|
|
28
|
-
return this
|
|
28
|
+
return this.#targetInternal;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
/**
|
|
@@ -11,14 +11,14 @@ import {Capability} from './Target.js';
|
|
|
11
11
|
import {SDKModel} from './SDKModel.js';
|
|
12
12
|
|
|
13
13
|
export class ScreenCaptureModel extends SDKModel<void> implements ProtocolProxyApi.PageDispatcher {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
readonly #agent: ProtocolProxyApi.PageApi;
|
|
15
|
+
#onScreencastFrame: ((arg0: Protocol.binary, arg1: Protocol.Page.ScreencastFrameMetadata) => void)|null;
|
|
16
|
+
#onScreencastVisibilityChanged: ((arg0: boolean) => void)|null;
|
|
17
17
|
constructor(target: Target) {
|
|
18
18
|
super(target);
|
|
19
|
-
this
|
|
20
|
-
this
|
|
21
|
-
this
|
|
19
|
+
this.#agent = target.pageAgent();
|
|
20
|
+
this.#onScreencastFrame = null;
|
|
21
|
+
this.#onScreencastVisibilityChanged = null;
|
|
22
22
|
target.registerPageDispatcher(this);
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -27,22 +27,22 @@ export class ScreenCaptureModel extends SDKModel<void> implements ProtocolProxyA
|
|
|
27
27
|
maxHeight: number|undefined, everyNthFrame: number|undefined,
|
|
28
28
|
onFrame: (arg0: Protocol.binary, arg1: Protocol.Page.ScreencastFrameMetadata) => void,
|
|
29
29
|
onVisibilityChanged: (arg0: boolean) => void): void {
|
|
30
|
-
this
|
|
31
|
-
this
|
|
32
|
-
this
|
|
30
|
+
this.#onScreencastFrame = onFrame;
|
|
31
|
+
this.#onScreencastVisibilityChanged = onVisibilityChanged;
|
|
32
|
+
this.#agent.invoke_startScreencast({format, quality, maxWidth, maxHeight, everyNthFrame});
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
stopScreencast(): void {
|
|
36
|
-
this
|
|
37
|
-
this
|
|
38
|
-
this
|
|
36
|
+
this.#onScreencastFrame = null;
|
|
37
|
+
this.#onScreencastVisibilityChanged = null;
|
|
38
|
+
this.#agent.invoke_stopScreencast();
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
async captureScreenshot(
|
|
42
42
|
format: Protocol.Page.CaptureScreenshotRequestFormat, quality: number,
|
|
43
43
|
clip?: Protocol.Page.Viewport): Promise<string|null> {
|
|
44
44
|
await OverlayModel.muteHighlight();
|
|
45
|
-
const result = await this
|
|
45
|
+
const result = await this.#agent.invoke_captureScreenshot(
|
|
46
46
|
{format, quality, clip, fromSurface: true, captureBeyondViewport: true});
|
|
47
47
|
await OverlayModel.unmuteHighlight();
|
|
48
48
|
return result.data;
|
|
@@ -55,7 +55,7 @@ export class ScreenCaptureModel extends SDKModel<void> implements ProtocolProxyA
|
|
|
55
55
|
contentWidth: number,
|
|
56
56
|
contentHeight: number,
|
|
57
57
|
}|null> {
|
|
58
|
-
const response = await this
|
|
58
|
+
const response = await this.#agent.invoke_getLayoutMetrics();
|
|
59
59
|
if (response.getError()) {
|
|
60
60
|
return null;
|
|
61
61
|
}
|
|
@@ -69,15 +69,15 @@ export class ScreenCaptureModel extends SDKModel<void> implements ProtocolProxyA
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
screencastFrame({data, metadata, sessionId}: Protocol.Page.ScreencastFrameEvent): void {
|
|
72
|
-
this
|
|
73
|
-
if (this
|
|
74
|
-
this
|
|
72
|
+
this.#agent.invoke_screencastFrameAck({sessionId});
|
|
73
|
+
if (this.#onScreencastFrame) {
|
|
74
|
+
this.#onScreencastFrame.call(null, data, metadata);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
screencastVisibilityChanged({visible}: Protocol.Page.ScreencastVisibilityChangedEvent): void {
|
|
79
|
-
if (this
|
|
80
|
-
this
|
|
79
|
+
if (this.#onScreencastVisibilityChanged) {
|
|
80
|
+
this.#onScreencastVisibilityChanged.call(null, visible);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
|
|
@@ -63,18 +63,18 @@ export class Script implements TextUtils.ContentProvider.ContentProvider, FrameA
|
|
|
63
63
|
endColumn: number;
|
|
64
64
|
executionContextId: number;
|
|
65
65
|
hash: string;
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
readonly #isContentScriptInternal: boolean;
|
|
67
|
+
readonly #isLiveEditInternal: boolean;
|
|
68
68
|
sourceMapURL: string|undefined;
|
|
69
69
|
debugSymbols: Protocol.Debugger.DebugSymbols|null;
|
|
70
70
|
hasSourceURL: boolean;
|
|
71
71
|
contentLength: number;
|
|
72
|
-
|
|
72
|
+
#originalContentProviderInternal: TextUtils.ContentProvider.ContentProvider|null;
|
|
73
73
|
originStackTrace: Protocol.Runtime.StackTrace|null;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
readonly #codeOffsetInternal: number|null;
|
|
75
|
+
readonly #language: string|null;
|
|
76
|
+
#contentPromise: Promise<TextUtils.ContentProvider.DeferredContent>|null;
|
|
77
|
+
readonly #embedderNameInternal: string|null;
|
|
78
78
|
readonly isModule: boolean|null;
|
|
79
79
|
constructor(
|
|
80
80
|
debuggerModel: DebuggerModel, scriptId: Protocol.Runtime.ScriptId, sourceURL: string, startLine: number,
|
|
@@ -94,22 +94,22 @@ export class Script implements TextUtils.ContentProvider.ContentProvider, FrameA
|
|
|
94
94
|
|
|
95
95
|
this.executionContextId = executionContextId;
|
|
96
96
|
this.hash = hash;
|
|
97
|
-
this
|
|
98
|
-
this
|
|
97
|
+
this.#isContentScriptInternal = isContentScript;
|
|
98
|
+
this.#isLiveEditInternal = isLiveEdit;
|
|
99
99
|
this.sourceMapURL = sourceMapURL;
|
|
100
100
|
this.debugSymbols = debugSymbols;
|
|
101
101
|
this.hasSourceURL = hasSourceURL;
|
|
102
102
|
this.contentLength = length;
|
|
103
|
-
this
|
|
103
|
+
this.#originalContentProviderInternal = null;
|
|
104
104
|
this.originStackTrace = originStackTrace;
|
|
105
|
-
this
|
|
106
|
-
this
|
|
107
|
-
this
|
|
108
|
-
this
|
|
105
|
+
this.#codeOffsetInternal = codeOffset;
|
|
106
|
+
this.#language = scriptLanguage;
|
|
107
|
+
this.#contentPromise = null;
|
|
108
|
+
this.#embedderNameInternal = embedderName;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
embedderName(): string|null {
|
|
112
|
-
return this
|
|
112
|
+
return this.#embedderNameInternal;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
target(): Target {
|
|
@@ -136,23 +136,23 @@ export class Script implements TextUtils.ContentProvider.ContentProvider, FrameA
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
isContentScript(): boolean {
|
|
139
|
-
return this
|
|
139
|
+
return this.#isContentScriptInternal;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
codeOffset(): number|null {
|
|
143
|
-
return this
|
|
143
|
+
return this.#codeOffsetInternal;
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
isJavaScript(): boolean {
|
|
147
|
-
return this
|
|
147
|
+
return this.#language === Protocol.Debugger.ScriptLanguage.JavaScript;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
isWasm(): boolean {
|
|
151
|
-
return this
|
|
151
|
+
return this.#language === Protocol.Debugger.ScriptLanguage.WebAssembly;
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
scriptLanguage(): string|null {
|
|
155
|
-
return this
|
|
155
|
+
return this.#language;
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
executionContext(): ExecutionContext|null {
|
|
@@ -160,7 +160,7 @@ export class Script implements TextUtils.ContentProvider.ContentProvider, FrameA
|
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
isLiveEdit(): boolean {
|
|
163
|
-
return this
|
|
163
|
+
return this.#isLiveEditInternal;
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
contentURL(): string {
|
|
@@ -176,10 +176,10 @@ export class Script implements TextUtils.ContentProvider.ContentProvider, FrameA
|
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
requestContent(): Promise<TextUtils.ContentProvider.DeferredContent> {
|
|
179
|
-
if (!this
|
|
180
|
-
this
|
|
179
|
+
if (!this.#contentPromise) {
|
|
180
|
+
this.#contentPromise = this.originalContentProvider().requestContent();
|
|
181
181
|
}
|
|
182
|
-
return this
|
|
182
|
+
return this.#contentPromise;
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
async getWasmBytecode(): Promise<ArrayBuffer> {
|
|
@@ -189,10 +189,10 @@ export class Script implements TextUtils.ContentProvider.ContentProvider, FrameA
|
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
originalContentProvider(): TextUtils.ContentProvider.ContentProvider {
|
|
192
|
-
if (!this
|
|
192
|
+
if (!this.#originalContentProviderInternal) {
|
|
193
193
|
/* } */
|
|
194
194
|
let lazyContentPromise: Promise<TextUtils.ContentProvider.DeferredContent>|null;
|
|
195
|
-
this
|
|
195
|
+
this.#originalContentProviderInternal =
|
|
196
196
|
new TextUtils.StaticContentProvider.StaticContentProvider(this.contentURL(), this.contentType(), () => {
|
|
197
197
|
if (!lazyContentPromise) {
|
|
198
198
|
lazyContentPromise = (async(): Promise<{
|
|
@@ -232,7 +232,7 @@ export class Script implements TextUtils.ContentProvider.ContentProvider, FrameA
|
|
|
232
232
|
return lazyContentPromise;
|
|
233
233
|
});
|
|
234
234
|
}
|
|
235
|
-
return this
|
|
235
|
+
return this.#originalContentProviderInternal;
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
async searchInContent(query: string, caseSensitive: boolean, isRegex: boolean):
|
|
@@ -261,7 +261,7 @@ export class Script implements TextUtils.ContentProvider.ContentProvider, FrameA
|
|
|
261
261
|
arg2?: Array<Protocol.Debugger.CallFrame>|undefined, arg3?: Protocol.Runtime.StackTrace|undefined,
|
|
262
262
|
arg4?: Protocol.Runtime.StackTraceId|undefined, arg5?: boolean|undefined) => void): Promise<void> {
|
|
263
263
|
newSource = Script.trimSourceURLComment(newSource);
|
|
264
|
-
// We append correct sourceURL to script for consistency only. It's not actually needed for things to work correctly.
|
|
264
|
+
// We append correct #sourceURL to script for consistency only. It's not actually needed for things to work correctly.
|
|
265
265
|
newSource = this.appendSourceURLCommentIfNeeded(newSource);
|
|
266
266
|
|
|
267
267
|
if (!this.scriptId) {
|
|
@@ -278,7 +278,7 @@ export class Script implements TextUtils.ContentProvider.ContentProvider, FrameA
|
|
|
278
278
|
{scriptId: this.scriptId, scriptSource: newSource});
|
|
279
279
|
|
|
280
280
|
if (!response.getError() && !response.exceptionDetails) {
|
|
281
|
-
this
|
|
281
|
+
this.#contentPromise = Promise.resolve({content: newSource, isEncoded: false});
|
|
282
282
|
}
|
|
283
283
|
|
|
284
284
|
const needsStepIn = Boolean(response.stackChanged);
|
|
@@ -7,33 +7,33 @@ import {Capability} from './Target.js';
|
|
|
7
7
|
import {SDKModel} from './SDKModel.js';
|
|
8
8
|
|
|
9
9
|
export class SecurityOriginManager extends SDKModel<EventTypes> {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
#mainSecurityOriginInternal: string;
|
|
11
|
+
#unreachableMainSecurityOriginInternal: string|null;
|
|
12
|
+
#securityOriginsInternal: Set<string>;
|
|
13
13
|
constructor(target: Target) {
|
|
14
14
|
super(target);
|
|
15
15
|
|
|
16
16
|
// if a URL is unreachable, the browser will jump to an error page at
|
|
17
|
-
// 'chrome-error://chromewebdata/', and |this
|
|
17
|
+
// 'chrome-error://chromewebdata/', and |this.#mainSecurityOriginInternal| stores
|
|
18
18
|
// its origin. In this situation, the original unreachable URL's security
|
|
19
|
-
// origin will be stored in |this
|
|
20
|
-
this
|
|
21
|
-
this
|
|
19
|
+
// origin will be stored in |this.#unreachableMainSecurityOriginInternal|.
|
|
20
|
+
this.#mainSecurityOriginInternal = '';
|
|
21
|
+
this.#unreachableMainSecurityOriginInternal = '';
|
|
22
22
|
|
|
23
|
-
this
|
|
23
|
+
this.#securityOriginsInternal = new Set();
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
updateSecurityOrigins(securityOrigins: Set<string>): void {
|
|
27
|
-
const oldOrigins = this
|
|
28
|
-
this
|
|
27
|
+
const oldOrigins = this.#securityOriginsInternal;
|
|
28
|
+
this.#securityOriginsInternal = securityOrigins;
|
|
29
29
|
|
|
30
30
|
for (const origin of oldOrigins) {
|
|
31
|
-
if (!this
|
|
31
|
+
if (!this.#securityOriginsInternal.has(origin)) {
|
|
32
32
|
this.dispatchEventToListeners(Events.SecurityOriginRemoved, origin);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
for (const origin of this
|
|
36
|
+
for (const origin of this.#securityOriginsInternal) {
|
|
37
37
|
if (!oldOrigins.has(origin)) {
|
|
38
38
|
this.dispatchEventToListeners(Events.SecurityOriginAdded, origin);
|
|
39
39
|
}
|
|
@@ -41,23 +41,23 @@ export class SecurityOriginManager extends SDKModel<EventTypes> {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
securityOrigins(): string[] {
|
|
44
|
-
return [...this
|
|
44
|
+
return [...this.#securityOriginsInternal];
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
mainSecurityOrigin(): string {
|
|
48
|
-
return this
|
|
48
|
+
return this.#mainSecurityOriginInternal;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
unreachableMainSecurityOrigin(): string|null {
|
|
52
|
-
return this
|
|
52
|
+
return this.#unreachableMainSecurityOriginInternal;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
setMainSecurityOrigin(securityOrigin: string, unreachableSecurityOrigin: string): void {
|
|
56
|
-
this
|
|
57
|
-
this
|
|
56
|
+
this.#mainSecurityOriginInternal = securityOrigin;
|
|
57
|
+
this.#unreachableMainSecurityOriginInternal = unreachableSecurityOrigin || null;
|
|
58
58
|
this.dispatchEventToListeners(Events.MainSecurityOriginChanged, {
|
|
59
|
-
mainSecurityOrigin: this
|
|
60
|
-
unreachableMainSecurityOrigin: this
|
|
59
|
+
mainSecurityOrigin: this.#mainSecurityOriginInternal,
|
|
60
|
+
unreachableMainSecurityOrigin: this.#unreachableMainSecurityOriginInternal,
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
}
|
|
@@ -73,7 +73,7 @@ export class ServerTiming {
|
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
75
|
* TODO(crbug.com/1011811): Instead of using !Object<string, *> we should have a proper type
|
|
76
|
-
* with name, desc and dur properties.
|
|
76
|
+
* with #name, desc and dur properties.
|
|
77
77
|
*/
|
|
78
78
|
static createFromHeaderValue(valueString: string): {
|
|
79
79
|
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
@@ -165,7 +165,7 @@ export class ServerTiming {
|
|
|
165
165
|
const parseParameter = this.getParserForParameter(paramName);
|
|
166
166
|
let paramValue: (string|null)|null = null;
|
|
167
167
|
if (consumeDelimiter('=')) {
|
|
168
|
-
// always parse the value, even if we don't recognize the parameter name
|
|
168
|
+
// always parse the value, even if we don't recognize the parameter #name
|
|
169
169
|
paramValue = consumeTokenOrQuotedString();
|
|
170
170
|
consumeExtraneous();
|
|
171
171
|
}
|