chrome-devtools-frontend 1.0.962581 → 1.0.964938

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.
Files changed (61) hide show
  1. package/AUTHORS +1 -0
  2. package/config/gni/devtools_grd_files.gni +6 -0
  3. package/docs/resource_management.md +119 -0
  4. package/docs/workflows.md +7 -0
  5. package/front_end/core/common/ParsedURL.ts +12 -10
  6. package/front_end/core/host/UserMetrics.ts +2 -1
  7. package/front_end/core/i18n/locales/en-US.json +23 -2
  8. package/front_end/core/i18n/locales/en-XL.json +23 -2
  9. package/front_end/core/root/Runtime.ts +2 -0
  10. package/front_end/core/sdk/DOMModel.ts +2 -2
  11. package/front_end/core/sdk/DebuggerModel.ts +1 -1
  12. package/front_end/entrypoints/main/MainImpl.ts +7 -2
  13. package/front_end/generated/InspectorBackendCommands.js +8 -4
  14. package/front_end/generated/protocol-mapping.d.ts +12 -1
  15. package/front_end/generated/protocol-proxy-api.d.ts +11 -1
  16. package/front_end/generated/protocol.ts +27 -12
  17. package/front_end/models/javascript_metadata/NativeFunctions.js +7480 -4147
  18. package/front_end/models/persistence/IsolatedFileSystem.ts +3 -2
  19. package/front_end/models/persistence/PersistenceActions.ts +2 -2
  20. package/front_end/models/workspace/UISourceCode.ts +4 -5
  21. package/front_end/panels/animation/AnimationUI.ts +2 -1
  22. package/front_end/panels/application/AppManifestView.ts +7 -1
  23. package/front_end/panels/application/ApplicationPanelSidebar.ts +41 -1
  24. package/front_end/panels/application/InterestGroupStorageModel.ts +87 -0
  25. package/front_end/panels/application/InterestGroupStorageView.ts +112 -0
  26. package/front_end/panels/application/InterestGroupTreeElement.ts +61 -0
  27. package/front_end/panels/application/application.ts +4 -0
  28. package/front_end/panels/application/components/BackForwardCacheStrings.ts +1 -1
  29. package/front_end/panels/application/components/FrameDetailsView.ts +1 -0
  30. package/front_end/panels/application/components/InterestGroupAccessGrid.ts +149 -0
  31. package/front_end/panels/application/components/components.ts +2 -0
  32. package/front_end/panels/application/components/interestGroupAccessGrid.css +26 -0
  33. package/front_end/panels/application/interestGroupStorageView.css +13 -0
  34. package/front_end/panels/elements/StylePropertyTreeElement.ts +13 -0
  35. package/front_end/panels/elements/StylesSidebarPane.ts +73 -4
  36. package/front_end/panels/elements/stylesSectionTree.css +28 -0
  37. package/front_end/panels/media/PlayerListView.ts +2 -0
  38. package/front_end/panels/media/playerListView.css +3 -0
  39. package/front_end/panels/sensors/sensors-meta.ts +2 -2
  40. package/front_end/panels/sources/NavigatorView.ts +1 -1
  41. package/front_end/panels/sources/UISourceCodeFrame.ts +7 -0
  42. package/front_end/ui/components/diff_view/DiffView.ts +2 -2
  43. package/front_end/ui/components/docs/icon_button/basic.ts +1 -1
  44. package/front_end/ui/components/icon_button/IconButton.ts +1 -1
  45. package/front_end/ui/legacy/GlassPane.ts +2 -0
  46. package/front_end/ui/legacy/components/inline_editor/cssLength.css +1 -0
  47. package/front_end/ui/legacy/softDropDownButton.css +2 -0
  48. package/front_end/ui/legacy/themeColors.css +3 -1
  49. package/front_end/ui/legacy/toolbar.css +6 -0
  50. package/package.json +1 -1
  51. package/scripts/build/devtools_plugin.js +103 -0
  52. package/scripts/build/ninja/{rollup.gni → bundle.gni} +2 -2
  53. package/scripts/build/ninja/devtools_entrypoint.gni +8 -8
  54. package/scripts/build/rollup.config.js +3 -93
  55. package/scripts/devtools_paths.js +3 -2
  56. package/scripts/javascript_natives/helpers.js +211 -0
  57. package/scripts/javascript_natives/index.js +57 -194
  58. package/scripts/javascript_natives/package.json +8 -3
  59. package/scripts/javascript_natives/test.d.ts +9 -0
  60. package/scripts/javascript_natives/tests.js +195 -0
  61. package/scripts/whitespaces.txt +1 -0
