chrome-devtools-frontend 1.0.1015723 → 1.0.1015822
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.
@@ -34,6 +34,7 @@
|
|
34
34
|
|
35
35
|
import type * as ProtocolProxyApi from '../../generated/protocol-proxy-api.js';
|
36
36
|
import * as Protocol from '../../generated/protocol.js';
|
37
|
+
import type {DOMPinnedWebIDLProp, DOMPinnedWebIDLType} from '../common/JavaScriptMetaData.js';
|
37
38
|
|
38
39
|
import type {DebuggerModel, FunctionDetails} from './DebuggerModel.js';
|
39
40
|
import type {RuntimeModel} from './RuntimeModel.js';
|
@@ -309,6 +310,8 @@ export class RemoteObject {
|
|
309
310
|
isNode(): boolean {
|
310
311
|
return false;
|
311
312
|
}
|
313
|
+
|
314
|
+
webIdl?: RemoteObjectWebIdlTypeMetadata;
|
312
315
|
}
|
313
316
|
|
314
317
|
export class RemoteObjectImpl extends RemoteObject {
|
@@ -728,6 +731,8 @@ export class RemoteObjectProperty {
|
|
728
731
|
getter: RemoteObject|undefined;
|
729
732
|
setter: RemoteObject|undefined;
|
730
733
|
|
734
|
+
webIdl?: RemoteObjectWebIdlPropertyMetadata;
|
735
|
+
|
731
736
|
constructor(
|
732
737
|
name: string, value: RemoteObject|null, enumerable?: boolean, writable?: boolean, isOwn?: boolean,
|
733
738
|
wasThrown?: boolean, symbol?: RemoteObject|null, synthetic?: boolean,
|
@@ -1188,3 +1193,13 @@ export interface GetPropertiesResult {
|
|
1188
1193
|
properties: RemoteObjectProperty[]|null;
|
1189
1194
|
internalProperties: RemoteObjectProperty[]|null;
|
1190
1195
|
}
|
1196
|
+
|
1197
|
+
export interface RemoteObjectWebIdlTypeMetadata {
|
1198
|
+
info: DOMPinnedWebIDLType;
|
1199
|
+
state: Map<string, string>;
|
1200
|
+
}
|
1201
|
+
|
1202
|
+
export interface RemoteObjectWebIdlPropertyMetadata {
|
1203
|
+
info: DOMPinnedWebIDLProp;
|
1204
|
+
applicable?: boolean;
|
1205
|
+
}
|
@@ -36,6 +36,7 @@ import * as LinearMemoryInspector from '../../../components/linear_memory_inspec
|
|
36
36
|
import * as Platform from '../../../../core/platform/platform.js';
|
37
37
|
import * as SDK from '../../../../core/sdk/sdk.js';
|
38
38
|
import * as TextUtils from '../../../../models/text_utils/text_utils.js';
|
39
|
+
import * as JavaScriptMetaData from '../../../../models/javascript_metadata/javascript_metadata.js';
|
39
40
|
import * as IconButton from '../../../components/icon_button/icon_button.js';
|
40
41
|
import * as TextEditor from '../../../components/text_editor/text_editor.js';
|
41
42
|
import * as UI from '../../legacy.js';
|
@@ -126,8 +127,9 @@ const EXPANDABLE_MAX_LENGTH = 50;
|
|
126
127
|
const EXPANDABLE_MAX_DEPTH = 100;
|
127
128
|
|
128
129
|
const parentMap = new WeakMap<SDK.RemoteObject.RemoteObjectProperty, SDK.RemoteObject.RemoteObject|null>();
|
129
|
-
|
130
130
|
const objectPropertiesSectionMap = new WeakMap<Element, ObjectPropertiesSection>();
|
131
|
+
const domPinnedProperties =
|
132
|
+
JavaScriptMetaData.JavaScriptMetadata.JavaScriptMetadataImpl.domPinnedProperties.DOMPinnedProperties;
|
131
133
|
|
132
134
|
export const getObjectPropertiesSectionFrom = (element: Element): ObjectPropertiesSection|undefined => {
|
133
135
|
return objectPropertiesSectionMap.get(element);
|
@@ -203,6 +205,37 @@ export class ObjectPropertiesSection extends UI.TreeOutline.TreeOutlineInShadow
|
|
203
205
|
return objectPropertiesSection;
|
204
206
|
}
|
205
207
|
|
208
|
+
static assignWebIDLMetadata(
|
209
|
+
value: SDK.RemoteObject.RemoteObject|null, properties: SDK.RemoteObject.RemoteObjectProperty[]): void {
|
210
|
+
if (!value) {
|
211
|
+
return;
|
212
|
+
}
|
213
|
+
|
214
|
+
const isInstance = value.type === 'object' && value.className !== null;
|
215
|
+
const webIdlType = isInstance ? domPinnedProperties[value.className] : undefined;
|
216
|
+
if (webIdlType) {
|
217
|
+
value.webIdl = {info: webIdlType, state: new Map()};
|
218
|
+
} else {
|
219
|
+
return;
|
220
|
+
}
|
221
|
+
|
222
|
+
for (const property of properties) {
|
223
|
+
const webIdlProperty = webIdlType?.props?.[property.name];
|
224
|
+
if (webIdlProperty) {
|
225
|
+
property.webIdl = {info: webIdlProperty};
|
226
|
+
}
|
227
|
+
}
|
228
|
+
}
|
229
|
+
|
230
|
+
static getPropertyValuesByNames(properties: SDK.RemoteObject.RemoteObjectProperty[]):
|
231
|
+
Map<string, SDK.RemoteObject.RemoteObject|undefined> {
|
232
|
+
const map = new Map();
|
233
|
+
for (const property of properties) {
|
234
|
+
map.set(property.name, property.value);
|
235
|
+
}
|
236
|
+
return map;
|
237
|
+
}
|
238
|
+
|
206
239
|
static compareProperties(
|
207
240
|
propertyA: SDK.RemoteObject.RemoteObjectProperty, propertyB: SDK.RemoteObject.RemoteObjectProperty): number {
|
208
241
|
if (!propertyA.synthetic && propertyB.synthetic) {
|
@@ -744,6 +777,33 @@ export class ObjectPropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
744
777
|
internalProperties: SDK.RemoteObject.RemoteObjectProperty[]|null, skipProto: boolean,
|
745
778
|
skipGettersAndSetters: boolean, value: SDK.RemoteObject.RemoteObject|null,
|
746
779
|
linkifier?: Components.Linkifier.Linkifier, emptyPlaceholder?: string|null): void {
|
780
|
+
ObjectPropertiesSection.assignWebIDLMetadata(value, properties);
|
781
|
+
const names = ObjectPropertiesSection.getPropertyValuesByNames(properties);
|
782
|
+
|
783
|
+
if (value?.webIdl) {
|
784
|
+
const parentRules = value.webIdl.info.rules;
|
785
|
+
if (parentRules) {
|
786
|
+
for (const {when: name, is: expected} of parentRules) {
|
787
|
+
if (names.get(name)?.value === expected) {
|
788
|
+
value.webIdl.state.set(name, expected);
|
789
|
+
}
|
790
|
+
}
|
791
|
+
}
|
792
|
+
|
793
|
+
for (const property of properties) {
|
794
|
+
if (property.webIdl) {
|
795
|
+
const parentState = value.webIdl.state;
|
796
|
+
const propertyRules = property.webIdl.info.rules;
|
797
|
+
if (!parentRules && !propertyRules) {
|
798
|
+
property.webIdl.applicable = true;
|
799
|
+
} else {
|
800
|
+
property.webIdl.applicable =
|
801
|
+
!propertyRules || propertyRules?.some(rule => parentState.get(rule.when) === rule.is);
|
802
|
+
}
|
803
|
+
}
|
804
|
+
}
|
805
|
+
}
|
806
|
+
|
747
807
|
properties.sort(ObjectPropertiesSection.compareProperties);
|
748
808
|
internalProperties = internalProperties || [];
|
749
809
|
|
@@ -1053,15 +1113,36 @@ export class ObjectPropertyTreeElement extends UI.TreeOutline.TreeElement {
|
|
1053
1113
|
this.expandedValueElement = this.createExpandedValueElement(this.property.value);
|
1054
1114
|
}
|
1055
1115
|
|
1056
|
-
|
1116
|
+
let adorner: Element|string = '';
|
1057
1117
|
let container: Element;
|
1118
|
+
|
1119
|
+
if (this.property.webIdl?.applicable) {
|
1120
|
+
const icon = new IconButton.Icon.Icon();
|
1121
|
+
icon.data = {
|
1122
|
+
iconName: 'elements_panel_icon',
|
1123
|
+
color: 'var(--color-text-secondary)',
|
1124
|
+
width: '16px',
|
1125
|
+
height: '16px',
|
1126
|
+
};
|
1127
|
+
adorner = UI.Fragment.html`
|
1128
|
+
<span class='adorner'>${icon}</span>
|
1129
|
+
`;
|
1130
|
+
}
|
1131
|
+
|
1058
1132
|
if (isInternalEntries) {
|
1059
|
-
container = UI.Fragment.html
|
1133
|
+
container = UI.Fragment.html`
|
1134
|
+
<span class='name-and-value'>${adorner}${this.nameElement}</span>
|
1135
|
+
`;
|
1060
1136
|
} else {
|
1061
|
-
container = UI.Fragment.html
|
1137
|
+
container = UI.Fragment.html`
|
1138
|
+
<span class='name-and-value'>${adorner}${this.nameElement}: ${this.valueElement}</span>
|
1139
|
+
`;
|
1062
1140
|
}
|
1141
|
+
|
1142
|
+
this.listItemElement.removeChildren();
|
1063
1143
|
this.rowContainer = (container as HTMLElement);
|
1064
1144
|
this.listItemElement.appendChild(this.rowContainer);
|
1145
|
+
this.listItemElement.dataset.webidl = this.property.webIdl?.applicable ? 'true' : 'false';
|
1065
1146
|
}
|
1066
1147
|
|
1067
1148
|
private updatePropertyPath(): void {
|
@@ -59,9 +59,22 @@
|
|
59
59
|
overflow: hidden;
|
60
60
|
}
|
61
61
|
|
62
|
+
.object-properties-section [data-webidl="true"] > .name-and-value > .adorner {
|
63
|
+
flex-shrink: 0;
|
64
|
+
width: 16px;
|
65
|
+
height: 16px;
|
66
|
+
margin-right: 2px;
|
67
|
+
}
|
68
|
+
|
69
|
+
.object-properties-section [data-webidl="true"] > .name-and-value > .name {
|
70
|
+
font-weight: bold;
|
71
|
+
}
|
72
|
+
|
62
73
|
.name-and-value {
|
63
74
|
overflow: hidden;
|
64
75
|
line-height: 16px;
|
76
|
+
display: flex;
|
77
|
+
white-space: break-spaces;
|
65
78
|
}
|
66
79
|
|
67
80
|
.editing-sub-part .name-and-value {
|
package/package.json
CHANGED