chrome-devtools-frontend 1.0.1603822 → 1.0.1605219
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/front_end/Tests.js +23 -7
- package/front_end/core/host/AidaClient.ts +153 -525
- package/front_end/core/host/AidaClientTypes.ts +470 -0
- package/front_end/core/host/AidaGcaTranslation.ts +231 -122
- package/front_end/core/host/GcaClient.ts +112 -0
- package/front_end/core/host/GcaTypes.ts +107 -155
- package/front_end/core/host/UserMetrics.ts +0 -1
- package/front_end/core/host/host.ts +2 -0
- package/front_end/core/protocol_client/DevToolsCDPConnection.ts +1 -1
- package/front_end/core/root/ExperimentNames.ts +0 -1
- package/front_end/core/root/Runtime.ts +5 -0
- package/front_end/core/sdk/AutofillModel.ts +3 -2
- package/front_end/core/sdk/CSSModel.ts +3 -4
- package/front_end/core/sdk/CSSProperty.ts +1 -1
- package/front_end/core/sdk/ConsoleModel.ts +15 -13
- package/front_end/core/sdk/CookieModel.ts +5 -4
- package/front_end/core/sdk/DOMDebuggerModel.ts +20 -14
- package/front_end/core/sdk/DOMModel.ts +24 -22
- package/front_end/core/sdk/DebuggerModel.ts +21 -36
- package/front_end/core/sdk/EmulationModel.ts +21 -23
- package/front_end/core/sdk/EventBreakpointsModel.ts +16 -6
- package/front_end/core/sdk/HeapProfilerModel.ts +4 -7
- package/front_end/core/sdk/IsolateManager.ts +12 -7
- package/front_end/core/sdk/NetworkManager.ts +35 -28
- package/front_end/core/sdk/OverlayModel.ts +10 -10
- package/front_end/core/sdk/PreloadingModel.ts +3 -4
- package/front_end/core/sdk/ServiceWorkerManager.ts +2 -3
- package/front_end/core/sdk/SourceMapScopesInfo.ts +93 -63
- package/front_end/entrypoints/formatter_worker/FormatterWorker.ts +1 -3
- package/front_end/entrypoints/heap_snapshot_worker/AllocationProfile.ts +22 -48
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +1 -1
- package/front_end/entrypoints/main/MainImpl.ts +0 -4
- package/front_end/generated/InspectorBackendCommands.ts +4 -0
- package/front_end/generated/SupportedCSSProperties.js +68 -2
- package/front_end/generated/protocol-mapping.d.ts +7 -0
- package/front_end/generated/protocol-proxy-api.d.ts +14 -0
- package/front_end/generated/protocol.ts +22 -0
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +31 -17
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +1 -1
- package/front_end/models/bindings/TempFile.ts +1 -4
- package/front_end/models/emulation/DeviceModeModel.ts +21 -26
- package/front_end/models/extensions/ExtensionAPI.ts +1 -1
- package/front_end/models/heap_snapshot_model/HeapSnapshotModel.ts +34 -47
- package/front_end/models/javascript_metadata/NativeFunctions.js +6 -6
- package/front_end/models/trace/insights/LCPDiscovery.ts +14 -6
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +85 -31
- package/front_end/panels/ai_assistance/components/ChatMessage.ts +50 -40
- package/front_end/panels/ai_assistance/components/ChatView.ts +3 -2
- package/front_end/panels/ai_assistance/components/WalkthroughView.ts +35 -7
- package/front_end/panels/ai_assistance/components/chatMessage.css +5 -1
- package/front_end/panels/application/ApplicationPanelSidebar.ts +6 -0
- package/front_end/panels/application/IndexedDBViews.ts +0 -9
- package/front_end/panels/application/WebMCPTreeElement.ts +35 -0
- package/front_end/panels/application/WebMCPView.ts +118 -0
- package/front_end/panels/application/application.ts +4 -0
- package/front_end/panels/application/webMCPView.css +65 -0
- package/front_end/panels/common/aiCodeCompletionSummaryToolbar.css +1 -1
- package/front_end/panels/console/consoleView.css +4 -0
- package/front_end/panels/elements/ElementsTreeElement.ts +91 -13
- package/front_end/panels/elements/StylesAiCodeCompletionProvider.ts +23 -2
- package/front_end/panels/elements/StylesSidebarPane.ts +85 -20
- package/front_end/panels/elements/elementsPanel.css +14 -0
- package/front_end/panels/elements/elementsTreeOutline.css +18 -0
- package/front_end/panels/network/NetworkLogViewColumns.ts +3 -3
- package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +15 -19
- package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +4 -2
- package/front_end/panels/profiler/HeapSnapshotProxy.ts +12 -16
- package/front_end/panels/profiler/HeapSnapshotView.ts +3 -10
- package/front_end/panels/profiler/ProfilesPanel.ts +5 -7
- package/front_end/panels/recorder/components/recordingView.css +0 -6
- package/front_end/panels/sensors/SensorsView.ts +28 -61
- package/front_end/panels/timeline/EventsTimelineTreeView.ts +2 -2
- package/front_end/panels/timeline/ThirdPartyTreeView.ts +35 -36
- package/front_end/panels/timeline/TimelineDetailsView.ts +47 -41
- package/front_end/panels/timeline/TimelinePanel.ts +1 -3
- package/front_end/panels/timeline/TimelineTreeView.ts +13 -13
- package/front_end/panels/timeline/components/LiveMetricsView.ts +852 -824
- package/front_end/panels/timeline/components/liveMetricsView.css +4 -0
- package/front_end/panels/timeline/thirdPartyTreeView.css +2 -2
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/ui/components/buttons/button.css +2 -2
- package/front_end/ui/components/text_editor/AiCodeCompletionProvider.ts +0 -11
- package/front_end/ui/legacy/InspectorDrawerView.ts +206 -0
- package/front_end/ui/legacy/InspectorView.ts +41 -91
- package/front_end/ui/legacy/ViewManager.ts +14 -5
- package/front_end/ui/legacy/inspectorDrawerTabbedPane.css +5 -0
- package/front_end/ui/visual_logging/KnownContextValues.ts +2 -1
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import type * as ProtocolProxyApi from '../../generated/protocol-proxy-api.js';
|
|
6
6
|
import * as Protocol from '../../generated/protocol.js';
|
|
7
|
-
import * as Common from '../common/common.js';
|
|
7
|
+
import type * as Common from '../common/common.js';
|
|
8
8
|
import * as Platform from '../platform/platform.js';
|
|
9
9
|
|
|
10
10
|
import {CategorizedBreakpoint, Category} from './CategorizedBreakpoint.js';
|
|
@@ -38,7 +38,7 @@ export class DOMDebuggerModel extends SDKModel<EventTypes> {
|
|
|
38
38
|
this.#domModel.addEventListener(DOMModelEvents.NodeRemoved, this.nodeRemoved, this);
|
|
39
39
|
|
|
40
40
|
this.#domBreakpoints = [];
|
|
41
|
-
this.#domBreakpointsSetting =
|
|
41
|
+
this.#domBreakpointsSetting = this.target().targetManager().settings.createLocalSetting('dom-breakpoints', []);
|
|
42
42
|
if (this.#domModel.existingDocument()) {
|
|
43
43
|
void this.documentUpdated();
|
|
44
44
|
}
|
|
@@ -498,9 +498,11 @@ export class CSPViolationBreakpoint extends CategorizedBreakpoint {
|
|
|
498
498
|
|
|
499
499
|
export class DOMEventListenerBreakpoint extends CategorizedBreakpoint {
|
|
500
500
|
readonly eventTargetNames: string[];
|
|
501
|
-
|
|
501
|
+
readonly #targetManager: TargetManager;
|
|
502
|
+
constructor(eventName: string, eventTargetNames: string[], category: Category, targetManager: TargetManager) {
|
|
502
503
|
super(category, eventName);
|
|
503
504
|
this.eventTargetNames = eventTargetNames;
|
|
505
|
+
this.#targetManager = targetManager;
|
|
504
506
|
}
|
|
505
507
|
|
|
506
508
|
override setEnabled(enabled: boolean): void {
|
|
@@ -508,7 +510,7 @@ export class DOMEventListenerBreakpoint extends CategorizedBreakpoint {
|
|
|
508
510
|
return;
|
|
509
511
|
}
|
|
510
512
|
super.setEnabled(enabled);
|
|
511
|
-
for (const model of
|
|
513
|
+
for (const model of this.#targetManager.models(DOMDebuggerModel)) {
|
|
512
514
|
this.updateOnModel(model);
|
|
513
515
|
}
|
|
514
516
|
}
|
|
@@ -534,9 +536,11 @@ export class DOMDebuggerManager implements SDKModelObserver<DOMDebuggerModel> {
|
|
|
534
536
|
|
|
535
537
|
readonly #cspViolationsToBreakOn: CSPViolationBreakpoint[] = [];
|
|
536
538
|
readonly #eventListenerBreakpoints: DOMEventListenerBreakpoint[] = [];
|
|
539
|
+
readonly #targetManager: TargetManager;
|
|
537
540
|
|
|
538
|
-
constructor() {
|
|
539
|
-
this.#
|
|
541
|
+
constructor(targetManager: TargetManager = TargetManager.instance()) {
|
|
542
|
+
this.#targetManager = targetManager;
|
|
543
|
+
this.#xhrBreakpointsSetting = this.#targetManager.settings.createLocalSetting('xhr-breakpoints', []);
|
|
540
544
|
for (const breakpoint of this.#xhrBreakpointsSetting.get()) {
|
|
541
545
|
this.#xhrBreakpoints.set(breakpoint.url, breakpoint.enabled);
|
|
542
546
|
}
|
|
@@ -659,15 +663,16 @@ export class DOMDebuggerManager implements SDKModelObserver<DOMDebuggerModel> {
|
|
|
659
663
|
Category.XHR, ['readystatechange', 'load', 'loadstart', 'loadend', 'abort', 'error', 'progress', 'timeout'],
|
|
660
664
|
['xmlhttprequest', 'xmlhttprequestupload']);
|
|
661
665
|
|
|
662
|
-
|
|
666
|
+
this.#targetManager.observeModels(DOMDebuggerModel, this);
|
|
663
667
|
}
|
|
664
668
|
|
|
665
669
|
static instance(opts: {
|
|
666
670
|
forceNew: boolean|null,
|
|
671
|
+
targetManager?: TargetManager,
|
|
667
672
|
} = {forceNew: null}): DOMDebuggerManager {
|
|
668
|
-
const {forceNew} = opts;
|
|
673
|
+
const {forceNew, targetManager} = opts;
|
|
669
674
|
if (!domDebuggerManagerInstance || forceNew) {
|
|
670
|
-
domDebuggerManagerInstance = new DOMDebuggerManager();
|
|
675
|
+
domDebuggerManagerInstance = new DOMDebuggerManager(targetManager);
|
|
671
676
|
}
|
|
672
677
|
|
|
673
678
|
return domDebuggerManagerInstance;
|
|
@@ -679,7 +684,8 @@ export class DOMDebuggerManager implements SDKModelObserver<DOMDebuggerModel> {
|
|
|
679
684
|
|
|
680
685
|
private createEventListenerBreakpoints(category: Category, eventNames: string[], eventTargetNames: string[]): void {
|
|
681
686
|
for (const eventName of eventNames) {
|
|
682
|
-
this.#eventListenerBreakpoints.push(
|
|
687
|
+
this.#eventListenerBreakpoints.push(
|
|
688
|
+
new DOMEventListenerBreakpoint(eventName, eventTargetNames, category, this.#targetManager));
|
|
683
689
|
}
|
|
684
690
|
}
|
|
685
691
|
|
|
@@ -710,7 +716,7 @@ export class DOMDebuggerManager implements SDKModelObserver<DOMDebuggerModel> {
|
|
|
710
716
|
|
|
711
717
|
updateCSPViolationBreakpoints(): void {
|
|
712
718
|
const violationTypes = this.#cspViolationsToBreakOn.filter(v => v.enabled()).map(v => v.type());
|
|
713
|
-
for (const model of
|
|
719
|
+
for (const model of this.#targetManager.models(DOMDebuggerModel)) {
|
|
714
720
|
this.updateCSPViolationBreakpointsForModel(model, violationTypes);
|
|
715
721
|
}
|
|
716
722
|
}
|
|
@@ -735,7 +741,7 @@ export class DOMDebuggerManager implements SDKModelObserver<DOMDebuggerModel> {
|
|
|
735
741
|
addXHRBreakpoint(url: string, enabled: boolean): void {
|
|
736
742
|
this.#xhrBreakpoints.set(url, enabled);
|
|
737
743
|
if (enabled) {
|
|
738
|
-
for (const model of
|
|
744
|
+
for (const model of this.#targetManager.models(DOMDebuggerModel)) {
|
|
739
745
|
void model.agent.invoke_setXHRBreakpoint({url});
|
|
740
746
|
}
|
|
741
747
|
}
|
|
@@ -746,7 +752,7 @@ export class DOMDebuggerManager implements SDKModelObserver<DOMDebuggerModel> {
|
|
|
746
752
|
const enabled = this.#xhrBreakpoints.get(url);
|
|
747
753
|
this.#xhrBreakpoints.delete(url);
|
|
748
754
|
if (enabled) {
|
|
749
|
-
for (const model of
|
|
755
|
+
for (const model of this.#targetManager.models(DOMDebuggerModel)) {
|
|
750
756
|
void model.agent.invoke_removeXHRBreakpoint({url});
|
|
751
757
|
}
|
|
752
758
|
}
|
|
@@ -755,7 +761,7 @@ export class DOMDebuggerManager implements SDKModelObserver<DOMDebuggerModel> {
|
|
|
755
761
|
|
|
756
762
|
toggleXHRBreakpoint(url: string, enabled: boolean): void {
|
|
757
763
|
this.#xhrBreakpoints.set(url, enabled);
|
|
758
|
-
for (const model of
|
|
764
|
+
for (const model of this.#targetManager.models(DOMDebuggerModel)) {
|
|
759
765
|
if (enabled) {
|
|
760
766
|
void model.agent.invoke_setXHRBreakpoint({url});
|
|
761
767
|
} else {
|
|
@@ -190,7 +190,7 @@ export class DOMNode extends Common.ObjectWrapper.ObjectWrapper<DOMNodeEventType
|
|
|
190
190
|
/**
|
|
191
191
|
* Set if a DOMNode is ad related.
|
|
192
192
|
*/
|
|
193
|
-
#
|
|
193
|
+
#adProvenance?: Protocol.Network.AdProvenance;
|
|
194
194
|
|
|
195
195
|
constructor(domModel: DOMModel) {
|
|
196
196
|
super();
|
|
@@ -292,7 +292,7 @@ export class DOMNode extends Common.ObjectWrapper.ObjectWrapper<DOMNodeEventType
|
|
|
292
292
|
this.setPseudoElements(payload.pseudoElements);
|
|
293
293
|
|
|
294
294
|
if (payload.adProvenance) {
|
|
295
|
-
this.#
|
|
295
|
+
this.#adProvenance = payload.adProvenance;
|
|
296
296
|
}
|
|
297
297
|
|
|
298
298
|
if (this.#nodeType === Node.ELEMENT_NODE) {
|
|
@@ -331,21 +331,24 @@ export class DOMNode extends Common.ObjectWrapper.ObjectWrapper<DOMNodeEventType
|
|
|
331
331
|
return this.#topLayerIndex;
|
|
332
332
|
}
|
|
333
333
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
//
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
return false;
|
|
344
|
-
}
|
|
345
|
-
return frame.adFrameType() !== Protocol.Page.AdFrameType.None;
|
|
334
|
+
adProvenance(): Protocol.Network.AdProvenance|undefined {
|
|
335
|
+
if (this.#adProvenance !== undefined) {
|
|
336
|
+
return this.#adProvenance;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// AdProvenance can be unavailable for deeply nested OOPIF ad iframes
|
|
340
|
+
// (crbug.com/421202278). We rely on `AdFrameType` as a fallback.
|
|
341
|
+
if (!this.isIframe() || !this.#frameOwnerFrameId) {
|
|
342
|
+
return undefined;
|
|
346
343
|
}
|
|
347
344
|
|
|
348
|
-
|
|
345
|
+
const frame = FrameManager.instance().getFrame(this.#frameOwnerFrameId);
|
|
346
|
+
if (frame && frame.adFrameType() !== Protocol.Page.AdFrameType.None) {
|
|
347
|
+
// The frame is ad-related, but provenance information is unavailable.
|
|
348
|
+
return {};
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
return undefined;
|
|
349
352
|
}
|
|
350
353
|
|
|
351
354
|
isRootNode(): boolean {
|
|
@@ -425,8 +428,8 @@ export class DOMNode extends Common.ObjectWrapper.ObjectWrapper<DOMNodeEventType
|
|
|
425
428
|
}
|
|
426
429
|
}
|
|
427
430
|
|
|
428
|
-
setIsAdRelated(
|
|
429
|
-
this.#
|
|
431
|
+
setIsAdRelated(adProvenance?: Protocol.Network.AdProvenance): void {
|
|
432
|
+
this.#adProvenance = adProvenance;
|
|
430
433
|
this.dispatchEventToListeners(DOMNodeEvents.AD_RELATED_STATE_UPDATED);
|
|
431
434
|
}
|
|
432
435
|
|
|
@@ -1476,8 +1479,8 @@ export class DOMModel extends SDKModel<EventTypes> {
|
|
|
1476
1479
|
return this.target().model(OverlayModel) as OverlayModel;
|
|
1477
1480
|
}
|
|
1478
1481
|
|
|
1479
|
-
static cancelSearch(): void {
|
|
1480
|
-
for (const domModel of
|
|
1482
|
+
static cancelSearch(targetManager: TargetManager = TargetManager.instance()): void {
|
|
1483
|
+
for (const domModel of targetManager.models(DOMModel)) {
|
|
1481
1484
|
domModel.cancelSearch();
|
|
1482
1485
|
}
|
|
1483
1486
|
}
|
|
@@ -1832,12 +1835,11 @@ export class DOMModel extends SDKModel<EventTypes> {
|
|
|
1832
1835
|
}
|
|
1833
1836
|
|
|
1834
1837
|
adRelatedStateUpdated(nodeId: Protocol.DOM.NodeId, adProvenance?: Protocol.Network.AdProvenance): void {
|
|
1835
|
-
const isAdRelated = adProvenance !== undefined;
|
|
1836
1838
|
const node = this.nodeForId(nodeId);
|
|
1837
|
-
if (!node
|
|
1839
|
+
if (!node) {
|
|
1838
1840
|
return;
|
|
1839
1841
|
}
|
|
1840
|
-
node.setIsAdRelated(
|
|
1842
|
+
node.setIsAdRelated(adProvenance);
|
|
1841
1843
|
}
|
|
1842
1844
|
|
|
1843
1845
|
affectedByStartingStylesFlagUpdated(nodeId: Protocol.DOM.NodeId, affectedByStartingStyles: boolean): void {
|
|
@@ -173,30 +173,19 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
173
173
|
(compiledURL, sourceMappingURL, payload, script) =>
|
|
174
174
|
new SourceMap(compiledURL, sourceMappingURL, payload, script));
|
|
175
175
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
Common.Settings.Settings.instance()
|
|
183
|
-
.moduleSetting('pause-on-uncaught-exception')
|
|
184
|
-
.addChangeListener(this.pauseOnExceptionStateChanged, this);
|
|
185
|
-
Common.Settings.Settings.instance()
|
|
186
|
-
.moduleSetting('disable-async-stack-traces')
|
|
187
|
-
.addChangeListener(this.asyncStackTracesStateChanged, this);
|
|
188
|
-
Common.Settings.Settings.instance()
|
|
189
|
-
.moduleSetting('breakpoints-active')
|
|
190
|
-
.addChangeListener(this.breakpointsActiveChanged, this);
|
|
176
|
+
const settings = this.target().targetManager().settings;
|
|
177
|
+
settings.moduleSetting('pause-on-exception-enabled').addChangeListener(this.pauseOnExceptionStateChanged, this);
|
|
178
|
+
settings.moduleSetting('pause-on-caught-exception').addChangeListener(this.pauseOnExceptionStateChanged, this);
|
|
179
|
+
settings.moduleSetting('pause-on-uncaught-exception').addChangeListener(this.pauseOnExceptionStateChanged, this);
|
|
180
|
+
settings.moduleSetting('disable-async-stack-traces').addChangeListener(this.asyncStackTracesStateChanged, this);
|
|
181
|
+
settings.moduleSetting('breakpoints-active').addChangeListener(this.breakpointsActiveChanged, this);
|
|
191
182
|
|
|
192
183
|
if (!target.suspended()) {
|
|
193
184
|
void this.enableDebugger();
|
|
194
185
|
}
|
|
195
186
|
|
|
196
|
-
this.#sourceMapManager.setEnabled(
|
|
197
|
-
|
|
198
|
-
Common.Settings.Settings.instance()
|
|
199
|
-
.moduleSetting('js-source-maps-enabled')
|
|
187
|
+
this.#sourceMapManager.setEnabled(settings.moduleSetting('js-source-maps-enabled').get());
|
|
188
|
+
settings.moduleSetting('js-source-maps-enabled')
|
|
200
189
|
.addChangeListener(event => this.#sourceMapManager.setEnabled((event.data as boolean)));
|
|
201
190
|
|
|
202
191
|
const resourceTreeModel = (target.model(ResourceTreeModel) as ResourceTreeModel);
|
|
@@ -273,7 +262,8 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
273
262
|
}
|
|
274
263
|
this.pauseOnExceptionStateChanged();
|
|
275
264
|
void this.asyncStackTracesStateChanged();
|
|
276
|
-
|
|
265
|
+
const settings = this.target().targetManager().settings;
|
|
266
|
+
if (!settings.moduleSetting('breakpoints-active').get()) {
|
|
277
267
|
this.breakpointsActiveChanged();
|
|
278
268
|
}
|
|
279
269
|
this.dispatchEventToListeners(Events.DebuggerWasEnabled, this);
|
|
@@ -364,11 +354,11 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
364
354
|
}
|
|
365
355
|
|
|
366
356
|
private pauseOnExceptionStateChanged(): void {
|
|
367
|
-
const
|
|
357
|
+
const settings = this.target().targetManager().settings;
|
|
358
|
+
const pauseOnCaughtEnabled = settings.moduleSetting('pause-on-caught-exception').get();
|
|
368
359
|
let state: Protocol.Debugger.SetPauseOnExceptionsRequestState;
|
|
369
360
|
|
|
370
|
-
const pauseOnUncaughtEnabled =
|
|
371
|
-
Common.Settings.Settings.instance().moduleSetting('pause-on-uncaught-exception').get();
|
|
361
|
+
const pauseOnUncaughtEnabled = settings.moduleSetting('pause-on-uncaught-exception').get();
|
|
372
362
|
if (pauseOnCaughtEnabled && pauseOnUncaughtEnabled) {
|
|
373
363
|
state = Protocol.Debugger.SetPauseOnExceptionsRequestState.All;
|
|
374
364
|
} else if (pauseOnCaughtEnabled) {
|
|
@@ -383,15 +373,15 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
383
373
|
|
|
384
374
|
private asyncStackTracesStateChanged(): Promise<Protocol.ProtocolResponseWithError> {
|
|
385
375
|
const maxAsyncStackChainDepth = 32;
|
|
386
|
-
const
|
|
387
|
-
|
|
376
|
+
const settings = this.target().targetManager().settings;
|
|
377
|
+
const enabled = !settings.moduleSetting('disable-async-stack-traces').get() && this.#debuggerEnabled;
|
|
388
378
|
const maxDepth = enabled ? maxAsyncStackChainDepth : 0;
|
|
389
379
|
return this.agent.invoke_setAsyncCallStackDepth({maxDepth});
|
|
390
380
|
}
|
|
391
381
|
|
|
392
382
|
private breakpointsActiveChanged(): void {
|
|
393
|
-
|
|
394
|
-
|
|
383
|
+
const settings = this.target().targetManager().settings;
|
|
384
|
+
void this.agent.invoke_setBreakpointsActive({active: settings.moduleSetting('breakpoints-active').get()});
|
|
395
385
|
}
|
|
396
386
|
|
|
397
387
|
setComputeAutoStepRangesCallback(callback: ((arg0: StepMode, arg1: CallFrame) => Promise<LocationRange[]>)|null):
|
|
@@ -872,15 +862,10 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
872
862
|
if (this.#debuggerId) {
|
|
873
863
|
debuggerIdToModel.delete(this.#debuggerId);
|
|
874
864
|
}
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
.moduleSetting('pause-on-caught-exception')
|
|
880
|
-
.removeChangeListener(this.pauseOnExceptionStateChanged, this);
|
|
881
|
-
Common.Settings.Settings.instance()
|
|
882
|
-
.moduleSetting('disable-async-stack-traces')
|
|
883
|
-
.removeChangeListener(this.asyncStackTracesStateChanged, this);
|
|
865
|
+
const settings = this.target().targetManager().settings;
|
|
866
|
+
settings.moduleSetting('pause-on-exception-enabled').removeChangeListener(this.pauseOnExceptionStateChanged, this);
|
|
867
|
+
settings.moduleSetting('pause-on-caught-exception').removeChangeListener(this.pauseOnExceptionStateChanged, this);
|
|
868
|
+
settings.moduleSetting('disable-async-stack-traces').removeChangeListener(this.asyncStackTracesStateChanged, this);
|
|
884
869
|
}
|
|
885
870
|
|
|
886
871
|
override async suspendModel(): Promise<void> {
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
import type * as ProtocolProxyApi from '../../generated/protocol-proxy-api.js';
|
|
6
6
|
import * as Protocol from '../../generated/protocol.js';
|
|
7
|
-
import * as Common from '../common/common.js';
|
|
8
7
|
|
|
9
8
|
import {CSSModel} from './CSSModel.js';
|
|
10
9
|
import {MultitargetNetworkManager} from './NetworkManager.js';
|
|
@@ -50,7 +49,8 @@ export class EmulationModel extends SDKModel<EmulationModelEventTypes> implement
|
|
|
50
49
|
}, this);
|
|
51
50
|
}
|
|
52
51
|
|
|
53
|
-
const
|
|
52
|
+
const settings = this.target().targetManager().settings;
|
|
53
|
+
const disableJavascriptSetting = settings.moduleSetting('java-script-disabled');
|
|
54
54
|
disableJavascriptSetting.addChangeListener(
|
|
55
55
|
async () =>
|
|
56
56
|
await this.#emulationAgent.invoke_setScriptExecutionDisabled({value: disableJavascriptSetting.get()}));
|
|
@@ -58,14 +58,14 @@ export class EmulationModel extends SDKModel<EmulationModelEventTypes> implement
|
|
|
58
58
|
void this.#emulationAgent.invoke_setScriptExecutionDisabled({value: true});
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
const touchSetting =
|
|
61
|
+
const touchSetting = settings.moduleSetting('emulation.touch');
|
|
62
62
|
touchSetting.addChangeListener(() => {
|
|
63
63
|
const settingValue = touchSetting.get();
|
|
64
64
|
|
|
65
65
|
void this.overrideEmulateTouch(settingValue === 'force');
|
|
66
66
|
});
|
|
67
67
|
|
|
68
|
-
const idleDetectionSetting =
|
|
68
|
+
const idleDetectionSetting = settings.moduleSetting('emulation.idle-detection');
|
|
69
69
|
idleDetectionSetting.addChangeListener(async () => {
|
|
70
70
|
const settingValue = idleDetectionSetting.get();
|
|
71
71
|
if (settingValue === 'none') {
|
|
@@ -80,7 +80,7 @@ export class EmulationModel extends SDKModel<EmulationModelEventTypes> implement
|
|
|
80
80
|
await this.setIdleOverride(emulationParams);
|
|
81
81
|
});
|
|
82
82
|
|
|
83
|
-
const cpuPressureDetectionSetting =
|
|
83
|
+
const cpuPressureDetectionSetting = settings.moduleSetting('emulation.cpu-pressure');
|
|
84
84
|
cpuPressureDetectionSetting.addChangeListener(async () => {
|
|
85
85
|
const settingValue = cpuPressureDetectionSetting.get();
|
|
86
86
|
|
|
@@ -98,21 +98,19 @@ export class EmulationModel extends SDKModel<EmulationModelEventTypes> implement
|
|
|
98
98
|
await this.setPressureStateOverride(settingValue);
|
|
99
99
|
});
|
|
100
100
|
|
|
101
|
-
const mediaTypeSetting =
|
|
102
|
-
const mediaFeatureColorGamutSetting =
|
|
103
|
-
Common.Settings.Settings.instance().moduleSetting<string>('emulated-css-media-feature-color-gamut');
|
|
101
|
+
const mediaTypeSetting = settings.moduleSetting<string>('emulated-css-media');
|
|
102
|
+
const mediaFeatureColorGamutSetting = settings.moduleSetting<string>('emulated-css-media-feature-color-gamut');
|
|
104
103
|
const mediaFeaturePrefersColorSchemeSetting =
|
|
105
|
-
|
|
106
|
-
const mediaFeatureForcedColorsSetting =
|
|
107
|
-
Common.Settings.Settings.instance().moduleSetting('emulated-css-media-feature-forced-colors');
|
|
104
|
+
settings.moduleSetting<string>('emulated-css-media-feature-prefers-color-scheme');
|
|
105
|
+
const mediaFeatureForcedColorsSetting = settings.moduleSetting('emulated-css-media-feature-forced-colors');
|
|
108
106
|
const mediaFeaturePrefersContrastSetting =
|
|
109
|
-
|
|
107
|
+
settings.moduleSetting<string>('emulated-css-media-feature-prefers-contrast');
|
|
110
108
|
const mediaFeaturePrefersReducedDataSetting =
|
|
111
|
-
|
|
112
|
-
const mediaFeaturePrefersReducedTransparencySetting =
|
|
113
|
-
'emulated-css-media-feature-prefers-reduced-transparency');
|
|
109
|
+
settings.moduleSetting<string>('emulated-css-media-feature-prefers-reduced-data');
|
|
110
|
+
const mediaFeaturePrefersReducedTransparencySetting =
|
|
111
|
+
settings.moduleSetting<string>('emulated-css-media-feature-prefers-reduced-transparency');
|
|
114
112
|
const mediaFeaturePrefersReducedMotionSetting =
|
|
115
|
-
|
|
113
|
+
settings.moduleSetting<string>('emulated-css-media-feature-prefers-reduced-motion');
|
|
116
114
|
// Note: this uses a different format than what the CDP API expects,
|
|
117
115
|
// because we want to update these values per media type/feature
|
|
118
116
|
// without having to search the `features` array (inefficient) or
|
|
@@ -161,7 +159,7 @@ export class EmulationModel extends SDKModel<EmulationModelEventTypes> implement
|
|
|
161
159
|
});
|
|
162
160
|
void this.updateCssMedia();
|
|
163
161
|
|
|
164
|
-
const autoDarkModeSetting =
|
|
162
|
+
const autoDarkModeSetting = settings.moduleSetting('emulate-auto-dark-mode');
|
|
165
163
|
autoDarkModeSetting.addChangeListener(() => {
|
|
166
164
|
const enabled = autoDarkModeSetting.get();
|
|
167
165
|
mediaFeaturePrefersColorSchemeSetting.setDisabled(enabled);
|
|
@@ -174,13 +172,13 @@ export class EmulationModel extends SDKModel<EmulationModelEventTypes> implement
|
|
|
174
172
|
void this.emulateAutoDarkMode(true);
|
|
175
173
|
}
|
|
176
174
|
|
|
177
|
-
const visionDeficiencySetting =
|
|
175
|
+
const visionDeficiencySetting = settings.moduleSetting('emulated-vision-deficiency');
|
|
178
176
|
visionDeficiencySetting.addChangeListener(() => this.emulateVisionDeficiency(visionDeficiencySetting.get()));
|
|
179
177
|
if (visionDeficiencySetting.get()) {
|
|
180
178
|
void this.emulateVisionDeficiency(visionDeficiencySetting.get());
|
|
181
179
|
}
|
|
182
180
|
|
|
183
|
-
const osTextScaleSetting =
|
|
181
|
+
const osTextScaleSetting = settings.moduleSetting('emulated-os-text-scale');
|
|
184
182
|
osTextScaleSetting.addChangeListener(() => {
|
|
185
183
|
void this.emulateOSTextScale(parseFloat(osTextScaleSetting.get()) || undefined);
|
|
186
184
|
});
|
|
@@ -188,15 +186,15 @@ export class EmulationModel extends SDKModel<EmulationModelEventTypes> implement
|
|
|
188
186
|
void this.emulateOSTextScale(parseFloat(osTextScaleSetting.get()) || undefined);
|
|
189
187
|
}
|
|
190
188
|
|
|
191
|
-
const localFontsDisabledSetting =
|
|
189
|
+
const localFontsDisabledSetting = settings.moduleSetting('local-fonts-disabled');
|
|
192
190
|
localFontsDisabledSetting.addChangeListener(() => this.setLocalFontsDisabled(localFontsDisabledSetting.get()));
|
|
193
191
|
if (localFontsDisabledSetting.get()) {
|
|
194
192
|
this.setLocalFontsDisabled(localFontsDisabledSetting.get());
|
|
195
193
|
}
|
|
196
194
|
|
|
197
|
-
const avifFormatDisabledSetting =
|
|
198
|
-
const jpegXlFormatDisabledSetting =
|
|
199
|
-
const webpFormatDisabledSetting =
|
|
195
|
+
const avifFormatDisabledSetting = settings.moduleSetting('avif-format-disabled');
|
|
196
|
+
const jpegXlFormatDisabledSetting = settings.moduleSetting('jpeg-xl-format-disabled');
|
|
197
|
+
const webpFormatDisabledSetting = settings.moduleSetting('webp-format-disabled');
|
|
200
198
|
|
|
201
199
|
const updateDisabledImageFormats = (): void => {
|
|
202
200
|
const types = [];
|
|
@@ -56,12 +56,18 @@ export class EventBreakpointsModel extends SDKModel<void> {
|
|
|
56
56
|
* instrumentation breakpoints in targets that run JS but do not have a DOM.
|
|
57
57
|
**/
|
|
58
58
|
class EventListenerBreakpoint extends CategorizedBreakpoint {
|
|
59
|
+
readonly #targetManager: TargetManager;
|
|
60
|
+
constructor(category: Category, name: string, targetManager: TargetManager) {
|
|
61
|
+
super(category, name);
|
|
62
|
+
this.#targetManager = targetManager;
|
|
63
|
+
}
|
|
64
|
+
|
|
59
65
|
override setEnabled(enabled: boolean): void {
|
|
60
66
|
if (this.enabled() === enabled) {
|
|
61
67
|
return;
|
|
62
68
|
}
|
|
63
69
|
super.setEnabled(enabled);
|
|
64
|
-
for (const model of
|
|
70
|
+
for (const model of this.#targetManager.models(EventBreakpointsModel)) {
|
|
65
71
|
this.updateOnModel(model);
|
|
66
72
|
}
|
|
67
73
|
}
|
|
@@ -81,8 +87,10 @@ let eventBreakpointManagerInstance: EventBreakpointsManager;
|
|
|
81
87
|
|
|
82
88
|
export class EventBreakpointsManager implements SDKModelObserver<EventBreakpointsModel> {
|
|
83
89
|
readonly #eventListenerBreakpoints: EventListenerBreakpoint[] = [];
|
|
90
|
+
readonly #targetManager: TargetManager;
|
|
84
91
|
|
|
85
|
-
constructor() {
|
|
92
|
+
constructor(targetManager: TargetManager = TargetManager.instance()) {
|
|
93
|
+
this.#targetManager = targetManager;
|
|
86
94
|
this.createInstrumentationBreakpoints(Category.AUCTION_WORKLET, [
|
|
87
95
|
InstrumentationNames.BEFORE_BIDDER_WORKLET_BIDDING_START,
|
|
88
96
|
InstrumentationNames.BEFORE_BIDDER_WORKLET_REPORTING_START,
|
|
@@ -135,15 +143,16 @@ export class EventBreakpointsManager implements SDKModelObserver<EventBreakpoint
|
|
|
135
143
|
InstrumentationNames.AUDIO_CONTEXT_SUSPENDED,
|
|
136
144
|
]);
|
|
137
145
|
|
|
138
|
-
|
|
146
|
+
this.#targetManager.observeModels(EventBreakpointsModel, this);
|
|
139
147
|
}
|
|
140
148
|
|
|
141
149
|
static instance(opts: {
|
|
142
150
|
forceNew: boolean|null,
|
|
151
|
+
targetManager?: TargetManager,
|
|
143
152
|
} = {forceNew: null}): EventBreakpointsManager {
|
|
144
|
-
const {forceNew} = opts;
|
|
153
|
+
const {forceNew, targetManager} = opts;
|
|
145
154
|
if (!eventBreakpointManagerInstance || forceNew) {
|
|
146
|
-
eventBreakpointManagerInstance = new EventBreakpointsManager();
|
|
155
|
+
eventBreakpointManagerInstance = new EventBreakpointsManager(targetManager);
|
|
147
156
|
}
|
|
148
157
|
|
|
149
158
|
return eventBreakpointManagerInstance;
|
|
@@ -151,7 +160,8 @@ export class EventBreakpointsManager implements SDKModelObserver<EventBreakpoint
|
|
|
151
160
|
|
|
152
161
|
private createInstrumentationBreakpoints(category: Category, instrumentationNames: InstrumentationNames[]): void {
|
|
153
162
|
for (const instrumentationName of instrumentationNames) {
|
|
154
|
-
this.#eventListenerBreakpoints.push(
|
|
163
|
+
this.#eventListenerBreakpoints.push(
|
|
164
|
+
new EventListenerBreakpoint(category, instrumentationName, this.#targetManager));
|
|
155
165
|
}
|
|
156
166
|
}
|
|
157
167
|
|
|
@@ -11,21 +11,18 @@ import type {RemoteObject} from './RemoteObject.js';
|
|
|
11
11
|
import {RuntimeModel} from './RuntimeModel.js';
|
|
12
12
|
import {SDKModel} from './SDKModel.js';
|
|
13
13
|
import {Capability, type Target} from './Target.js';
|
|
14
|
-
import {TargetManager} from './TargetManager.js';
|
|
15
14
|
|
|
16
15
|
export class HeapProfilerModel extends SDKModel<EventTypes> {
|
|
17
|
-
#enabled
|
|
16
|
+
#enabled = false;
|
|
18
17
|
readonly #heapProfilerAgent: ProtocolProxyApi.HeapProfilerApi;
|
|
19
18
|
readonly #runtimeModel: RuntimeModel;
|
|
20
|
-
#samplingProfilerDepth
|
|
19
|
+
#samplingProfilerDepth = 0;
|
|
21
20
|
|
|
22
21
|
constructor(target: Target) {
|
|
23
22
|
super(target);
|
|
24
23
|
target.registerHeapProfilerDispatcher(new HeapProfilerDispatcher(this));
|
|
25
|
-
this.#enabled = false;
|
|
26
24
|
this.#heapProfilerAgent = target.heapProfilerAgent();
|
|
27
25
|
this.#runtimeModel = (target.model(RuntimeModel) as RuntimeModel);
|
|
28
|
-
this.#samplingProfilerDepth = 0;
|
|
29
26
|
}
|
|
30
27
|
|
|
31
28
|
debuggerModel(): DebuggerModel {
|
|
@@ -107,11 +104,11 @@ export class HeapProfilerModel extends SDKModel<EventTypes> {
|
|
|
107
104
|
}
|
|
108
105
|
|
|
109
106
|
async takeHeapSnapshot(heapSnapshotOptions: Protocol.HeapProfiler.TakeHeapSnapshotRequest): Promise<void> {
|
|
110
|
-
await
|
|
107
|
+
await this.target().targetManager().suspendAllTargets('heap-snapshot');
|
|
111
108
|
try {
|
|
112
109
|
await this.#heapProfilerAgent.invoke_takeHeapSnapshot(heapSnapshotOptions);
|
|
113
110
|
} finally {
|
|
114
|
-
await
|
|
111
|
+
await this.target().targetManager().resumeAllTargets();
|
|
115
112
|
}
|
|
116
113
|
}
|
|
117
114
|
|
|
@@ -19,18 +19,21 @@ export class IsolateManager extends Common.ObjectWrapper.ObjectWrapper<EventType
|
|
|
19
19
|
#isolateIdByModel = new Map<RuntimeModel, string|null>();
|
|
20
20
|
#observers = new Set<Observer>();
|
|
21
21
|
#pollId = 0;
|
|
22
|
+
readonly #targetManager: TargetManager;
|
|
22
23
|
|
|
23
|
-
constructor() {
|
|
24
|
+
constructor(targetManager: TargetManager = TargetManager.instance()) {
|
|
24
25
|
super();
|
|
26
|
+
this.#targetManager = targetManager;
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
this.#targetManager.observeModels(RuntimeModel, this);
|
|
27
29
|
}
|
|
28
30
|
|
|
29
|
-
static instance({forceNew}: {
|
|
31
|
+
static instance({forceNew, targetManager}: {
|
|
30
32
|
forceNew: boolean,
|
|
33
|
+
targetManager?: TargetManager,
|
|
31
34
|
} = {forceNew: false}): IsolateManager {
|
|
32
35
|
if (!isolateManagerInstance || forceNew) {
|
|
33
|
-
isolateManagerInstance = new IsolateManager();
|
|
36
|
+
isolateManagerInstance = new IsolateManager(targetManager);
|
|
34
37
|
}
|
|
35
38
|
|
|
36
39
|
return isolateManagerInstance;
|
|
@@ -67,7 +70,7 @@ export class IsolateManager extends Common.ObjectWrapper.ObjectWrapper<EventType
|
|
|
67
70
|
this.#isolateIdByModel.set(model, isolateId);
|
|
68
71
|
let isolate = this.#isolates.get(isolateId);
|
|
69
72
|
if (!isolate) {
|
|
70
|
-
isolate = new Isolate(isolateId);
|
|
73
|
+
isolate = new Isolate(isolateId, this);
|
|
71
74
|
this.#isolates.set(isolateId, isolate);
|
|
72
75
|
}
|
|
73
76
|
isolate.models().add(model);
|
|
@@ -145,9 +148,11 @@ export class Isolate {
|
|
|
145
148
|
readonly #models: Set<RuntimeModel>;
|
|
146
149
|
#usedHeapSize: number;
|
|
147
150
|
readonly #memoryTrend: MemoryTrend;
|
|
151
|
+
readonly #manager: IsolateManager;
|
|
148
152
|
|
|
149
|
-
constructor(id: string) {
|
|
153
|
+
constructor(id: string, manager: IsolateManager) {
|
|
150
154
|
this.#id = id;
|
|
155
|
+
this.#manager = manager;
|
|
151
156
|
this.#models = new Set();
|
|
152
157
|
this.#usedHeapSize = 0;
|
|
153
158
|
const count = MemoryTrendWindowMs / PollIntervalMs;
|
|
@@ -179,7 +184,7 @@ export class Isolate {
|
|
|
179
184
|
}
|
|
180
185
|
this.#usedHeapSize = usage.usedSize + (usage.embedderHeapUsedSize ?? 0) + (usage.backingStorageSize ?? 0);
|
|
181
186
|
this.#memoryTrend.add(this.#usedHeapSize);
|
|
182
|
-
|
|
187
|
+
this.#manager.dispatchEventToListeners(Events.MEMORY_CHANGED, this);
|
|
183
188
|
}
|
|
184
189
|
|
|
185
190
|
samplesCount(): number {
|