chrome-devtools-frontend 1.0.1014346 → 1.0.1014853
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/.eslintignore +1 -0
- package/front_end/core/sdk/SourceMap.ts +88 -27
- package/front_end/models/javascript_metadata/DOMPinnedProperties.ts +3322 -833
- package/front_end/models/source_map_scopes/NamesResolver.ts +88 -19
- package/package.json +1 -1
- package/scripts/webidl-properties/config.js +305 -239
- package/scripts/webidl-properties/get-props.js +23 -12
- package/scripts/webidl-properties/index.js +14 -9
- package/scripts/webidl-properties/tests.js +58 -14
@@ -21,8 +21,8 @@ const names = Object.keys(SPECS);
|
|
21
21
|
const specs = await Promise.all(names.map(name => files[name].parse().then(idls => ({name, idls}))));
|
22
22
|
|
23
23
|
const output = addMetadata(getIDLProps(specs));
|
24
|
-
const missing = getMissingTypes(output);
|
25
24
|
|
25
|
+
const missing = getMissingTypes(output);
|
26
26
|
for (const type of missing) {
|
27
27
|
console.warn('Found missing type:', type);
|
28
28
|
}
|
@@ -32,6 +32,8 @@ const jsMetadataPath = path.join(frontendPath, 'front_end/models/javascript_meta
|
|
32
32
|
const outPath = path.join(jsMetadataPath, 'DOMPinnedProperties.ts');
|
33
33
|
const thisPath = path.relative(frontendPath, url.fileURLToPath(import.meta.url));
|
34
34
|
|
35
|
+
const stringify = object => JSON.stringify(object, null, 2);
|
36
|
+
|
35
37
|
fs.writeFileSync(outPath, `
|
36
38
|
// Copyright 2022 The Chromium Authors. All rights reserved.
|
37
39
|
// Use of this source code is governed by a BSD-style license that can be
|
@@ -41,7 +43,7 @@ fs.writeFileSync(outPath, `
|
|
41
43
|
/**
|
42
44
|
* All the specs used when generating the DOM pinned properties dataset.
|
43
45
|
*/
|
44
|
-
export const SPECS = ${
|
46
|
+
export const SPECS = ${stringify(SPECS)};
|
45
47
|
|
46
48
|
export interface DOMPinnedWebIDLProp {
|
47
49
|
// A flag specifying whether it's a "global" attribute.
|
@@ -49,6 +51,8 @@ export interface DOMPinnedWebIDLProp {
|
|
49
51
|
// A bitfield of the specs in which the property is found.
|
50
52
|
// If missing, it implies the default spec: "html".
|
51
53
|
specs?: number;
|
54
|
+
// The "states" in which this property is "applicable".
|
55
|
+
rules?: Array<DOMPinnedWebIDLRule>;
|
52
56
|
}
|
53
57
|
|
54
58
|
export interface DOMPinnedWebIDLType {
|
@@ -62,12 +66,12 @@ export interface DOMPinnedWebIDLType {
|
|
62
66
|
[PropName: string]: DOMPinnedWebIDLProp,
|
63
67
|
};
|
64
68
|
// The "states" in which only certain properties are "applicable".
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
69
|
+
rules?: Array<DOMPinnedWebIDLRule>;
|
70
|
+
}
|
71
|
+
|
72
|
+
export interface DOMPinnedWebIDLRule {
|
73
|
+
when: string;
|
74
|
+
is: string;
|
71
75
|
}
|
72
76
|
|
73
77
|
export interface DOMPinnedPropertiesDataset {
|
@@ -81,5 +85,6 @@ export interface DOMPinnedPropertiesDataset {
|
|
81
85
|
* This is an object with WebIDL type names as keys and their WebIDL properties
|
82
86
|
* and inheritance/include chains as values.
|
83
87
|
*/
|
84
|
-
export const DOMPinnedProperties: DOMPinnedPropertiesDataset = ${
|
88
|
+
export const DOMPinnedProperties: DOMPinnedPropertiesDataset = ${stringify(minimize(output))};
|
89
|
+
|
85
90
|
`);
|
@@ -39,7 +39,7 @@ describe('DOM pinned properties dataset generation', function() {
|
|
39
39
|
global: true,
|
40
40
|
specs: ['html'],
|
41
41
|
});
|
42
|
-
assert.strictEqual(type.
|
42
|
+
assert.strictEqual(type.rules, undefined);
|
43
43
|
});
|
44
44
|
|
45
45
|
it('generates valid data for HTMLInputElement', () => {
|
@@ -49,12 +49,34 @@ describe('DOM pinned properties dataset generation', function() {
|
|
49
49
|
assert.deepEqual(type.props.checked, {
|
50
50
|
global: false,
|
51
51
|
specs: ['html'],
|
52
|
+
rules: [{when: 'type', is: 'checkbox'}, {when: 'type', is: 'radio'}],
|
52
53
|
});
|
53
|
-
assert.deepEqual(type.
|
54
|
-
|
55
|
-
|
56
|
-
|
54
|
+
assert.deepEqual(type.props.required, {
|
55
|
+
global: false,
|
56
|
+
specs: ['html'],
|
57
|
+
rules: [
|
58
|
+
{when: 'type', is: 'text'}, {when: 'type', is: 'search'}, {when: 'type', is: 'url'}, {when: 'type', is: 'tel'},
|
59
|
+
{when: 'type', is: 'email'}, {when: 'type', is: 'password'}, {when: 'type', is: 'date'},
|
60
|
+
{when: 'type', is: 'month'}, {when: 'type', is: 'week'}, {when: 'type', is: 'time'},
|
61
|
+
{when: 'type', is: 'datetime-local'}, {when: 'type', is: 'number'}, {when: 'type', is: 'checkbox'},
|
62
|
+
{when: 'type', is: 'radio'}, {when: 'type', is: 'file'}
|
63
|
+
]
|
64
|
+
});
|
65
|
+
assert.deepEqual(type.props.value, {
|
66
|
+
global: false,
|
67
|
+
specs: ['html'],
|
68
|
+
rules: type.rules,
|
57
69
|
});
|
70
|
+
assert.deepEqual(type.rules, [
|
71
|
+
{when: 'type', is: 'hidden'}, {when: 'type', is: 'text'}, {when: 'type', is: 'search'},
|
72
|
+
{when: 'type', is: 'url'}, {when: 'type', is: 'tel'}, {when: 'type', is: 'email'},
|
73
|
+
{when: 'type', is: 'password'}, {when: 'type', is: 'date'}, {when: 'type', is: 'month'},
|
74
|
+
{when: 'type', is: 'week'}, {when: 'type', is: 'time'}, {when: 'type', is: 'datetime-local'},
|
75
|
+
{when: 'type', is: 'number'}, {when: 'type', is: 'range'}, {when: 'type', is: 'color'},
|
76
|
+
{when: 'type', is: 'checkbox'}, {when: 'type', is: 'radio'}, {when: 'type', is: 'file'},
|
77
|
+
{when: 'type', is: 'submit'}, {when: 'type', is: 'image'}, {when: 'type', is: 'reset'},
|
78
|
+
{when: 'type', is: 'button'},
|
79
|
+
]);
|
58
80
|
});
|
59
81
|
|
60
82
|
it('generates valid data for MouseEvent', () => {
|
@@ -65,7 +87,7 @@ describe('DOM pinned properties dataset generation', function() {
|
|
65
87
|
global: false,
|
66
88
|
specs: ['uievents'],
|
67
89
|
});
|
68
|
-
assert.strictEqual(type.
|
90
|
+
assert.strictEqual(type.rules, undefined);
|
69
91
|
});
|
70
92
|
|
71
93
|
it('generates valid data for PointerEvent', () => {
|
@@ -76,7 +98,7 @@ describe('DOM pinned properties dataset generation', function() {
|
|
76
98
|
global: false,
|
77
99
|
specs: ['pointerevents'],
|
78
100
|
});
|
79
|
-
assert.strictEqual(type.
|
101
|
+
assert.strictEqual(type.rules, undefined);
|
80
102
|
});
|
81
103
|
|
82
104
|
it('generates an entry for DOMParser', () => {
|
@@ -84,7 +106,7 @@ describe('DOM pinned properties dataset generation', function() {
|
|
84
106
|
assert.strictEqual(type.inheritance, null);
|
85
107
|
assert.deepEqual(type.includes, []);
|
86
108
|
assert.deepEqual(type.props, {});
|
87
|
-
assert.strictEqual(type.
|
109
|
+
assert.strictEqual(type.rules, undefined);
|
88
110
|
});
|
89
111
|
|
90
112
|
it('minimizes the data for HTMLInputElement', () => {
|
@@ -92,12 +114,34 @@ describe('DOM pinned properties dataset generation', function() {
|
|
92
114
|
const type = minimized.HTMLInputElement;
|
93
115
|
assert.strictEqual(type.inheritance, 'HTMLElement');
|
94
116
|
assert.strictEqual(type.includes, undefined);
|
95
|
-
assert.deepEqual(type.props.checked, {
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
117
|
+
assert.deepEqual(type.props.checked, {
|
118
|
+
rules: [
|
119
|
+
{when: 'type', is: 'checkbox'},
|
120
|
+
{when: 'type', is: 'radio'},
|
121
|
+
],
|
122
|
+
});
|
123
|
+
assert.deepEqual(type.props.required, {
|
124
|
+
rules: [
|
125
|
+
{when: 'type', is: 'text'}, {when: 'type', is: 'search'}, {when: 'type', is: 'url'}, {when: 'type', is: 'tel'},
|
126
|
+
{when: 'type', is: 'email'}, {when: 'type', is: 'password'}, {when: 'type', is: 'date'},
|
127
|
+
{when: 'type', is: 'month'}, {when: 'type', is: 'week'}, {when: 'type', is: 'time'},
|
128
|
+
{when: 'type', is: 'datetime-local'}, {when: 'type', is: 'number'}, {when: 'type', is: 'checkbox'},
|
129
|
+
{when: 'type', is: 'radio'}, {when: 'type', is: 'file'}
|
130
|
+
],
|
100
131
|
});
|
132
|
+
assert.deepEqual(type.props.value, {
|
133
|
+
rules: type.rules,
|
134
|
+
});
|
135
|
+
assert.deepEqual(type.rules, [
|
136
|
+
{when: 'type', is: 'hidden'}, {when: 'type', is: 'text'}, {when: 'type', is: 'search'},
|
137
|
+
{when: 'type', is: 'url'}, {when: 'type', is: 'tel'}, {when: 'type', is: 'email'},
|
138
|
+
{when: 'type', is: 'password'}, {when: 'type', is: 'date'}, {when: 'type', is: 'month'},
|
139
|
+
{when: 'type', is: 'week'}, {when: 'type', is: 'time'}, {when: 'type', is: 'datetime-local'},
|
140
|
+
{when: 'type', is: 'number'}, {when: 'type', is: 'range'}, {when: 'type', is: 'color'},
|
141
|
+
{when: 'type', is: 'checkbox'}, {when: 'type', is: 'radio'}, {when: 'type', is: 'file'},
|
142
|
+
{when: 'type', is: 'submit'}, {when: 'type', is: 'image'}, {when: 'type', is: 'reset'},
|
143
|
+
{when: 'type', is: 'button'},
|
144
|
+
]);
|
101
145
|
});
|
102
146
|
|
103
147
|
it('minimizes the data for PointerEvent', () => {
|
@@ -108,7 +152,7 @@ describe('DOM pinned properties dataset generation', function() {
|
|
108
152
|
assert.deepEqual(type.props.pressure, {
|
109
153
|
specs: 8,
|
110
154
|
});
|
111
|
-
assert.strictEqual(type.
|
155
|
+
assert.strictEqual(type.rules, undefined);
|
112
156
|
});
|
113
157
|
|
114
158
|
it('removes the entry for DOMParser in the minimized output', () => {
|