@@ -0,0 +1,195 @@
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 * as assert from 'assert';
6
+ import ts from 'typescript';
7
+ import * as WebIDL2 from 'webidl2';
8
+
9
+ import {clearState, parseTSFunction, postProcess, walkRoot} from './helpers.js';
10
+
11
+ describe('NativeFunction signature generation', function() {
12
+ this.afterEach(() => {
13
+ clearState();
14
+ });
15
+
16
+ it('should produce correct signatures for IDL interface', function() {
17
+ WebIDL2
18
+ .parse(`
19
+ [
20
+ Exposed=Window
21
+ ] interface Document : Node {
22
+ [CallWith=Document] constructor();
23
+ [Affects=Nothing] HTMLCollection getElementsByTagName(DOMString localName);
24
+ [Affects=Nothing] HTMLCollection getElementsByTagNameNS(DOMString? namespaceURI, DOMString localName);
25
+ [Affects=Nothing] HTMLCollection getElementsByClassName(DOMString classNames);
26
+
27
+ [NewObject, DoNotTestNewObject, PerWorldBindings, RaisesException, ImplementedAs=CreateElementForBinding] Element createElement(DOMString localName);
28
+ [NewObject, DoNotTestNewObject, RaisesException] Element createElementNS(DOMString? namespaceURI, DOMString qualifiedName);
29
+ [NewObject] DocumentFragment createDocumentFragment();
30
+ [NewObject] Text createTextNode(DOMString data);
31
+ };
32
+ `).forEach(walkRoot);
33
+ const output = postProcess(/* dryRun: */ true);
34
+ const expected = `export const NativeFunctions = [
35
+ {
36
+ name: "getElementsByTagName",
37
+ signatures: [["localName"]]
38
+ },
39
+ {
40
+ name: "getElementsByTagNameNS",
41
+ signatures: [["namespaceURI","localName"]]
42
+ },
43
+ {
44
+ name: "getElementsByClassName",
45
+ signatures: [["classNames"]]
46
+ },
47
+ {
48
+ name: "createElement",
49
+ signatures: [["localName"]]
50
+ },
51
+ {
52
+ name: "createElementNS",
53
+ signatures: [["namespaceURI","qualifiedName"]]
54
+ },
55
+ {
56
+ name: "createTextNode",
57
+ signatures: [["data"]]
58
+ }
59
+ ];`;
60
+ assert.equal(output, expected);
61
+ });
62
+
63
+ it('should produce correct signatures for IDL mixin interface', function() {
64
+ WebIDL2
65
+ .parse(`[
66
+ LegacyTreatAsPartialInterface,
67
+ Exposed=(Window,Worker)
68
+ ] interface mixin WindowOrWorkerGlobalScope {
69
+ [CallWith=ScriptState] void reportError(any e);
70
+
71
+ [RaisesException] DOMString atob(DOMString atob);
72
+ [CallWith=ScriptState, RuntimeCallStatsCounter=WindowSetTimeout] long setTimeout(Function handler, optional long timeout = 0, any... arguments);
73
+ [CallWith=ScriptState] long setTimeout(ScriptString handler, optional long timeout = 0, any... arguments);
74
+ };
75
+ `).forEach(walkRoot);
76
+ const output = postProcess(/* dryRun: */ true);
77
+ const expected = `export const NativeFunctions = [
78
+ {
79
+ name: "reportError",
80
+ signatures: [["e"]]
81
+ },
82
+ {
83
+ name: "atob",
84
+ signatures: [["atob"]]
85
+ },
86
+ {
87
+ name: "setTimeout",
88
+ signatures: [["handler","?timeout","...arguments"]]
89
+ }
90
+ ];`;
91
+ assert.equal(output, expected);
92
+ });
93
+
94
+ it('should produce correct signatures for Console IDL', function() {
95
+ WebIDL2
96
+ .parse(`
97
+ [Exposed=(Window,Worker,Worklet)]
98
+ namespace console {
99
+ undefined assert(optional boolean condition = false, any... data);
100
+ undefined table(optional any tabularData, optional sequence<DOMString> properties);
101
+ undefined count(optional DOMString label = "default");
102
+ undefined groupEnd();
103
+ };
104
+ `).forEach(walkRoot);
105
+ const output = postProcess(/* dryRun: */ true);
106
+ const expected = `export const NativeFunctions = [
107
+ {
108
+ name: "assert",
109
+ signatures: [["?condition","...data"]]
110
+ },
111
+ {
112
+ name: "table",
113
+ signatures: [["?tabularData","?properties"]]
114
+ },
115
+ {
116
+ name: "count",
117
+ signatures: [["?label"]]
118
+ }
119
+ ];`;
120
+ assert.equal(output, expected);
121
+ });
122
+
123
+ it('should produce correct signatures for Console IDL', function() {
124
+ WebIDL2
125
+ .parse(`
126
+ // https://html.spec.whatwg.org/C/#the-slot-element
127
+ [
128
+ Exposed=Window,
129
+ HTMLConstructor
130
+ ] interface HTMLSlotElement : HTMLElement {
131
+ [CEReactions, Reflect] attribute DOMString name;
132
+ [ImplementedAs=AssignedNodesForBinding] sequence<Node> assignedNodes(optional AssignedNodesOptions options = {});
133
+ [ImplementedAs=AssignedElementsForBinding] sequence<Element> assignedElements(optional AssignedNodesOptions options = {});
134
+ [RaisesException] void assign((Element or Text)... nodes);
135
+ };
136
+ `).forEach(walkRoot);
137
+ const output = postProcess(/* dryRun: */ true);
138
+ const expected = `export const NativeFunctions = [
139
+ {
140
+ name: "assignedNodes",
141
+ signatures: [["?options"]]
142
+ },
143
+ {
144
+ name: "assignedElements",
145
+ signatures: [["?options"]]
146
+ },
147
+ {
148
+ name: "assign",
149
+ signatures: [["...nodes"]]
150
+ }
151
+ ];`;
152
+ assert.equal(output, expected);
153
+ });
154
+
155
+ it('should produce correct signatures for typescript typings', function() {
156
+ const program = ts.createProgram(
157
+ [
158
+ new URL('test.d.ts', import.meta.url).pathname,
159
+ ],
160
+ {noLib: true, types: []});
161
+
162
+ for (const file of program.getSourceFiles()) {
163
+ ts.forEachChild(file, node => {
164
+ if (node.kind === ts.SyntaxKind.InterfaceDeclaration) {
165
+ for (const member of node.members) {
166
+ if (member.kind === ts.SyntaxKind.MethodSignature) {
167
+ parseTSFunction(member, node);
168
+ }
169
+ }
170
+ }
171
+ if (node.kind === ts.SyntaxKind.FunctionDeclaration) {
172
+ parseTSFunction(node, {name: {text: 'Window'}});
173
+ }
174
+ });
175
+ }
176
+ const output = postProcess(/* dryRun: */ true);
177
+ const expected = `export const NativeFunctions = [
178
+ {
179
+ name: "at",
180
+ signatures: [["index"]]
181
+ },
182
+ {
183
+ name: "diffSig",
184
+ signatures: [["oneSig"]],
185
+ receiver: "Array"
186
+ },
187
+ {
188
+ name: "diffSig",
189
+ signatures: [["twoSig"]],
190
+ receiver: "ReadonlyArray"
191
+ }
192
+ ];`;
193
+ assert.equal(output, expected);
194
+ });
195
+ });
@@ -8,3 +8,4 @@ Surma was here.
8
8
  .
9
9
  .
10
10
  Today's answer to life the universe and everything is 161!
11
+ No good text, but numbers ... 2!