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
|
@@ -77,25 +77,25 @@ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
|
77
77
|
let settingsInstance: ConsoleModel;
|
|
78
78
|
|
|
79
79
|
export class ConsoleModel extends Common.ObjectWrapper.ObjectWrapper<EventTypes> implements Observer {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
80
|
+
#messagesInternal: ConsoleMessage[];
|
|
81
|
+
readonly #messageByExceptionId: Map<RuntimeModel, Map<number, ConsoleMessage>>;
|
|
82
|
+
#warningsInternal: number;
|
|
83
|
+
#errorsInternal: number;
|
|
84
|
+
#violationsInternal: number;
|
|
85
|
+
#pageLoadSequenceNumber: number;
|
|
86
|
+
readonly #targetListeners: WeakMap<Target, Common.EventTarget.EventDescriptor[]>;
|
|
87
|
+
#consoleGroupMessageStack: ConsoleMessage[] = [];
|
|
88
88
|
|
|
89
89
|
private constructor() {
|
|
90
90
|
super();
|
|
91
91
|
|
|
92
|
-
this
|
|
93
|
-
this
|
|
94
|
-
this
|
|
95
|
-
this
|
|
96
|
-
this
|
|
97
|
-
this
|
|
98
|
-
this
|
|
92
|
+
this.#messagesInternal = [];
|
|
93
|
+
this.#messageByExceptionId = new Map();
|
|
94
|
+
this.#warningsInternal = 0;
|
|
95
|
+
this.#errorsInternal = 0;
|
|
96
|
+
this.#violationsInternal = 0;
|
|
97
|
+
this.#pageLoadSequenceNumber = 0;
|
|
98
|
+
this.#targetListeners = new WeakMap();
|
|
99
99
|
|
|
100
100
|
TargetManager.instance().observeTargets(this);
|
|
101
101
|
}
|
|
@@ -157,15 +157,15 @@ export class ConsoleModel extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
|
157
157
|
RuntimeModelEvents.QueryObjectRequested, this.queryObjectRequested.bind(this, runtimeModel)));
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
this
|
|
160
|
+
this.#targetListeners.set(target, eventListeners);
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
targetRemoved(target: Target): void {
|
|
164
164
|
const runtimeModel = target.model(RuntimeModel);
|
|
165
165
|
if (runtimeModel) {
|
|
166
|
-
this
|
|
166
|
+
this.#messageByExceptionId.delete(runtimeModel);
|
|
167
167
|
}
|
|
168
|
-
Common.EventTarget.removeEventListeners(this
|
|
168
|
+
Common.EventTarget.removeEventListeners(this.#targetListeners.get(target) || []);
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
async evaluateCommandInConsole(
|
|
@@ -206,20 +206,20 @@ export class ConsoleModel extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
addMessage(msg: ConsoleMessage): void {
|
|
209
|
-
msg.setPageLoadSequenceNumber(this
|
|
209
|
+
msg.setPageLoadSequenceNumber(this.#pageLoadSequenceNumber);
|
|
210
210
|
if (msg.source === FrontendMessageSource.ConsoleAPI &&
|
|
211
211
|
msg.type === Protocol.Runtime.ConsoleAPICalledEventType.Clear) {
|
|
212
212
|
this.clearIfNecessary();
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
-
this
|
|
215
|
+
this.#messagesInternal.push(msg);
|
|
216
216
|
const runtimeModel = msg.runtimeModel();
|
|
217
217
|
const exceptionId = msg.getExceptionId();
|
|
218
218
|
if (exceptionId && runtimeModel) {
|
|
219
|
-
let modelMap = this
|
|
219
|
+
let modelMap = this.#messageByExceptionId.get(runtimeModel);
|
|
220
220
|
if (!modelMap) {
|
|
221
221
|
modelMap = new Map();
|
|
222
|
-
this
|
|
222
|
+
this.#messageByExceptionId.set(runtimeModel, modelMap);
|
|
223
223
|
}
|
|
224
224
|
modelMap.set(exceptionId, msg);
|
|
225
225
|
}
|
|
@@ -240,12 +240,12 @@ export class ConsoleModel extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
|
240
240
|
|
|
241
241
|
private exceptionRevoked(runtimeModel: RuntimeModel, event: Common.EventTarget.EventTargetEvent<number>): void {
|
|
242
242
|
const exceptionId = event.data;
|
|
243
|
-
const modelMap = this
|
|
243
|
+
const modelMap = this.#messageByExceptionId.get(runtimeModel);
|
|
244
244
|
const exceptionMessage = modelMap ? modelMap.get(exceptionId) : null;
|
|
245
245
|
if (!exceptionMessage) {
|
|
246
246
|
return;
|
|
247
247
|
}
|
|
248
|
-
this
|
|
248
|
+
this.#errorsInternal--;
|
|
249
249
|
exceptionMessage.level = Protocol.Log.LogEntryLevel.Verbose;
|
|
250
250
|
this.dispatchEventToListeners(Events.MessageUpdated, exceptionMessage);
|
|
251
251
|
}
|
|
@@ -276,7 +276,7 @@ export class ConsoleModel extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
|
276
276
|
message = call.args[0].description;
|
|
277
277
|
}
|
|
278
278
|
const callFrame = call.stackTrace && call.stackTrace.callFrames.length ? call.stackTrace.callFrames[0] : null;
|
|
279
|
-
const groupParent = this
|
|
279
|
+
const groupParent = this.#consoleGroupMessageStack[this.#consoleGroupMessageStack.length - 1];
|
|
280
280
|
const details = {
|
|
281
281
|
type: call.type,
|
|
282
282
|
url: callFrame?.url,
|
|
@@ -293,10 +293,10 @@ export class ConsoleModel extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
|
293
293
|
const consoleMessage =
|
|
294
294
|
new ConsoleMessage(runtimeModel, FrontendMessageSource.ConsoleAPI, level, (message as string), details);
|
|
295
295
|
if (call.type === Protocol.Runtime.ConsoleAPICalledEventType.StartGroup) {
|
|
296
|
-
this
|
|
296
|
+
this.#consoleGroupMessageStack.push(consoleMessage);
|
|
297
297
|
}
|
|
298
298
|
if (call.type === Protocol.Runtime.ConsoleAPICalledEventType.EndGroup) {
|
|
299
|
-
this
|
|
299
|
+
this.#consoleGroupMessageStack.pop();
|
|
300
300
|
}
|
|
301
301
|
if (groupParent && call.type !== Protocol.Runtime.ConsoleAPICalledEventType.EndGroup) {
|
|
302
302
|
groupParent.groupChildren?.push(consoleMessage);
|
|
@@ -321,7 +321,7 @@ export class ConsoleModel extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
|
321
321
|
if (!Common.Settings.Settings.instance().moduleSetting('preserveConsoleLog').get()) {
|
|
322
322
|
this.clear();
|
|
323
323
|
}
|
|
324
|
-
++this
|
|
324
|
+
++this.#pageLoadSequenceNumber;
|
|
325
325
|
}
|
|
326
326
|
|
|
327
327
|
private mainFrameNavigated(event: Common.EventTarget.EventTargetEvent<ResourceTreeFrame>): void {
|
|
@@ -363,21 +363,21 @@ export class ConsoleModel extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
|
363
363
|
|
|
364
364
|
private incrementErrorWarningCount(msg: ConsoleMessage): void {
|
|
365
365
|
if (msg.source === Protocol.Log.LogEntrySource.Violation) {
|
|
366
|
-
this
|
|
366
|
+
this.#violationsInternal++;
|
|
367
367
|
return;
|
|
368
368
|
}
|
|
369
369
|
switch (msg.level) {
|
|
370
370
|
case Protocol.Log.LogEntryLevel.Warning:
|
|
371
|
-
this
|
|
371
|
+
this.#warningsInternal++;
|
|
372
372
|
break;
|
|
373
373
|
case Protocol.Log.LogEntryLevel.Error:
|
|
374
|
-
this
|
|
374
|
+
this.#errorsInternal++;
|
|
375
375
|
break;
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
378
|
|
|
379
379
|
messages(): ConsoleMessage[] {
|
|
380
|
-
return this
|
|
380
|
+
return this.#messagesInternal;
|
|
381
381
|
}
|
|
382
382
|
|
|
383
383
|
requestClearMessages(): void {
|
|
@@ -391,25 +391,25 @@ export class ConsoleModel extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
|
391
391
|
}
|
|
392
392
|
|
|
393
393
|
private clear(): void {
|
|
394
|
-
this
|
|
395
|
-
this
|
|
396
|
-
this
|
|
397
|
-
this
|
|
398
|
-
this
|
|
399
|
-
this
|
|
394
|
+
this.#messagesInternal = [];
|
|
395
|
+
this.#consoleGroupMessageStack = [];
|
|
396
|
+
this.#messageByExceptionId.clear();
|
|
397
|
+
this.#errorsInternal = 0;
|
|
398
|
+
this.#warningsInternal = 0;
|
|
399
|
+
this.#violationsInternal = 0;
|
|
400
400
|
this.dispatchEventToListeners(Events.ConsoleCleared);
|
|
401
401
|
}
|
|
402
402
|
|
|
403
403
|
errors(): number {
|
|
404
|
-
return this
|
|
404
|
+
return this.#errorsInternal;
|
|
405
405
|
}
|
|
406
406
|
|
|
407
407
|
warnings(): number {
|
|
408
|
-
return this
|
|
408
|
+
return this.#warningsInternal;
|
|
409
409
|
}
|
|
410
410
|
|
|
411
411
|
violations(): number {
|
|
412
|
-
return this
|
|
412
|
+
return this.#violationsInternal;
|
|
413
413
|
}
|
|
414
414
|
|
|
415
415
|
async saveToTempVariable(currentExecutionContext: ExecutionContext|null, remoteObject: RemoteObject|null):
|
|
@@ -501,7 +501,7 @@ function extractExceptionMetaData(metaData: any|undefined): AffectedResources|un
|
|
|
501
501
|
}
|
|
502
502
|
|
|
503
503
|
function areAffectedResourcesEquivalent(a?: AffectedResources, b?: AffectedResources): boolean {
|
|
504
|
-
// Not considering issueId, as that would prevent de-duplication of console messages.
|
|
504
|
+
// Not considering issueId, as that would prevent de-duplication of console #messages.
|
|
505
505
|
return a?.requestId === b?.requestId;
|
|
506
506
|
}
|
|
507
507
|
|
|
@@ -524,7 +524,7 @@ export interface ConsoleMessageDetails {
|
|
|
524
524
|
}
|
|
525
525
|
|
|
526
526
|
export class ConsoleMessage {
|
|
527
|
-
|
|
527
|
+
readonly #runtimeModelInternal: RuntimeModel|null;
|
|
528
528
|
source: MessageSource;
|
|
529
529
|
level: Protocol.Log.LogEntryLevel|null;
|
|
530
530
|
messageText: string;
|
|
@@ -535,14 +535,14 @@ export class ConsoleMessage {
|
|
|
535
535
|
parameters: (string|RemoteObject|Protocol.Runtime.RemoteObject)[]|undefined;
|
|
536
536
|
stackTrace: Protocol.Runtime.StackTrace|undefined;
|
|
537
537
|
timestamp: number;
|
|
538
|
-
|
|
538
|
+
#executionContextId: number;
|
|
539
539
|
scriptId?: Protocol.Runtime.ScriptId;
|
|
540
540
|
workerId?: string;
|
|
541
541
|
context?: string;
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
542
|
+
#originatingConsoleMessage: ConsoleMessage|null = null;
|
|
543
|
+
#pageLoadSequenceNumber?: number = undefined;
|
|
544
|
+
#exceptionId?: number = undefined;
|
|
545
|
+
#affectedResources?: AffectedResources;
|
|
546
546
|
groupParent?: ConsoleMessage;
|
|
547
547
|
groupChildren?: Array<ConsoleMessage>;
|
|
548
548
|
category?: Protocol.Log.LogEntryCategory;
|
|
@@ -550,7 +550,7 @@ export class ConsoleMessage {
|
|
|
550
550
|
constructor(
|
|
551
551
|
runtimeModel: RuntimeModel|null, source: MessageSource, level: Protocol.Log.LogEntryLevel|null,
|
|
552
552
|
messageText: string, details?: ConsoleMessageDetails) {
|
|
553
|
-
this
|
|
553
|
+
this.#runtimeModelInternal = runtimeModel;
|
|
554
554
|
this.source = source;
|
|
555
555
|
this.level = (level as Protocol.Log.LogEntryLevel | null);
|
|
556
556
|
this.messageText = messageText;
|
|
@@ -561,19 +561,19 @@ export class ConsoleMessage {
|
|
|
561
561
|
this.parameters = details?.parameters;
|
|
562
562
|
this.stackTrace = details?.stackTrace;
|
|
563
563
|
this.timestamp = details?.timestamp || Date.now();
|
|
564
|
-
this
|
|
564
|
+
this.#executionContextId = details?.executionContextId || 0;
|
|
565
565
|
this.scriptId = details?.scriptId;
|
|
566
566
|
this.workerId = details?.workerId;
|
|
567
|
-
this
|
|
567
|
+
this.#affectedResources = details?.affectedResources;
|
|
568
568
|
this.groupParent = details?.groupParent;
|
|
569
569
|
this.groupChildren = details?.groupChildren;
|
|
570
570
|
this.category = details?.category;
|
|
571
571
|
|
|
572
|
-
if (!this
|
|
572
|
+
if (!this.#executionContextId && this.#runtimeModelInternal) {
|
|
573
573
|
if (this.scriptId) {
|
|
574
|
-
this
|
|
574
|
+
this.#executionContextId = this.#runtimeModelInternal.executionContextIdForScriptId(this.scriptId);
|
|
575
575
|
} else if (this.stackTrace) {
|
|
576
|
-
this
|
|
576
|
+
this.#executionContextId = this.#runtimeModelInternal.executionContextForStackTrace(this.stackTrace);
|
|
577
577
|
}
|
|
578
578
|
}
|
|
579
579
|
|
|
@@ -584,11 +584,11 @@ export class ConsoleMessage {
|
|
|
584
584
|
}
|
|
585
585
|
|
|
586
586
|
getAffectedResources(): AffectedResources|undefined {
|
|
587
|
-
return this
|
|
587
|
+
return this.#affectedResources;
|
|
588
588
|
}
|
|
589
589
|
|
|
590
590
|
setPageLoadSequenceNumber(pageLoadSequenceNumber: number): void {
|
|
591
|
-
this
|
|
591
|
+
this.#pageLoadSequenceNumber = pageLoadSequenceNumber;
|
|
592
592
|
}
|
|
593
593
|
|
|
594
594
|
static fromException(
|
|
@@ -615,36 +615,36 @@ export class ConsoleMessage {
|
|
|
615
615
|
}
|
|
616
616
|
|
|
617
617
|
runtimeModel(): RuntimeModel|null {
|
|
618
|
-
return this
|
|
618
|
+
return this.#runtimeModelInternal;
|
|
619
619
|
}
|
|
620
620
|
|
|
621
621
|
target(): Target|null {
|
|
622
|
-
return this
|
|
622
|
+
return this.#runtimeModelInternal ? this.#runtimeModelInternal.target() : null;
|
|
623
623
|
}
|
|
624
624
|
|
|
625
625
|
setOriginatingMessage(originatingMessage: ConsoleMessage): void {
|
|
626
|
-
this
|
|
627
|
-
this
|
|
626
|
+
this.#originatingConsoleMessage = originatingMessage;
|
|
627
|
+
this.#executionContextId = originatingMessage.#executionContextId;
|
|
628
628
|
}
|
|
629
629
|
|
|
630
630
|
originatingMessage(): ConsoleMessage|null {
|
|
631
|
-
return this
|
|
631
|
+
return this.#originatingConsoleMessage;
|
|
632
632
|
}
|
|
633
633
|
|
|
634
634
|
setExecutionContextId(executionContextId: number): void {
|
|
635
|
-
this
|
|
635
|
+
this.#executionContextId = executionContextId;
|
|
636
636
|
}
|
|
637
637
|
|
|
638
638
|
getExecutionContextId(): number {
|
|
639
|
-
return this
|
|
639
|
+
return this.#executionContextId;
|
|
640
640
|
}
|
|
641
641
|
|
|
642
642
|
getExceptionId(): number|undefined {
|
|
643
|
-
return this
|
|
643
|
+
return this.#exceptionId;
|
|
644
644
|
}
|
|
645
645
|
|
|
646
646
|
setExceptionId(exceptionId: number): void {
|
|
647
|
-
this
|
|
647
|
+
this.#exceptionId = exceptionId;
|
|
648
648
|
}
|
|
649
649
|
|
|
650
650
|
isGroupMessage(): boolean {
|
|
@@ -671,7 +671,7 @@ export class ConsoleMessage {
|
|
|
671
671
|
}
|
|
672
672
|
|
|
673
673
|
groupCategoryKey(): string {
|
|
674
|
-
return [this.source, this.level, this.type, this
|
|
674
|
+
return [this.source, this.level, this.type, this.#pageLoadSequenceNumber].join(':');
|
|
675
675
|
}
|
|
676
676
|
|
|
677
677
|
isEqual(msg: ConsoleMessage|null): boolean {
|
|
@@ -714,8 +714,8 @@ export class ConsoleMessage {
|
|
|
714
714
|
return (this.runtimeModel() === msg.runtimeModel()) && (this.source === msg.source) && (this.type === msg.type) &&
|
|
715
715
|
(this.level === msg.level) && (this.line === msg.line) && (this.url === msg.url) &&
|
|
716
716
|
(bothAreWatchExpressions || this.scriptId === msg.scriptId) && (this.messageText === msg.messageText) &&
|
|
717
|
-
(this
|
|
718
|
-
areAffectedResourcesEquivalent(this
|
|
717
|
+
(this.#executionContextId === msg.#executionContextId) &&
|
|
718
|
+
areAffectedResourcesEquivalent(this.#affectedResources, msg.#affectedResources);
|
|
719
719
|
}
|
|
720
720
|
|
|
721
721
|
private isEqualStackTraces(
|
|
@@ -5,23 +5,23 @@
|
|
|
5
5
|
import type * as Protocol from '../../generated/protocol.js';
|
|
6
6
|
|
|
7
7
|
export class Cookie {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
readonly #nameInternal: string;
|
|
9
|
+
readonly #valueInternal: string;
|
|
10
|
+
readonly #typeInternal: Type|null|undefined;
|
|
11
|
+
#attributes: {
|
|
12
12
|
[x: string]: string|number|boolean|undefined,
|
|
13
13
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
#sizeInternal: number;
|
|
15
|
+
#priorityInternal: Protocol.Network.CookiePriority;
|
|
16
|
+
#cookieLine: string|null;
|
|
17
17
|
constructor(name: string, value: string, type?: Type|null, priority?: Protocol.Network.CookiePriority) {
|
|
18
|
-
this
|
|
19
|
-
this
|
|
20
|
-
this
|
|
21
|
-
this
|
|
22
|
-
this
|
|
23
|
-
this
|
|
24
|
-
this
|
|
18
|
+
this.#nameInternal = name;
|
|
19
|
+
this.#valueInternal = value;
|
|
20
|
+
this.#typeInternal = type;
|
|
21
|
+
this.#attributes = {};
|
|
22
|
+
this.#sizeInternal = 0;
|
|
23
|
+
this.#priorityInternal = (priority || 'Medium' as Protocol.Network.CookiePriority);
|
|
24
|
+
this.#cookieLine = null;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
static fromProtocolCookie(protocolCookie: Protocol.Network.Cookie): Cookie {
|
|
@@ -58,71 +58,71 @@ export class Cookie {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
name(): string {
|
|
61
|
-
return this
|
|
61
|
+
return this.#nameInternal;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
value(): string {
|
|
65
|
-
return this
|
|
65
|
+
return this.#valueInternal;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
type(): Type|null|undefined {
|
|
69
|
-
return this
|
|
69
|
+
return this.#typeInternal;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
httpOnly(): boolean {
|
|
73
|
-
return 'httponly' in this
|
|
73
|
+
return 'httponly' in this.#attributes;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
secure(): boolean {
|
|
77
|
-
return 'secure' in this
|
|
77
|
+
return 'secure' in this.#attributes;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
sameSite(): Protocol.Network.CookieSameSite {
|
|
81
|
-
// TODO(allada) This should not rely on attributes and instead store them individually.
|
|
82
|
-
// when attributes get added via addAttribute() they are lowercased, hence the lowercasing of samesite here
|
|
83
|
-
return this
|
|
81
|
+
// TODO(allada) This should not rely on #attributes and instead store them individually.
|
|
82
|
+
// when #attributes get added via addAttribute() they are lowercased, hence the lowercasing of samesite here
|
|
83
|
+
return this.#attributes['samesite'] as Protocol.Network.CookieSameSite;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
sameParty(): boolean {
|
|
87
|
-
return 'sameparty' in this
|
|
87
|
+
return 'sameparty' in this.#attributes;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
priority(): Protocol.Network.CookiePriority {
|
|
91
|
-
return this
|
|
91
|
+
return this.#priorityInternal;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
session(): boolean {
|
|
95
95
|
// RFC 2965 suggests using Discard attribute to mark session cookies, but this does not seem to be widely used.
|
|
96
96
|
// Check for absence of explicitly max-age or expiry date instead.
|
|
97
|
-
return !('expires' in this
|
|
97
|
+
return !('expires' in this.#attributes || 'max-age' in this.#attributes);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
path(): string {
|
|
101
|
-
return this
|
|
101
|
+
return this.#attributes['path'] as string;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
domain(): string {
|
|
105
|
-
return this
|
|
105
|
+
return this.#attributes['domain'] as string;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
expires(): number {
|
|
109
|
-
return this
|
|
109
|
+
return this.#attributes['expires'] as number;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
maxAge(): number {
|
|
113
|
-
return this
|
|
113
|
+
return this.#attributes['max-age'] as number;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
sourcePort(): number {
|
|
117
|
-
return this
|
|
117
|
+
return this.#attributes['sourceport'] as number;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
sourceScheme(): Protocol.Network.CookieSourceScheme {
|
|
121
|
-
return this
|
|
121
|
+
return this.#attributes['sourcescheme'] as Protocol.Network.CookieSourceScheme;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
size(): number {
|
|
125
|
-
return this
|
|
125
|
+
return this.#sizeInternal;
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
/**
|
|
@@ -144,7 +144,7 @@ export class Cookie {
|
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
setSize(size: number): void {
|
|
147
|
-
this
|
|
147
|
+
this.#sizeInternal = size;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
expiresDate(requestDate: Date): Date|null {
|
|
@@ -164,19 +164,19 @@ export class Cookie {
|
|
|
164
164
|
const normalizedKey = key.toLowerCase();
|
|
165
165
|
switch (normalizedKey) {
|
|
166
166
|
case 'priority':
|
|
167
|
-
this
|
|
167
|
+
this.#priorityInternal = (value as Protocol.Network.CookiePriority);
|
|
168
168
|
break;
|
|
169
169
|
default:
|
|
170
|
-
this
|
|
170
|
+
this.#attributes[normalizedKey] = value;
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
setCookieLine(cookieLine: string): void {
|
|
175
|
-
this
|
|
175
|
+
this.#cookieLine = cookieLine;
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
getCookieLine(): string|null {
|
|
179
|
-
return this
|
|
179
|
+
return this.#cookieLine;
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
matchesSecurityOrigin(securityOrigin: string): boolean {
|
|
@@ -248,26 +248,26 @@ export enum Attributes {
|
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
/**
|
|
251
|
-
* A `CookieReference` uniquely identifies a cookie by the triple (name,domain
|
|
251
|
+
* A `CookieReference` uniquely identifies a cookie by the triple (#name,domain,#path). Additionally, a context may be
|
|
252
252
|
* included to make it clear which site under Application>Cookies should be opened when revealing a `CookieReference`.
|
|
253
253
|
*/
|
|
254
254
|
export class CookieReference {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
255
|
+
readonly #name: string;
|
|
256
|
+
readonly #domainInternal: string;
|
|
257
|
+
readonly #path: string;
|
|
258
|
+
readonly #contextUrlInternal: string|undefined;
|
|
259
259
|
constructor(name: string, domain: string, path: string, contextUrl: string|undefined) {
|
|
260
|
-
this
|
|
261
|
-
this
|
|
262
|
-
this
|
|
263
|
-
this
|
|
260
|
+
this.#name = name;
|
|
261
|
+
this.#domainInternal = domain;
|
|
262
|
+
this.#path = path;
|
|
263
|
+
this.#contextUrlInternal = contextUrl;
|
|
264
264
|
}
|
|
265
265
|
|
|
266
266
|
domain(): string {
|
|
267
|
-
return this
|
|
267
|
+
return this.#domainInternal;
|
|
268
268
|
}
|
|
269
269
|
|
|
270
270
|
contextUrl(): string|undefined {
|
|
271
|
-
return this
|
|
271
|
+
return this.#contextUrlInternal;
|
|
272
272
|
}
|
|
273
273
|
}
|
|
@@ -15,31 +15,31 @@ import {Capability} from './Target.js';
|
|
|
15
15
|
import {SDKModel} from './SDKModel.js';
|
|
16
16
|
|
|
17
17
|
export class CookieModel extends SDKModel<void> {
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
readonly #blockedCookies: Map<string, Cookie>;
|
|
19
|
+
readonly #cookieToBlockedReasons: Map<Cookie, BlockedReason[]>;
|
|
20
20
|
constructor(target: Target) {
|
|
21
21
|
super(target);
|
|
22
22
|
|
|
23
|
-
this
|
|
24
|
-
this
|
|
23
|
+
this.#blockedCookies = new Map();
|
|
24
|
+
this.#cookieToBlockedReasons = new Map();
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
addBlockedCookie(cookie: Cookie, blockedReasons: BlockedReason[]|null): void {
|
|
28
28
|
const key = cookie.key();
|
|
29
|
-
const previousCookie = this
|
|
30
|
-
this
|
|
29
|
+
const previousCookie = this.#blockedCookies.get(key);
|
|
30
|
+
this.#blockedCookies.set(key, cookie);
|
|
31
31
|
if (blockedReasons) {
|
|
32
|
-
this
|
|
32
|
+
this.#cookieToBlockedReasons.set(cookie, blockedReasons);
|
|
33
33
|
} else {
|
|
34
|
-
this
|
|
34
|
+
this.#cookieToBlockedReasons.delete(cookie);
|
|
35
35
|
}
|
|
36
36
|
if (previousCookie) {
|
|
37
|
-
this
|
|
37
|
+
this.#cookieToBlockedReasons.delete(previousCookie);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
getCookieToBlockedReasonsMap(): ReadonlyMap<Cookie, BlockedReason[]> {
|
|
42
|
-
return this
|
|
42
|
+
return this.#cookieToBlockedReasons;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
async getCookies(urls: string[]): Promise<Cookie[]> {
|
|
@@ -48,7 +48,7 @@ export class CookieModel extends SDKModel<void> {
|
|
|
48
48
|
return [];
|
|
49
49
|
}
|
|
50
50
|
const normalCookies = response.cookies.map(Cookie.fromProtocolCookie);
|
|
51
|
-
return normalCookies.concat(Array.from(this
|
|
51
|
+
return normalCookies.concat(Array.from(this.#blockedCookies.values()));
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
async deleteCookie(cookie: Cookie): Promise<void> {
|
|
@@ -129,8 +129,8 @@ export class CookieModel extends SDKModel<void> {
|
|
|
129
129
|
|
|
130
130
|
async deleteCookies(cookies: Cookie[]): Promise<void> {
|
|
131
131
|
const networkAgent = this.target().networkAgent();
|
|
132
|
-
this
|
|
133
|
-
this
|
|
132
|
+
this.#blockedCookies.clear();
|
|
133
|
+
this.#cookieToBlockedReasons.clear();
|
|
134
134
|
await Promise.all(cookies.map(
|
|
135
135
|
cookie => networkAgent.invoke_deleteCookies(
|
|
136
136
|
{name: cookie.name(), url: undefined, domain: cookie.domain(), path: cookie.path()})));
|