chrome-devtools-frontend 1.0.1016605 → 1.0.1017938
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/config/gni/devtools_grd_files.gni +2 -0
- package/front_end/core/i18n/locales/en-US.json +6 -6
- package/front_end/core/i18n/locales/en-XL.json +6 -6
- package/front_end/core/sdk/DOMModel.ts +11 -0
- package/front_end/core/sdk/DebuggerModel.ts +4 -0
- package/front_end/core/sdk/FrameManager.ts +36 -15
- package/front_end/core/sdk/ResourceTreeModel.ts +88 -6
- package/front_end/core/sdk/Script.ts +1 -1
- package/front_end/core/sdk/SecurityOriginManager.ts +1 -1
- package/front_end/core/sdk/StorageKeyManager.ts +71 -0
- package/front_end/core/sdk/sdk.ts +2 -0
- package/front_end/entrypoints/formatter_worker/ScopeParser.ts +4 -2
- package/front_end/models/issues_manager/DeprecationIssue.ts +5 -2
- package/front_end/models/timeline_model/TimelineModel.ts +8 -6
- package/front_end/panels/application/ApplicationPanelSidebar.ts +5 -1
- package/front_end/panels/application/DOMStorageModel.ts +138 -10
- package/front_end/panels/application/StorageView.ts +64 -5
- package/front_end/panels/application/components/FrameDetailsView.ts +31 -5
- package/front_end/panels/elements/ElementsTreeElement.ts +25 -37
- package/front_end/panels/elements/ElementsTreeOutline.ts +44 -8
- package/front_end/panels/elements/TopLayerContainer.ts +97 -0
- package/front_end/panels/elements/components/AdornerManager.ts +7 -0
- package/front_end/panels/elements/elements.ts +4 -0
- package/front_end/panels/performance_monitor/PerformanceMonitor.ts +7 -0
- package/front_end/panels/sources/ScopeChainSidebarPane.ts +1 -1
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorController.ts +5 -6
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +5 -3
- package/package.json +1 -1
@@ -654,6 +654,7 @@ grd_files_debug_sources = [
|
|
654
654
|
"front_end/core/sdk/ServiceWorkerManager.js",
|
655
655
|
"front_end/core/sdk/SourceMap.js",
|
656
656
|
"front_end/core/sdk/SourceMapManager.js",
|
657
|
+
"front_end/core/sdk/StorageKeyManager.js",
|
657
658
|
"front_end/core/sdk/Target.js",
|
658
659
|
"front_end/core/sdk/TargetManager.js",
|
659
660
|
"front_end/core/sdk/TracingManager.js",
|
@@ -961,6 +962,7 @@ grd_files_debug_sources = [
|
|
961
962
|
"front_end/panels/elements/StylePropertyTreeElement.js",
|
962
963
|
"front_end/panels/elements/StylePropertyUtils.js",
|
963
964
|
"front_end/panels/elements/StylesSidebarPane.js",
|
965
|
+
"front_end/panels/elements/TopLayerContainer.js",
|
964
966
|
"front_end/panels/elements/classesPaneWidget.css.js",
|
965
967
|
"front_end/panels/elements/components/AccessibilityTreeNode.js",
|
966
968
|
"front_end/panels/elements/components/AdornerManager.js",
|
@@ -3035,6 +3035,9 @@
|
|
3035
3035
|
"panels/application/components/FrameDetailsView.ts | creationStackTraceExplanation": {
|
3036
3036
|
"message": "This frame was created programmatically. The stack trace shows where this happened."
|
3037
3037
|
},
|
3038
|
+
"panels/application/components/FrameDetailsView.ts | creatorAdScript": {
|
3039
|
+
"message": "Creator Ad Script"
|
3040
|
+
},
|
3038
3041
|
"panels/application/components/FrameDetailsView.ts | crossoriginIsolated": {
|
3039
3042
|
"message": "Cross-Origin Isolated"
|
3040
3043
|
},
|
@@ -4892,12 +4895,6 @@
|
|
4892
4895
|
"panels/elements/ElementsTreeElement.ts | enableScrollSnap": {
|
4893
4896
|
"message": "Enable scroll-snap overlay"
|
4894
4897
|
},
|
4895
|
-
"panels/elements/ElementsTreeElement.ts | enterIsolationMode": {
|
4896
|
-
"message": "Enter Isolation Mode"
|
4897
|
-
},
|
4898
|
-
"panels/elements/ElementsTreeElement.ts | exitIsolationMode": {
|
4899
|
-
"message": "Exit Isolation Mode"
|
4900
|
-
},
|
4901
4898
|
"panels/elements/ElementsTreeElement.ts | expandRecursively": {
|
4902
4899
|
"message": "Expand recursively"
|
4903
4900
|
},
|
@@ -5159,6 +5156,9 @@
|
|
5159
5156
|
"panels/elements/StylesSidebarPane.ts | unknownPropertyName": {
|
5160
5157
|
"message": "Unknown property name"
|
5161
5158
|
},
|
5159
|
+
"panels/elements/TopLayerContainer.ts | topLayer": {
|
5160
|
+
"message": "top-layer"
|
5161
|
+
},
|
5162
5162
|
"panels/emulation/DeviceModeToolbar.ts | addDevicePixelRatio": {
|
5163
5163
|
"message": "Add device pixel ratio"
|
5164
5164
|
},
|
@@ -3035,6 +3035,9 @@
|
|
3035
3035
|
"panels/application/components/FrameDetailsView.ts | creationStackTraceExplanation": {
|
3036
3036
|
"message": "T̂h́îś f̂ŕâḿê ẃâś ĉŕêát̂éd̂ ṕr̂óĝŕâḿm̂át̂íĉál̂ĺŷ. T́ĥé stack trace ŝh́ôẃŝ ẃĥér̂é t̂h́îś ĥáp̂ṕêńêd́."
|
3037
3037
|
},
|
3038
|
+
"panels/application/components/FrameDetailsView.ts | creatorAdScript": {
|
3039
|
+
"message": "Ĉŕêát̂ór̂ Ád̂ Śĉŕîṕt̂"
|
3040
|
+
},
|
3038
3041
|
"panels/application/components/FrameDetailsView.ts | crossoriginIsolated": {
|
3039
3042
|
"message": "Ĉŕôśŝ-Ór̂íĝín̂ Íŝól̂át̂éd̂"
|
3040
3043
|
},
|
@@ -4892,12 +4895,6 @@
|
|
4892
4895
|
"panels/elements/ElementsTreeElement.ts | enableScrollSnap": {
|
4893
4896
|
"message": "Êńâb́l̂é ŝćr̂ól̂ĺ-ŝńâṕ ôv́êŕl̂áŷ"
|
4894
4897
|
},
|
4895
|
-
"panels/elements/ElementsTreeElement.ts | enterIsolationMode": {
|
4896
|
-
"message": "Êńt̂ér̂ Íŝól̂át̂íôń M̂ód̂é"
|
4897
|
-
},
|
4898
|
-
"panels/elements/ElementsTreeElement.ts | exitIsolationMode": {
|
4899
|
-
"message": "Êx́ît́ Îśôĺât́îón̂ Ḿôd́ê"
|
4900
|
-
},
|
4901
4898
|
"panels/elements/ElementsTreeElement.ts | expandRecursively": {
|
4902
4899
|
"message": "Êx́p̂án̂d́ r̂éĉúr̂śîv́êĺŷ"
|
4903
4900
|
},
|
@@ -5159,6 +5156,9 @@
|
|
5159
5156
|
"panels/elements/StylesSidebarPane.ts | unknownPropertyName": {
|
5160
5157
|
"message": "Ûńk̂ńôẃn̂ ṕr̂óp̂ér̂t́ŷ ńâḿê"
|
5161
5158
|
},
|
5159
|
+
"panels/elements/TopLayerContainer.ts | topLayer": {
|
5160
|
+
"message": "t̂óp̂-ĺâýêŕ"
|
5161
|
+
},
|
5162
5162
|
"panels/emulation/DeviceModeToolbar.ts | addDevicePixelRatio": {
|
5163
5163
|
"message": "Âd́d̂ d́êv́îćê ṕîx́êĺ r̂át̂íô"
|
5164
5164
|
},
|
@@ -1410,6 +1410,10 @@ export class DOMModel extends SDKModel<EventTypes> {
|
|
1410
1410
|
this.scheduleMutationEvent(node);
|
1411
1411
|
}
|
1412
1412
|
|
1413
|
+
topLayerElementsUpdated(): void {
|
1414
|
+
this.dispatchEventToListeners(Events.TopLayerElementsChanged);
|
1415
|
+
}
|
1416
|
+
|
1413
1417
|
pseudoElementRemoved(parentId: Protocol.DOM.NodeId, pseudoElementId: Protocol.DOM.NodeId): void {
|
1414
1418
|
const parent = this.idToDOMNode.get(parentId);
|
1415
1419
|
if (!parent) {
|
@@ -1511,6 +1515,10 @@ export class DOMModel extends SDKModel<EventTypes> {
|
|
1511
1515
|
return this.agent.invoke_querySelectorAll({nodeId, selector}).then(({nodeIds}) => nodeIds);
|
1512
1516
|
}
|
1513
1517
|
|
1518
|
+
getTopLayerElements(): Promise<Protocol.DOM.NodeId[]|null> {
|
1519
|
+
return this.agent.invoke_getTopLayerElements().then(({nodeIds}) => nodeIds);
|
1520
|
+
}
|
1521
|
+
|
1514
1522
|
markUndoableState(minorChange?: boolean): void {
|
1515
1523
|
void DOMModelUndoStack.instance().markUndoableState(this, minorChange || false);
|
1516
1524
|
}
|
@@ -1574,6 +1582,7 @@ export enum Events {
|
|
1574
1582
|
ChildNodeCountUpdated = 'ChildNodeCountUpdated',
|
1575
1583
|
DistributedNodesChanged = 'DistributedNodesChanged',
|
1576
1584
|
MarkersChanged = 'MarkersChanged',
|
1585
|
+
TopLayerElementsChanged = 'TopLayerElementsChanged',
|
1577
1586
|
}
|
1578
1587
|
|
1579
1588
|
export type EventTypes = {
|
@@ -1587,6 +1596,7 @@ export type EventTypes = {
|
|
1587
1596
|
[Events.ChildNodeCountUpdated]: DOMNode,
|
1588
1597
|
[Events.DistributedNodesChanged]: DOMNode,
|
1589
1598
|
[Events.MarkersChanged]: DOMNode,
|
1599
|
+
[Events.TopLayerElementsChanged]: void,
|
1590
1600
|
};
|
1591
1601
|
|
1592
1602
|
class DOMDispatcher implements ProtocolProxyApi.DOMDispatcher {
|
@@ -1652,6 +1662,7 @@ class DOMDispatcher implements ProtocolProxyApi.DOMDispatcher {
|
|
1652
1662
|
}
|
1653
1663
|
|
1654
1664
|
topLayerElementsUpdated(): void {
|
1665
|
+
this.#domModel.topLayerElementsUpdated();
|
1655
1666
|
}
|
1656
1667
|
}
|
1657
1668
|
|
@@ -230,6 +230,10 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
230
230
|
return Boolean(this.#debuggerEnabledInternal);
|
231
231
|
}
|
232
232
|
|
233
|
+
debuggerId(): string|null {
|
234
|
+
return this.#debuggerId;
|
235
|
+
}
|
236
|
+
|
233
237
|
private async enableDebugger(): Promise<void> {
|
234
238
|
if (this.#debuggerEnabledInternal) {
|
235
239
|
return;
|
@@ -28,8 +28,12 @@ export class FrameManager extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
28
28
|
}>;
|
29
29
|
readonly #framesForTarget: Map<Protocol.Target.TargetID|'main', Set<Protocol.Page.FrameId>>;
|
30
30
|
#topFrame: ResourceTreeFrame|null;
|
31
|
-
#
|
32
|
-
|
31
|
+
#transferringFramesDataCache: Map<string, {
|
32
|
+
creationStackTrace?: Protocol.Runtime.StackTrace,
|
33
|
+
creationStackTraceTarget?: Target,
|
34
|
+
adScriptId?: Protocol.Runtime.ScriptId,
|
35
|
+
debuggerId?: Protocol.Runtime.UniqueDebuggerId,
|
36
|
+
}>;
|
33
37
|
#awaitedFrames: Map<string, {notInTarget?: Target, resolve: (frame: ResourceTreeFrame) => void}[]> = new Map();
|
34
38
|
|
35
39
|
constructor() {
|
@@ -46,7 +50,7 @@ export class FrameManager extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
46
50
|
this.#framesForTarget = new Map();
|
47
51
|
|
48
52
|
this.#topFrame = null;
|
49
|
-
this.#
|
53
|
+
this.#transferringFramesDataCache = new Map();
|
50
54
|
}
|
51
55
|
|
52
56
|
static instance({forceNew}: {
|
@@ -94,19 +98,30 @@ export class FrameManager extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
94
98
|
const frameData = this.#frames.get(frame.id);
|
95
99
|
// If the frame is already in the map, increase its count, otherwise add it to the map.
|
96
100
|
if (frameData) {
|
97
|
-
// In order to not lose
|
98
|
-
// an OOPIF transfer we need to copy
|
101
|
+
// In order to not lose the following attributes of a frame during
|
102
|
+
// an OOPIF transfer we need to copy them to the new frame
|
99
103
|
frame.setCreationStackTrace(frameData.frame.getCreationStackTraceData());
|
104
|
+
frame.setAdScriptId(frameData.frame.getAdScriptId());
|
105
|
+
frame.setDebuggerId(frameData.frame.getDebuggerId());
|
100
106
|
this.#frames.set(frame.id, {frame, count: frameData.count + 1});
|
101
107
|
} else {
|
102
108
|
// If the transferring frame's detached event is received before its frame added
|
103
|
-
// event in the new target, the
|
104
|
-
const
|
105
|
-
if (
|
106
|
-
frame.setCreationStackTrace(
|
109
|
+
// event in the new target, the frame's cached attributes are reassigned.
|
110
|
+
const cachedFrameAttributes = this.#transferringFramesDataCache.get(frame.id);
|
111
|
+
if (cachedFrameAttributes?.creationStackTrace && cachedFrameAttributes?.creationStackTraceTarget) {
|
112
|
+
frame.setCreationStackTrace({
|
113
|
+
creationStackTrace: cachedFrameAttributes.creationStackTrace,
|
114
|
+
creationStackTraceTarget: cachedFrameAttributes.creationStackTraceTarget,
|
115
|
+
});
|
116
|
+
}
|
117
|
+
if (cachedFrameAttributes?.adScriptId) {
|
118
|
+
frame.setAdScriptId(cachedFrameAttributes.adScriptId);
|
119
|
+
}
|
120
|
+
if (cachedFrameAttributes?.debuggerId) {
|
121
|
+
frame.setDebuggerId(cachedFrameAttributes.debuggerId);
|
107
122
|
}
|
108
123
|
this.#frames.set(frame.id, {frame, count: 1});
|
109
|
-
this.#
|
124
|
+
this.#transferringFramesDataCache.delete(frame.id);
|
110
125
|
}
|
111
126
|
this.resetTopFrame();
|
112
127
|
|
@@ -126,13 +141,19 @@ export class FrameManager extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
126
141
|
this.decreaseOrRemoveFrame(frame.id);
|
127
142
|
|
128
143
|
// If the transferring frame's detached event is received before its frame
|
129
|
-
// added event in the new target, we persist the frame
|
130
|
-
// so that later on the frame added event in the new target
|
144
|
+
// added event in the new target, we persist some attributes of the frame here
|
145
|
+
// so that later on the frame added event in the new target they can be reassigned.
|
131
146
|
if (isSwap && !this.#frames.get(frame.id)) {
|
132
147
|
const traceData = frame.getCreationStackTraceData();
|
133
|
-
|
134
|
-
|
135
|
-
|
148
|
+
const adScriptId = frame.getAdScriptId();
|
149
|
+
const debuggerId = frame.getDebuggerId();
|
150
|
+
const cachedFrameAttributes = {
|
151
|
+
...(traceData.creationStackTrace && {creationStackTrace: traceData.creationStackTrace}),
|
152
|
+
...(traceData.creationStackTrace && {creationStackTraceTarget: traceData.creationStackTraceTarget}),
|
153
|
+
...(adScriptId && {adScriptId}),
|
154
|
+
...(debuggerId && {debuggerId}),
|
155
|
+
};
|
156
|
+
this.#transferringFramesDataCache.set(frame.id, cachedFrameAttributes);
|
136
157
|
}
|
137
158
|
|
138
159
|
// Remove the frameId from the target's set of frameIds.
|
@@ -50,10 +50,13 @@ import {Capability} from './Target.js';
|
|
50
50
|
import {SDKModel} from './SDKModel.js';
|
51
51
|
import {TargetManager} from './TargetManager.js';
|
52
52
|
import {SecurityOriginManager} from './SecurityOriginManager.js';
|
53
|
+
import {StorageKeyManager} from './StorageKeyManager.js';
|
53
54
|
|
54
55
|
export class ResourceTreeModel extends SDKModel<EventTypes> {
|
55
56
|
readonly agent: ProtocolProxyApi.PageApi;
|
57
|
+
readonly storageAgent: ProtocolProxyApi.StorageApi;
|
56
58
|
readonly #securityOriginManager: SecurityOriginManager;
|
59
|
+
readonly #storageKeyManager: StorageKeyManager;
|
57
60
|
readonly framesInternal: Map<string, ResourceTreeFrame>;
|
58
61
|
#cachedResourcesProcessed: boolean;
|
59
62
|
#pendingReloadOptions: {
|
@@ -75,8 +78,10 @@ export class ResourceTreeModel extends SDKModel<EventTypes> {
|
|
75
78
|
networkManager.addEventListener(NetworkManagerEvents.RequestUpdateDropped, this.onRequestUpdateDropped, this);
|
76
79
|
}
|
77
80
|
this.agent = target.pageAgent();
|
81
|
+
this.storageAgent = target.storageAgent();
|
78
82
|
void this.agent.invoke_enable();
|
79
83
|
this.#securityOriginManager = (target.model(SecurityOriginManager) as SecurityOriginManager);
|
84
|
+
this.#storageKeyManager = (target.model(StorageKeyManager) as StorageKeyManager);
|
80
85
|
this.#pendingBackForwardCacheNotUsedEvents = new Set<Protocol.Page.BackForwardCacheNotUsedEvent>();
|
81
86
|
this.#pendingPrerenderAttemptCompletedEvents = new Set<Protocol.Page.PrerenderAttemptCompletedEvent>();
|
82
87
|
target.registerPageDispatcher(new PageDispatcher(this));
|
@@ -129,6 +134,14 @@ export class ResourceTreeModel extends SDKModel<EventTypes> {
|
|
129
134
|
}
|
130
135
|
}
|
131
136
|
|
137
|
+
async storageKeyForFrame(frameId: Protocol.Page.FrameId): Promise<string|null> {
|
138
|
+
const response = await this.storageAgent.invoke_getStorageKeyForFrame({frameId: frameId});
|
139
|
+
if (response.getError() === 'Frame tree node for given frame not found') {
|
140
|
+
return null;
|
141
|
+
}
|
142
|
+
return response.storageKey;
|
143
|
+
}
|
144
|
+
|
132
145
|
domModel(): DOMModel {
|
133
146
|
return this.target().model(DOMModel) as DOMModel;
|
134
147
|
}
|
@@ -164,11 +177,12 @@ export class ResourceTreeModel extends SDKModel<EventTypes> {
|
|
164
177
|
}
|
165
178
|
this.dispatchEventToListeners(Events.FrameAdded, frame);
|
166
179
|
this.updateSecurityOrigins();
|
180
|
+
void this.updateStorageKeys();
|
167
181
|
}
|
168
182
|
|
169
183
|
frameAttached(
|
170
184
|
frameId: Protocol.Page.FrameId, parentFrameId: Protocol.Page.FrameId|null,
|
171
|
-
stackTrace?: Protocol.Runtime.StackTrace): ResourceTreeFrame|null {
|
185
|
+
stackTrace?: Protocol.Runtime.StackTrace, adScriptId?: Protocol.Page.AdScriptId): ResourceTreeFrame|null {
|
172
186
|
const sameTargetParentFrame = parentFrameId ? (this.framesInternal.get(parentFrameId) || null) : null;
|
173
187
|
// Do nothing unless cached resource tree is processed - it will overwrite everything.
|
174
188
|
if (!this.#cachedResourcesProcessed && sameTargetParentFrame) {
|
@@ -178,7 +192,8 @@ export class ResourceTreeModel extends SDKModel<EventTypes> {
|
|
178
192
|
return null;
|
179
193
|
}
|
180
194
|
|
181
|
-
const frame =
|
195
|
+
const frame =
|
196
|
+
new ResourceTreeFrame(this, sameTargetParentFrame, frameId, null, stackTrace || null, adScriptId || null);
|
182
197
|
if (parentFrameId && !sameTargetParentFrame) {
|
183
198
|
frame.crossTargetParentFrameId = parentFrameId;
|
184
199
|
}
|
@@ -233,6 +248,7 @@ export class ResourceTreeModel extends SDKModel<EventTypes> {
|
|
233
248
|
this.target().setInspectedURL(frame.url);
|
234
249
|
}
|
235
250
|
this.updateSecurityOrigins();
|
251
|
+
void this.updateStorageKeys();
|
236
252
|
}
|
237
253
|
|
238
254
|
documentOpened(framePayload: Protocol.Page.Frame): void {
|
@@ -265,6 +281,7 @@ export class ResourceTreeModel extends SDKModel<EventTypes> {
|
|
265
281
|
frame.remove(isSwap);
|
266
282
|
}
|
267
283
|
this.updateSecurityOrigins();
|
284
|
+
void this.updateStorageKeys();
|
268
285
|
}
|
269
286
|
|
270
287
|
private onRequestFinished(event: Common.EventTarget.EventTargetEvent<NetworkRequest>): void {
|
@@ -332,7 +349,7 @@ export class ResourceTreeModel extends SDKModel<EventTypes> {
|
|
332
349
|
private addFramesRecursively(
|
333
350
|
sameTargetParentFrame: ResourceTreeFrame|null, frameTreePayload: Protocol.Page.FrameResourceTree): void {
|
334
351
|
const framePayload = frameTreePayload.frame;
|
335
|
-
const frame = new ResourceTreeFrame(this, sameTargetParentFrame, framePayload.id, framePayload, null);
|
352
|
+
const frame = new ResourceTreeFrame(this, sameTargetParentFrame, framePayload.id, framePayload, null, null);
|
336
353
|
if (!sameTargetParentFrame && framePayload.parentId) {
|
337
354
|
frame.crossTargetParentFrameId = framePayload.parentId;
|
338
355
|
}
|
@@ -520,6 +537,26 @@ export class ResourceTreeModel extends SDKModel<EventTypes> {
|
|
520
537
|
};
|
521
538
|
}
|
522
539
|
|
540
|
+
private async getStorageKeyData(): Promise<StorageKeyData> {
|
541
|
+
const storageKeys = new Set<string>();
|
542
|
+
let mainStorageKey: string|null = null;
|
543
|
+
|
544
|
+
for (const {isMainFrame, storageKey} of await Promise.all(
|
545
|
+
[...this.framesInternal.values()].map(async f => f.storageKey.then(k => ({
|
546
|
+
isMainFrame: f.isMainFrame(),
|
547
|
+
storageKey: k,
|
548
|
+
}))))) {
|
549
|
+
if (isMainFrame) {
|
550
|
+
mainStorageKey = storageKey;
|
551
|
+
}
|
552
|
+
if (storageKey) {
|
553
|
+
storageKeys.add(storageKey);
|
554
|
+
}
|
555
|
+
}
|
556
|
+
|
557
|
+
return {storageKeys: storageKeys, mainStorageKey: mainStorageKey};
|
558
|
+
}
|
559
|
+
|
523
560
|
private updateSecurityOrigins(): void {
|
524
561
|
const data = this.getSecurityOriginData();
|
525
562
|
this.#securityOriginManager.setMainSecurityOrigin(
|
@@ -527,6 +564,16 @@ export class ResourceTreeModel extends SDKModel<EventTypes> {
|
|
527
564
|
this.#securityOriginManager.updateSecurityOrigins(data.securityOrigins);
|
528
565
|
}
|
529
566
|
|
567
|
+
private async updateStorageKeys(): Promise<void> {
|
568
|
+
const data = await this.getStorageKeyData();
|
569
|
+
this.#storageKeyManager.setMainStorageKey(data.mainStorageKey || '');
|
570
|
+
this.#storageKeyManager.updateStorageKeys(data.storageKeys);
|
571
|
+
}
|
572
|
+
|
573
|
+
async getMainStorageKey(): Promise<string|null> {
|
574
|
+
return this.mainFrame ? this.mainFrame.storageKey : null;
|
575
|
+
}
|
576
|
+
|
530
577
|
getMainSecurityOrigin(): string|null {
|
531
578
|
const data = this.getSecurityOriginData();
|
532
579
|
return data.mainSecurityOrigin || data.unreachableMainSecurityOrigin;
|
@@ -626,6 +673,7 @@ export class ResourceTreeFrame {
|
|
626
673
|
#urlInternal: Platform.DevToolsPath.UrlString;
|
627
674
|
#domainAndRegistryInternal: string;
|
628
675
|
#securityOriginInternal: string|null;
|
676
|
+
#storageKeyInternal?: Promise<string|null>;
|
629
677
|
#unreachableUrlInternal: Platform.DevToolsPath.UrlString;
|
630
678
|
#adFrameStatusInternal?: Protocol.Page.AdFrameStatus;
|
631
679
|
#secureContextType: Protocol.Page.SecureContextType|null;
|
@@ -634,6 +682,8 @@ export class ResourceTreeFrame {
|
|
634
682
|
#creationStackTrace: Protocol.Runtime.StackTrace|null;
|
635
683
|
#creationStackTraceTarget: Target|null;
|
636
684
|
#childFramesInternal: Set<ResourceTreeFrame>;
|
685
|
+
#adScriptId: Protocol.Runtime.ScriptId|null;
|
686
|
+
#debuggerId: Protocol.Runtime.UniqueDebuggerId|null;
|
637
687
|
resourcesMap: Map<Platform.DevToolsPath.UrlString, Resource>;
|
638
688
|
backForwardCacheDetails: {
|
639
689
|
restoredFromCache: boolean|undefined,
|
@@ -648,7 +698,8 @@ export class ResourceTreeFrame {
|
|
648
698
|
|
649
699
|
constructor(
|
650
700
|
model: ResourceTreeModel, parentFrame: ResourceTreeFrame|null, frameId: Protocol.Page.FrameId,
|
651
|
-
payload: Protocol.Page.Frame|null, creationStackTrace: Protocol.Runtime.StackTrace|null
|
701
|
+
payload: Protocol.Page.Frame|null, creationStackTrace: Protocol.Runtime.StackTrace|null,
|
702
|
+
adScriptId: Protocol.Page.AdScriptId|null) {
|
652
703
|
this.#model = model;
|
653
704
|
this.#sameTargetParentFrameInternal = parentFrame;
|
654
705
|
this.#idInternal = frameId;
|
@@ -670,6 +721,9 @@ export class ResourceTreeFrame {
|
|
670
721
|
this.#creationStackTrace = creationStackTrace;
|
671
722
|
this.#creationStackTraceTarget = null;
|
672
723
|
|
724
|
+
this.#adScriptId = adScriptId?.scriptId || null;
|
725
|
+
this.#debuggerId = adScriptId?.debuggerId || null;
|
726
|
+
|
673
727
|
this.#childFramesInternal = new Set();
|
674
728
|
|
675
729
|
this.resourcesMap = new Map();
|
@@ -754,10 +808,33 @@ export class ResourceTreeFrame {
|
|
754
808
|
return this.#domainAndRegistryInternal;
|
755
809
|
}
|
756
810
|
|
811
|
+
getAdScriptId(): Protocol.Runtime.ScriptId|null {
|
812
|
+
return this.#adScriptId;
|
813
|
+
}
|
814
|
+
|
815
|
+
setAdScriptId(adScriptId: Protocol.Runtime.ScriptId|null): void {
|
816
|
+
this.#adScriptId = adScriptId;
|
817
|
+
}
|
818
|
+
|
819
|
+
getDebuggerId(): Protocol.Runtime.UniqueDebuggerId|null {
|
820
|
+
return this.#debuggerId;
|
821
|
+
}
|
822
|
+
|
823
|
+
setDebuggerId(debuggerId: Protocol.Runtime.UniqueDebuggerId|null): void {
|
824
|
+
this.#debuggerId = debuggerId;
|
825
|
+
}
|
826
|
+
|
757
827
|
get securityOrigin(): string|null {
|
758
828
|
return this.#securityOriginInternal;
|
759
829
|
}
|
760
830
|
|
831
|
+
get storageKey(): Promise<string|null> {
|
832
|
+
if (!this.#storageKeyInternal) {
|
833
|
+
this.#storageKeyInternal = this.#model.storageKeyForFrame(this.#idInternal);
|
834
|
+
}
|
835
|
+
return this.#storageKeyInternal;
|
836
|
+
}
|
837
|
+
|
761
838
|
unreachableUrl(): Platform.DevToolsPath.UrlString {
|
762
839
|
return this.#unreachableUrlInternal;
|
763
840
|
}
|
@@ -1033,8 +1110,8 @@ export class PageDispatcher implements ProtocolProxyApi.PageDispatcher {
|
|
1033
1110
|
this.#resourceTreeModel.dispatchEventToListeners(Events.LifecycleEvent, {frameId, name});
|
1034
1111
|
}
|
1035
1112
|
|
1036
|
-
frameAttached({frameId, parentFrameId, stack}: Protocol.Page.FrameAttachedEvent): void {
|
1037
|
-
this.#resourceTreeModel.frameAttached(frameId, parentFrameId, stack);
|
1113
|
+
frameAttached({frameId, parentFrameId, stack, adScriptId}: Protocol.Page.FrameAttachedEvent): void {
|
1114
|
+
this.#resourceTreeModel.frameAttached(frameId, parentFrameId, stack, adScriptId);
|
1038
1115
|
}
|
1039
1116
|
|
1040
1117
|
frameNavigated({frame, type}: Protocol.Page.FrameNavigatedEvent): void {
|
@@ -1122,3 +1199,8 @@ export interface SecurityOriginData {
|
|
1122
1199
|
mainSecurityOrigin: string|null;
|
1123
1200
|
unreachableMainSecurityOrigin: string|null;
|
1124
1201
|
}
|
1202
|
+
|
1203
|
+
export interface StorageKeyData {
|
1204
|
+
storageKeys: Set<string>;
|
1205
|
+
mainStorageKey: string|null;
|
1206
|
+
}
|
@@ -268,7 +268,7 @@ export class Script implements TextUtils.ContentProvider.ContentProvider, FrameA
|
|
268
268
|
return {status: Protocol.Debugger.SetScriptSourceResponseStatus.Ok};
|
269
269
|
}
|
270
270
|
const response = await this.debuggerModel.target().debuggerAgent().invoke_setScriptSource(
|
271
|
-
{scriptId: this.scriptId, scriptSource: newSource});
|
271
|
+
{scriptId: this.scriptId, scriptSource: newSource, allowTopFrameEditing: true});
|
272
272
|
if (response.getError()) {
|
273
273
|
// Something went seriously wrong, like the V8 inspector no longer knowing about this script without
|
274
274
|
// shutting down the Debugger agent etc.
|
@@ -81,5 +81,5 @@ export type EventTypes = {
|
|
81
81
|
[Events.MainSecurityOriginChanged]: MainSecurityOriginChangedEvent,
|
82
82
|
};
|
83
83
|
|
84
|
-
// TODO(jarhar): this is the
|
84
|
+
// TODO(jarhar): this is the one of the two usages of Capability.None. Do something about it!
|
85
85
|
SDKModel.register(SecurityOriginManager, {capabilities: Capability.None, autostart: false});
|
@@ -0,0 +1,71 @@
|
|
1
|
+
// Copyright 2022 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
|
+
|
5
|
+
import type {Target} from './Target.js';
|
6
|
+
import {Capability} from './Target.js';
|
7
|
+
import {SDKModel} from './SDKModel.js';
|
8
|
+
|
9
|
+
export class StorageKeyManager extends SDKModel<EventTypes> {
|
10
|
+
#mainStorageKeyInternal: string;
|
11
|
+
#storageKeysInternal: Set<string>;
|
12
|
+
constructor(target: Target) {
|
13
|
+
super(target);
|
14
|
+
|
15
|
+
this.#mainStorageKeyInternal = '';
|
16
|
+
this.#storageKeysInternal = new Set();
|
17
|
+
}
|
18
|
+
|
19
|
+
updateStorageKeys(storageKeys: Set<string>): void {
|
20
|
+
const oldStorageKeys = this.#storageKeysInternal;
|
21
|
+
this.#storageKeysInternal = storageKeys;
|
22
|
+
|
23
|
+
for (const storageKey of oldStorageKeys) {
|
24
|
+
if (!this.#storageKeysInternal.has(storageKey)) {
|
25
|
+
this.dispatchEventToListeners(Events.StorageKeyRemoved, storageKey);
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
for (const storageKey of this.#storageKeysInternal) {
|
30
|
+
if (!oldStorageKeys.has(storageKey)) {
|
31
|
+
this.dispatchEventToListeners(Events.StorageKeyAdded, storageKey);
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
storageKeys(): string[] {
|
37
|
+
return [...this.#storageKeysInternal];
|
38
|
+
}
|
39
|
+
|
40
|
+
mainStorageKey(): string {
|
41
|
+
return this.#mainStorageKeyInternal;
|
42
|
+
}
|
43
|
+
|
44
|
+
setMainStorageKey(storageKey: string): void {
|
45
|
+
this.#mainStorageKeyInternal = storageKey;
|
46
|
+
this.dispatchEventToListeners(Events.MainStorageKeyChanged, {
|
47
|
+
mainStorageKey: this.#mainStorageKeyInternal,
|
48
|
+
});
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
// TODO(crbug.com/1167717): Make this a const enum again
|
53
|
+
// eslint-disable-next-line rulesdir/const_enum
|
54
|
+
export enum Events {
|
55
|
+
StorageKeyAdded = 'StorageKeyAdded',
|
56
|
+
StorageKeyRemoved = 'StorageKeyRemoved',
|
57
|
+
MainStorageKeyChanged = 'MainStorageKeyChanged',
|
58
|
+
}
|
59
|
+
|
60
|
+
export interface MainStorageKeyChangedEvent {
|
61
|
+
mainStorageKey: string;
|
62
|
+
}
|
63
|
+
|
64
|
+
export type EventTypes = {
|
65
|
+
[Events.StorageKeyAdded]: string,
|
66
|
+
[Events.StorageKeyRemoved]: string,
|
67
|
+
[Events.MainStorageKeyChanged]: MainStorageKeyChangedEvent,
|
68
|
+
};
|
69
|
+
|
70
|
+
// TODO(jarhar): this is the one of the two usages of Capability.None. Do something about it!
|
71
|
+
SDKModel.register(StorageKeyManager, {capabilities: Capability.None, autostart: false});
|
@@ -72,6 +72,7 @@ import * as ServiceWorkerCacheModel from './ServiceWorkerCacheModel.js';
|
|
72
72
|
import * as ServiceWorkerManager from './ServiceWorkerManager.js';
|
73
73
|
import * as SourceMap from './SourceMap.js';
|
74
74
|
import * as SourceMapManager from './SourceMapManager.js';
|
75
|
+
import * as StorageKeyManager from './StorageKeyManager.js';
|
75
76
|
import * as Target from './Target.js';
|
76
77
|
import * as TargetManager from './TargetManager.js';
|
77
78
|
import * as TracingManager from './TracingManager.js';
|
@@ -141,6 +142,7 @@ export {
|
|
141
142
|
ServiceWorkerManager,
|
142
143
|
SourceMap,
|
143
144
|
SourceMapManager,
|
145
|
+
StorageKeyManager,
|
144
146
|
Target,
|
145
147
|
TargetManager,
|
146
148
|
TracingManager,
|
@@ -312,8 +312,9 @@ export class ScopeVariableAnalysis {
|
|
312
312
|
break;
|
313
313
|
case 'Property':
|
314
314
|
if (node.shorthand) {
|
315
|
-
console.assert(node.value === node.key);
|
316
315
|
console.assert(node.value.type === 'Identifier');
|
316
|
+
console.assert(node.key.type === 'Identifier');
|
317
|
+
console.assert((node.value as Acorn.ESTree.Identifier).name === (node.key as Acorn.ESTree.Identifier).name);
|
317
318
|
this.#addVariable((node.value as Acorn.ESTree.Identifier).name, node.value.start, DefinitionKind.None, true);
|
318
319
|
} else {
|
319
320
|
if (node.computed) {
|
@@ -469,8 +470,9 @@ export class ScopeVariableAnalysis {
|
|
469
470
|
case 'Property':
|
470
471
|
// This is AssignmentProperty inside an object pattern.
|
471
472
|
if (node.shorthand) {
|
472
|
-
console.assert(node.value === node.key);
|
473
473
|
console.assert(node.value.type === 'Identifier');
|
474
|
+
console.assert(node.key.type === 'Identifier');
|
475
|
+
console.assert((node.value as Acorn.ESTree.Identifier).name === (node.key as Acorn.ESTree.Identifier).name);
|
474
476
|
this.#addVariable((node.value as Acorn.ESTree.Identifier).name, node.value.start, definitionKind, true);
|
475
477
|
} else {
|
476
478
|
if (node.computed) {
|
@@ -253,7 +253,8 @@ const UIStrings = {
|
|
253
253
|
*/
|
254
254
|
rtcpMuxPolicyNegotiate: 'The `rtcpMuxPolicy` option is deprecated and will be removed.',
|
255
255
|
/**
|
256
|
-
* @description
|
256
|
+
* @description A deprecation warning shown in the DevTools Issues tab. The placeholder is always the noun
|
257
|
+
* "SharedArrayBuffer" which refers to a JavaScript construct.
|
257
258
|
*/
|
258
259
|
sharedArrayBufferConstructedWithoutIsolation:
|
259
260
|
'`SharedArrayBuffer` will require cross-origin isolation. See https://developer.chrome.com/blog/enabling-shared-array-buffer/ for more details.',
|
@@ -265,7 +266,9 @@ const UIStrings = {
|
|
265
266
|
textToSpeech_DisallowedByAutoplay:
|
266
267
|
'`speechSynthesis.speak()` without user activation is deprecated and will be removed.',
|
267
268
|
/**
|
268
|
-
* @description
|
269
|
+
* @description A deprecation warning shown in the DevTools Issues tab. The placeholder is always the noun
|
270
|
+
* "SharedArrayBuffer" which refers to a JavaScript construct. "Extensions" refers to Chrome extensions. The warning is shown
|
271
|
+
* when Chrome Extensions attempt to use "SharedArrayBuffer"s under insecure circumstances.
|
269
272
|
*/
|
270
273
|
v8SharedArrayBufferConstructedInExtensionWithoutIsolation:
|
271
274
|
'Extensions should opt into cross-origin isolation to continue using `SharedArrayBuffer`. See https://developer.chrome.com/docs/extensions/mv3/cross-origin-isolation/.',
|
@@ -181,7 +181,7 @@ export class TimelineModelImpl {
|
|
181
181
|
case RecordType.MarkLoad:
|
182
182
|
case RecordType.MarkLCPCandidate:
|
183
183
|
case RecordType.MarkLCPInvalidate:
|
184
|
-
return Boolean(event.args['data']['isMainFrame']);
|
184
|
+
return Boolean(event.args['data']['isOutermostMainFrame'] ?? event.args['data']['isMainFrame']);
|
185
185
|
default:
|
186
186
|
return false;
|
187
187
|
}
|
@@ -203,11 +203,13 @@ export class TimelineModelImpl {
|
|
203
203
|
}
|
204
204
|
|
205
205
|
isLCPCandidateEvent(event: SDK.TracingModel.Event): boolean {
|
206
|
-
return event.name === RecordType.MarkLCPCandidate &&
|
206
|
+
return event.name === RecordType.MarkLCPCandidate &&
|
207
|
+
Boolean(event.args['data']['isOutermostMainFrame'] ?? event.args['data']['isMainFrame']);
|
207
208
|
}
|
208
209
|
|
209
210
|
isLCPInvalidateEvent(event: SDK.TracingModel.Event): boolean {
|
210
|
-
return event.name === RecordType.MarkLCPInvalidate &&
|
211
|
+
return event.name === RecordType.MarkLCPInvalidate &&
|
212
|
+
Boolean(event.args['data']['isOutermostMainFrame'] ?? event.args['data']['isMainFrame']);
|
211
213
|
}
|
212
214
|
|
213
215
|
isFCPEvent(event: SDK.TracingModel.Event): boolean {
|
@@ -1133,7 +1135,7 @@ export class TimelineModelImpl {
|
|
1133
1135
|
break;
|
1134
1136
|
}
|
1135
1137
|
const frameId = TimelineModelImpl.eventFrameId(event);
|
1136
|
-
const
|
1138
|
+
const isOutermostMainFrame = Boolean(eventData['isOutermostMainFrame'] ?? eventData['isMainFrame']);
|
1137
1139
|
const pageFrame = frameId ? this.pageFrames.get(frameId) : null;
|
1138
1140
|
if (pageFrame) {
|
1139
1141
|
pageFrame.update(event.startTime, eventData);
|
@@ -1144,13 +1146,13 @@ export class TimelineModelImpl {
|
|
1144
1146
|
if (eventData['page'] && eventData['page'] !== this.legacyCurrentPage) {
|
1145
1147
|
return false;
|
1146
1148
|
}
|
1147
|
-
} else if (
|
1149
|
+
} else if (isOutermostMainFrame) {
|
1148
1150
|
return false;
|
1149
1151
|
} else if (!this.addPageFrame(event, eventData)) {
|
1150
1152
|
return false;
|
1151
1153
|
}
|
1152
1154
|
}
|
1153
|
-
if (
|
1155
|
+
if (isOutermostMainFrame && frameId) {
|
1154
1156
|
const frame = this.pageFrames.get(frameId);
|
1155
1157
|
if (frame) {
|
1156
1158
|
this.mainFrame = frame;
|