chrome-devtools-frontend 1.0.1006768 → 1.0.1007307
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/config/gni/devtools_image_files.gni +2 -0
- package/front_end/Images/src/ic_sources_authored.svg +5 -0
- package/front_end/Images/src/ic_sources_deployed.svg +5 -0
- package/front_end/core/i18n/locales/en-US.json +25 -1
- package/front_end/core/i18n/locales/en-XL.json +25 -1
- package/front_end/core/sdk/DebuggerModel.ts +12 -3
- package/front_end/core/sdk/NetworkManager.ts +6 -2
- package/front_end/devtools_compatibility.js +1 -0
- package/front_end/entrypoints/formatter_worker/FormatterActions.ts +1 -0
- package/front_end/entrypoints/formatter_worker/ScopeParser.ts +12 -10
- package/front_end/entrypoints/formatter_worker/formatter_worker-entrypoint.ts +4 -0
- package/front_end/models/formatter/FormatterWorkerPool.ts +6 -0
- package/front_end/models/javascript_metadata/JavaScriptMetadata.ts +13 -20
- package/front_end/models/javascript_metadata/NativeFunctions.js +1237 -3962
- package/front_end/models/source_map_scopes/NamesResolver.ts +206 -73
- package/front_end/models/workspace/UISourceCode.ts +7 -0
- package/front_end/panels/application/components/BackForwardCacheView.ts +16 -0
- package/front_end/panels/lighthouse/LighthouseStartView.ts +7 -5
- package/front_end/panels/lighthouse/LighthouseStartViewFR.ts +70 -49
- package/front_end/panels/network/components/RequestHeadersView.css +31 -3
- package/front_end/panels/network/components/RequestHeadersView.ts +126 -3
- package/front_end/panels/sources/NavigatorView.ts +141 -40
- package/front_end/panels/sources/SourcesPanel.ts +8 -0
- package/front_end/panels/sources/TabbedEditorContainer.ts +2 -2
- package/front_end/panels/sources/sources-meta.ts +6 -0
- package/front_end/ui/components/text_editor/javascript.ts +12 -14
- package/front_end/ui/legacy/Treeoutline.ts +5 -2
- package/package.json +1 -1
- package/scripts/hosted_mode/server.js +14 -1
- package/scripts/javascript_natives/helpers.js +26 -7
- package/scripts/javascript_natives/index.js +4 -3
- package/scripts/javascript_natives/tests.js +2 -2
@@ -93,6 +93,8 @@ grd_files_release_sources = [
|
|
93
93
|
"front_end/Images/ic_request_response.svg",
|
94
94
|
"front_end/Images/ic_response.svg",
|
95
95
|
"front_end/Images/ic_show_node_16x16.svg",
|
96
|
+
"front_end/Images/ic_sources_authored.svg",
|
97
|
+
"front_end/Images/ic_sources_deployed.svg",
|
96
98
|
"front_end/Images/ic_suggest_color.svg",
|
97
99
|
"front_end/Images/ic_undo_16x16_icon.svg",
|
98
100
|
"front_end/Images/ic_warning_black_18dp.svg",
|
@@ -103,6 +103,8 @@ devtools_svg_sources = [
|
|
103
103
|
"ic_request_response.svg",
|
104
104
|
"ic_response.svg",
|
105
105
|
"ic_show_node_16x16.svg",
|
106
|
+
"ic_sources_authored.svg",
|
107
|
+
"ic_sources_deployed.svg",
|
106
108
|
"ic_suggest_color.svg",
|
107
109
|
"ic_undo_16x16_icon.svg",
|
108
110
|
"ic_warning_black_18dp.svg",
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M0.939346 8L4.46968 4.46967C4.76257 4.17678 5.23744 4.17678 5.53034 4.46967C5.82323 4.76256 5.82323 5.23744 5.53034 5.53033L3.06067 8L5.53034 10.4697C5.82323 10.7626 5.82323 11.2374 5.53034 11.5303C5.23744 11.8232 4.76257 11.8232 4.46968 11.5303L0.939346 8Z" fill="black"/>
|
3
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.48821 2.44593C9.88831 2.55314 10.1257 2.96439 10.0185 3.36449L7.43035 13.0237C7.32314 13.4238 6.91189 13.6613 6.51179 13.5541C6.11169 13.4469 5.87425 13.0356 5.98146 12.6355L8.56965 2.97626C8.67686 2.57616 9.08811 2.33872 9.48821 2.44593Z" fill="black"/>
|
4
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M15.0607 8L11.5303 4.46967C11.2374 4.17678 10.7626 4.17678 10.4697 4.46967C10.1768 4.76256 10.1768 5.23744 10.4697 5.53033L12.9393 8L10.4697 10.4697C10.1768 10.7626 10.1768 11.2374 10.4697 11.5303C10.7626 11.8232 11.2374 11.8232 11.5303 11.5303L15.0607 8Z" fill="black"/>
|
5
|
+
</svg>
|
@@ -254,6 +254,9 @@
|
|
254
254
|
"core/sdk/DebuggerModel.ts | block": {
|
255
255
|
"message": "Block"
|
256
256
|
},
|
257
|
+
"core/sdk/DebuggerModel.ts | catchBlock": {
|
258
|
+
"message": "Catch block"
|
259
|
+
},
|
257
260
|
"core/sdk/DebuggerModel.ts | closure": {
|
258
261
|
"message": "Closure"
|
259
262
|
},
|
@@ -273,7 +276,7 @@
|
|
273
276
|
"message": "Script"
|
274
277
|
},
|
275
278
|
"core/sdk/DebuggerModel.ts | withBlock": {
|
276
|
-
"message": "With
|
279
|
+
"message": "With block"
|
277
280
|
},
|
278
281
|
"core/sdk/DOMDebuggerModel.ts | animation": {
|
279
282
|
"message": "Animation"
|
@@ -2939,6 +2942,9 @@
|
|
2939
2942
|
"panels/application/components/BackForwardCacheView.ts | mainFrame": {
|
2940
2943
|
"message": "Main Frame"
|
2941
2944
|
},
|
2945
|
+
"panels/application/components/BackForwardCacheView.ts | neverUseUnload": {
|
2946
|
+
"message": "Learn more: Never use unload handler"
|
2947
|
+
},
|
2942
2948
|
"panels/application/components/BackForwardCacheView.ts | normalNavigation": {
|
2943
2949
|
"message": "Not served from back/forward cache: to trigger back/forward cache, use Chrome's back/forward buttons, or use the test button below to automatically navigate away and back."
|
2944
2950
|
},
|
@@ -6626,18 +6632,27 @@
|
|
6626
6632
|
"panels/network/components/RequestHeadersView.ts | general": {
|
6627
6633
|
"message": "General"
|
6628
6634
|
},
|
6635
|
+
"panels/network/components/RequestHeadersView.ts | raw": {
|
6636
|
+
"message": "Raw"
|
6637
|
+
},
|
6629
6638
|
"panels/network/components/RequestHeadersView.ts | referrerPolicy": {
|
6630
6639
|
"message": "Referrer Policy"
|
6631
6640
|
},
|
6632
6641
|
"panels/network/components/RequestHeadersView.ts | remoteAddress": {
|
6633
6642
|
"message": "Remote Address"
|
6634
6643
|
},
|
6644
|
+
"panels/network/components/RequestHeadersView.ts | requestHeaders": {
|
6645
|
+
"message": "Request Headers"
|
6646
|
+
},
|
6635
6647
|
"panels/network/components/RequestHeadersView.ts | requestMethod": {
|
6636
6648
|
"message": "Request Method"
|
6637
6649
|
},
|
6638
6650
|
"panels/network/components/RequestHeadersView.ts | requestUrl": {
|
6639
6651
|
"message": "Request URL"
|
6640
6652
|
},
|
6653
|
+
"panels/network/components/RequestHeadersView.ts | responseHeaders": {
|
6654
|
+
"message": "Response Headers"
|
6655
|
+
},
|
6641
6656
|
"panels/network/components/RequestHeadersView.ts | statusCode": {
|
6642
6657
|
"message": "Status Code"
|
6643
6658
|
},
|
@@ -9758,12 +9773,18 @@
|
|
9758
9773
|
"panels/sources/NavigatorView.ts | areYouSureYouWantToRemoveThis": {
|
9759
9774
|
"message": "Are you sure you want to remove this folder?"
|
9760
9775
|
},
|
9776
|
+
"panels/sources/NavigatorView.ts | authored": {
|
9777
|
+
"message": "Authored"
|
9778
|
+
},
|
9761
9779
|
"panels/sources/NavigatorView.ts | delete": {
|
9762
9780
|
"message": "Delete"
|
9763
9781
|
},
|
9764
9782
|
"panels/sources/NavigatorView.ts | deleteAllOverrides": {
|
9765
9783
|
"message": "Delete all overrides"
|
9766
9784
|
},
|
9785
|
+
"panels/sources/NavigatorView.ts | deployed": {
|
9786
|
+
"message": "Deployed"
|
9787
|
+
},
|
9767
9788
|
"panels/sources/NavigatorView.ts | excludeFolder": {
|
9768
9789
|
"message": "Exclude folder"
|
9769
9790
|
},
|
@@ -10193,6 +10214,9 @@
|
|
10193
10214
|
"panels/sources/SourcesPanel.ts | dropWorkspaceFolderHere": {
|
10194
10215
|
"message": "Drop workspace folder here"
|
10195
10216
|
},
|
10217
|
+
"panels/sources/SourcesPanel.ts | groupByAuthored": {
|
10218
|
+
"message": "Group by Authored/Deployed (experimental)"
|
10219
|
+
},
|
10196
10220
|
"panels/sources/SourcesPanel.ts | groupByFolder": {
|
10197
10221
|
"message": "Group by folder"
|
10198
10222
|
},
|
@@ -254,6 +254,9 @@
|
|
254
254
|
"core/sdk/DebuggerModel.ts | block": {
|
255
255
|
"message": "B̂ĺôćk̂"
|
256
256
|
},
|
257
|
+
"core/sdk/DebuggerModel.ts | catchBlock": {
|
258
|
+
"message": "Catch b̂ĺôćk̂"
|
259
|
+
},
|
257
260
|
"core/sdk/DebuggerModel.ts | closure": {
|
258
261
|
"message": "Ĉĺôśûŕê"
|
259
262
|
},
|
@@ -273,7 +276,7 @@
|
|
273
276
|
"message": "Ŝćr̂íp̂t́"
|
274
277
|
},
|
275
278
|
"core/sdk/DebuggerModel.ts | withBlock": {
|
276
|
-
"message": "With
|
279
|
+
"message": "With b̂ĺôćk̂"
|
277
280
|
},
|
278
281
|
"core/sdk/DOMDebuggerModel.ts | animation": {
|
279
282
|
"message": "Âńîḿât́îón̂"
|
@@ -2939,6 +2942,9 @@
|
|
2939
2942
|
"panels/application/components/BackForwardCacheView.ts | mainFrame": {
|
2940
2943
|
"message": "M̂áîń F̂ŕâḿê"
|
2941
2944
|
},
|
2945
|
+
"panels/application/components/BackForwardCacheView.ts | neverUseUnload": {
|
2946
|
+
"message": "L̂éâŕn̂ ḿôŕê: Ńêv́êŕ ûśê ún̂ĺôád̂ h́âńd̂ĺêŕ"
|
2947
|
+
},
|
2942
2948
|
"panels/application/components/BackForwardCacheView.ts | normalNavigation": {
|
2943
2949
|
"message": "N̂ót̂ śêŕv̂éd̂ f́r̂óm̂ b́âćk̂/f́ôŕŵár̂d́ ĉáĉh́ê: t́ô t́r̂íĝǵêŕ b̂áĉḱ/f̂ór̂ẃâŕd̂ ćâćĥé, ûśê Ćĥŕôḿê'ś b̂áĉḱ/f̂ór̂ẃâŕd̂ b́ût́t̂ón̂ś, ôŕ ûśê t́ĥé t̂éŝt́ b̂út̂t́ôń b̂él̂óŵ t́ô áût́ôḿât́îćâĺl̂ý n̂áv̂íĝát̂é âẃâý âńd̂ b́âćk̂."
|
2944
2950
|
},
|
@@ -6626,18 +6632,27 @@
|
|
6626
6632
|
"panels/network/components/RequestHeadersView.ts | general": {
|
6627
6633
|
"message": "Ĝén̂ér̂ál̂"
|
6628
6634
|
},
|
6635
|
+
"panels/network/components/RequestHeadersView.ts | raw": {
|
6636
|
+
"message": "R̂áŵ"
|
6637
|
+
},
|
6629
6638
|
"panels/network/components/RequestHeadersView.ts | referrerPolicy": {
|
6630
6639
|
"message": "R̂éf̂ér̂ŕêŕ P̂ól̂íĉý"
|
6631
6640
|
},
|
6632
6641
|
"panels/network/components/RequestHeadersView.ts | remoteAddress": {
|
6633
6642
|
"message": "R̂ém̂ót̂é Âd́d̂ŕêśŝ"
|
6634
6643
|
},
|
6644
|
+
"panels/network/components/RequestHeadersView.ts | requestHeaders": {
|
6645
|
+
"message": "R̂éq̂úêśt̂ H́êád̂ér̂ś"
|
6646
|
+
},
|
6635
6647
|
"panels/network/components/RequestHeadersView.ts | requestMethod": {
|
6636
6648
|
"message": "R̂éq̂úêśt̂ Ḿêt́ĥód̂"
|
6637
6649
|
},
|
6638
6650
|
"panels/network/components/RequestHeadersView.ts | requestUrl": {
|
6639
6651
|
"message": "R̂éq̂úêśt̂ ÚR̂Ĺ"
|
6640
6652
|
},
|
6653
|
+
"panels/network/components/RequestHeadersView.ts | responseHeaders": {
|
6654
|
+
"message": "R̂éŝṕôńŝé Ĥéâd́êŕŝ"
|
6655
|
+
},
|
6641
6656
|
"panels/network/components/RequestHeadersView.ts | statusCode": {
|
6642
6657
|
"message": "Ŝt́ât́ûś Ĉód̂é"
|
6643
6658
|
},
|
@@ -9758,12 +9773,18 @@
|
|
9758
9773
|
"panels/sources/NavigatorView.ts | areYouSureYouWantToRemoveThis": {
|
9759
9774
|
"message": "Âŕê ýôú ŝúr̂é ŷóû ẃâńt̂ t́ô ŕêḿôv́ê t́ĥíŝ f́ôĺd̂ér̂?"
|
9760
9775
|
},
|
9776
|
+
"panels/sources/NavigatorView.ts | authored": {
|
9777
|
+
"message": "Âút̂h́ôŕêd́"
|
9778
|
+
},
|
9761
9779
|
"panels/sources/NavigatorView.ts | delete": {
|
9762
9780
|
"message": "D̂él̂ét̂é"
|
9763
9781
|
},
|
9764
9782
|
"panels/sources/NavigatorView.ts | deleteAllOverrides": {
|
9765
9783
|
"message": "D̂él̂ét̂é âĺl̂ óv̂ér̂ŕîd́êś"
|
9766
9784
|
},
|
9785
|
+
"panels/sources/NavigatorView.ts | deployed": {
|
9786
|
+
"message": "D̂ép̂ĺôýêd́"
|
9787
|
+
},
|
9767
9788
|
"panels/sources/NavigatorView.ts | excludeFolder": {
|
9768
9789
|
"message": "Êx́ĉĺûd́ê f́ôĺd̂ér̂"
|
9769
9790
|
},
|
@@ -10193,6 +10214,9 @@
|
|
10193
10214
|
"panels/sources/SourcesPanel.ts | dropWorkspaceFolderHere": {
|
10194
10215
|
"message": "D̂ŕôṕ ŵór̂ḱŝṕâćê f́ôĺd̂ér̂ h́êŕê"
|
10195
10216
|
},
|
10217
|
+
"panels/sources/SourcesPanel.ts | groupByAuthored": {
|
10218
|
+
"message": "Ĝŕôúp̂ b́ŷ Áût́ĥór̂éd̂/D́êṕl̂óŷéd̂ (éx̂ṕêŕîḿêńt̂ál̂)"
|
10219
|
+
},
|
10196
10220
|
"panels/sources/SourcesPanel.ts | groupByFolder": {
|
10197
10221
|
"message": "Ĝŕôúp̂ b́ŷ f́ôĺd̂ér̂"
|
10198
10222
|
},
|
@@ -70,9 +70,16 @@ const UIStrings = {
|
|
70
70
|
script: 'Script',
|
71
71
|
/**
|
72
72
|
*@description Title of a section in the debugger showing JavaScript variables from the a 'with'
|
73
|
-
*block. Block here means section of code, 'with' refers to a JavaScript programming concept
|
73
|
+
*block. Block here means section of code, 'with' refers to a JavaScript programming concept and
|
74
|
+
*is a fixed term.
|
74
75
|
*/
|
75
|
-
withBlock: '`With`
|
76
|
+
withBlock: '`With` block',
|
77
|
+
/**
|
78
|
+
*@description Title of a section in the debugger showing JavaScript variables from the a 'catch'
|
79
|
+
*block. Block here means section of code, 'catch' refers to a JavaScript programming concept and
|
80
|
+
*is a fixed term.
|
81
|
+
*/
|
82
|
+
catchBlock: '`Catch` block',
|
76
83
|
/**
|
77
84
|
*@description Title of a section in the debugger showing JavaScript variables from the global scope.
|
78
85
|
*/
|
@@ -1464,7 +1471,9 @@ export class Scope implements ScopeChainEntry {
|
|
1464
1471
|
case Protocol.Debugger.ScopeType.Closure:
|
1465
1472
|
return i18nString(UIStrings.closure);
|
1466
1473
|
case Protocol.Debugger.ScopeType.Catch:
|
1467
|
-
return
|
1474
|
+
return i18nString(UIStrings.catchBlock);
|
1475
|
+
case Protocol.Debugger.ScopeType.Eval:
|
1476
|
+
return i18n.i18n.lockedString('Eval');
|
1468
1477
|
case Protocol.Debugger.ScopeType.Block:
|
1469
1478
|
return i18nString(UIStrings.block);
|
1470
1479
|
case Protocol.Debugger.ScopeType.Script:
|
@@ -255,6 +255,10 @@ export class NetworkManager extends SDKModel<EventTypes> {
|
|
255
255
|
return this.dispatcher.requestForURL(url);
|
256
256
|
}
|
257
257
|
|
258
|
+
requestforId(id: string): NetworkRequest|null {
|
259
|
+
return this.dispatcher.requestForId(id);
|
260
|
+
}
|
261
|
+
|
258
262
|
private cacheDisabledSettingChanged({data: enabled}: Common.EventTarget.EventTargetEvent<boolean>): void {
|
259
263
|
void this.#networkAgent.invoke_setCacheDisabled({cacheDisabled: enabled});
|
260
264
|
}
|
@@ -520,8 +524,8 @@ export class NetworkDispatcher implements ProtocolProxyApi.NetworkDispatcher {
|
|
520
524
|
}
|
521
525
|
}
|
522
526
|
|
523
|
-
requestForId(
|
524
|
-
return this.#requestsById.get(
|
527
|
+
requestForId(id: string): NetworkRequest|null {
|
528
|
+
return this.#requestsById.get(id) || null;
|
525
529
|
}
|
526
530
|
|
527
531
|
requestForURL(url: Platform.DevToolsPath.UrlString): NetworkRequest|null {
|
@@ -9,6 +9,7 @@ export const enum FormatterActions {
|
|
9
9
|
JAVASCRIPT_OUTLINE = 'javaScriptOutline',
|
10
10
|
JAVASCRIPT_IDENTIFIERS = 'javaScriptIdentifiers',
|
11
11
|
JAVASCRIPT_SUBSTITUTE = 'javaScriptSubstitute',
|
12
|
+
JAVASCRIPT_SCOPE_TREE = 'javaScriptScopeTree',
|
12
13
|
EVALUATE_JAVASCRIPT_SUBSTRING = 'evaluatableJavaScriptSubstring',
|
13
14
|
ARGUMENTS_LIST = 'argumentsList',
|
14
15
|
}
|
@@ -171,7 +171,12 @@ export class ScopeVariableAnalysis {
|
|
171
171
|
case 'ArrowFunctionExpression': {
|
172
172
|
this.#pushScope(node.start, node.end);
|
173
173
|
node.params.forEach(this.#processNodeAsDefinition.bind(this, DefinitionKind.Var));
|
174
|
-
|
174
|
+
if (node.body.type === 'BlockStatement') {
|
175
|
+
// Include the body of the arrow function in the same scope as the arguments.
|
176
|
+
node.body.body.forEach(this.#processNode.bind(this));
|
177
|
+
} else {
|
178
|
+
this.#processNode(node.body);
|
179
|
+
}
|
175
180
|
this.#popScope(true);
|
176
181
|
break;
|
177
182
|
}
|
@@ -199,7 +204,7 @@ export class ScopeVariableAnalysis {
|
|
199
204
|
case 'CatchClause':
|
200
205
|
this.#pushScope(node.start, node.end);
|
201
206
|
this.#processNodeAsDefinition(DefinitionKind.Let, node.param);
|
202
|
-
|
207
|
+
this.#processNode(node.body);
|
203
208
|
this.#popScope(false);
|
204
209
|
break;
|
205
210
|
case 'ClassBody':
|
@@ -207,17 +212,13 @@ export class ScopeVariableAnalysis {
|
|
207
212
|
break;
|
208
213
|
case 'ClassDeclaration':
|
209
214
|
this.#processNodeAsDefinition(DefinitionKind.Let, node.id);
|
210
|
-
this.#pushScope(node.start, node.end);
|
211
215
|
this.#processNode(node.superClass ?? null);
|
212
216
|
this.#processNode(node.body);
|
213
|
-
this.#popScope(false);
|
214
217
|
break;
|
215
218
|
case 'ClassExpression':
|
216
|
-
this.#pushScope(node.start, node.end);
|
217
219
|
// Intentionally ignore the id.
|
218
220
|
this.#processNode(node.superClass ?? null);
|
219
221
|
this.#processNode(node.body);
|
220
|
-
this.#popScope(false);
|
221
222
|
break;
|
222
223
|
case 'ChainExpression':
|
223
224
|
this.#processNode(node.expression);
|
@@ -253,16 +254,17 @@ export class ScopeVariableAnalysis {
|
|
253
254
|
this.#addVariable('this', node.start, DefinitionKind.Fixed);
|
254
255
|
this.#addVariable('arguments', node.start, DefinitionKind.Fixed);
|
255
256
|
node.params.forEach(this.#processNodeAsDefinition.bind(this, DefinitionKind.Let));
|
256
|
-
|
257
|
+
// Process the body of the block statement directly to avoid creating new scope.
|
258
|
+
node.body.body.forEach(this.#processNode.bind(this));
|
257
259
|
this.#popScope(true);
|
258
260
|
break;
|
259
261
|
case 'FunctionExpression':
|
260
|
-
|
261
|
-
this.#pushScope(node.start, node.end);
|
262
|
+
this.#pushScope(node.id?.end ?? node.start, node.end);
|
262
263
|
this.#addVariable('this', node.start, DefinitionKind.Fixed);
|
263
264
|
this.#addVariable('arguments', node.start, DefinitionKind.Fixed);
|
264
265
|
node.params.forEach(this.#processNodeAsDefinition.bind(this, DefinitionKind.Let));
|
265
|
-
|
266
|
+
// Process the body of the block statement directly to avoid creating new scope.
|
267
|
+
node.body.body.forEach(this.#processNode.bind(this));
|
266
268
|
this.#popScope(true);
|
267
269
|
break;
|
268
270
|
case 'Identifier':
|
@@ -37,6 +37,10 @@ self.onmessage = function(event: MessageEvent): void {
|
|
37
37
|
self.postMessage(FormatterWorker.Substitute.substituteExpression(params.content, mapping));
|
38
38
|
break;
|
39
39
|
}
|
40
|
+
case FormatterActions.JAVASCRIPT_SCOPE_TREE: {
|
41
|
+
self.postMessage(FormatterWorker.ScopeParser.parseScopes(params.content)?.export());
|
42
|
+
break;
|
43
|
+
}
|
40
44
|
case FormatterActions.EVALUATE_JAVASCRIPT_SUBSTRING:
|
41
45
|
self.postMessage(FormatterWorker.FormatterWorker.evaluatableJavaScriptSubstring(params.content));
|
42
46
|
break;
|
@@ -4,6 +4,7 @@
|
|
4
4
|
|
5
5
|
import * as Common from '../../core/common/common.js';
|
6
6
|
import * as FormatterActions from '../../entrypoints/formatter_worker/FormatterActions.js'; // eslint-disable-line rulesdir/es_modules_import
|
7
|
+
export {DefinitionKind, type ScopeTreeNode} from '../../entrypoints/formatter_worker/FormatterActions.js';
|
7
8
|
|
8
9
|
const MAX_WORKERS = Math.min(2, navigator.hardwareConcurrency - 1);
|
9
10
|
|
@@ -140,6 +141,11 @@ export class FormatterWorkerPool {
|
|
140
141
|
.then(result => result || '');
|
141
142
|
}
|
142
143
|
|
144
|
+
javaScriptScopeTree(expression: string): Promise<FormatterActions.ScopeTreeNode|null> {
|
145
|
+
return this.runTask(FormatterActions.FormatterActions.JAVASCRIPT_SCOPE_TREE, {content: expression})
|
146
|
+
.then(result => result || null);
|
147
|
+
}
|
148
|
+
|
143
149
|
evaluatableJavaScriptSubstring(content: string): Promise<string> {
|
144
150
|
return this.runTask(FormatterActions.FormatterActions.EVALUATE_JAVASCRIPT_SUBSTRING, {content: content})
|
145
151
|
.then(text => text || '');
|
@@ -10,8 +10,7 @@ let javaScriptMetadataInstance: JavaScriptMetadataImpl;
|
|
10
10
|
|
11
11
|
export class JavaScriptMetadataImpl implements Common.JavaScriptMetaData.JavaScriptMetaData {
|
12
12
|
private readonly uniqueFunctions: Map<string, string[][]>;
|
13
|
-
private readonly
|
14
|
-
private readonly staticMethods: Map<string, Map<string, string[][]>>;
|
13
|
+
private readonly receiverMethods: Map<string, Map<string, string[][]>>;
|
15
14
|
static instance(opts: {
|
16
15
|
forceNew: boolean|null,
|
17
16
|
} = {forceNew: null}): JavaScriptMetadataImpl {
|
@@ -24,26 +23,20 @@ export class JavaScriptMetadataImpl implements Common.JavaScriptMetaData.JavaScr
|
|
24
23
|
}
|
25
24
|
constructor() {
|
26
25
|
this.uniqueFunctions = new Map();
|
27
|
-
this.
|
28
|
-
this.staticMethods = new Map();
|
26
|
+
this.receiverMethods = new Map();
|
29
27
|
|
30
28
|
for (const nativeFunction of NativeFunctions) {
|
31
|
-
if (!nativeFunction.
|
29
|
+
if (!nativeFunction.receivers) {
|
32
30
|
this.uniqueFunctions.set(nativeFunction.name, nativeFunction.signatures);
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
} else {
|
41
|
-
let instanceMethod = this.instanceMethods.get(nativeFunction.receiver);
|
42
|
-
if (!instanceMethod) {
|
43
|
-
instanceMethod = new Map();
|
44
|
-
this.instanceMethods.set(nativeFunction.receiver, instanceMethod);
|
31
|
+
continue;
|
32
|
+
}
|
33
|
+
for (const receiver of nativeFunction.receivers) {
|
34
|
+
let method = this.receiverMethods.get(receiver);
|
35
|
+
if (!method) {
|
36
|
+
method = new Map();
|
37
|
+
this.receiverMethods.set(receiver, method);
|
45
38
|
}
|
46
|
-
|
39
|
+
method.set(nativeFunction.name, nativeFunction.signatures);
|
47
40
|
}
|
48
41
|
}
|
49
42
|
}
|
@@ -53,7 +46,7 @@ export class JavaScriptMetadataImpl implements Common.JavaScriptMetaData.JavaScr
|
|
53
46
|
}
|
54
47
|
|
55
48
|
signaturesForInstanceMethod(name: string, receiverClassName: string): string[][]|null {
|
56
|
-
const instanceMethod = this.
|
49
|
+
const instanceMethod = this.receiverMethods.get(receiverClassName);
|
57
50
|
if (!instanceMethod) {
|
58
51
|
return null;
|
59
52
|
}
|
@@ -61,7 +54,7 @@ export class JavaScriptMetadataImpl implements Common.JavaScriptMetaData.JavaScr
|
|
61
54
|
}
|
62
55
|
|
63
56
|
signaturesForStaticMethod(name: string, receiverConstructorName: string): string[][]|null {
|
64
|
-
const staticMethod = this.
|
57
|
+
const staticMethod = this.receiverMethods.get(receiverConstructorName + 'Constructor');
|
65
58
|
if (!staticMethod) {
|
66
59
|
return null;
|
67
60
|
}
|