chrome-devtools-frontend 1.0.1534251 → 1.0.1535712

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 (44) hide show
  1. package/docs/contributing/infrastructure.md +32 -0
  2. package/docs/contributing/issues.md +15 -37
  3. package/eslint.config.mjs +1 -0
  4. package/front_end/core/host/InspectorFrontendHost.ts +2 -0
  5. package/front_end/core/host/InspectorFrontendHostAPI.ts +1 -0
  6. package/front_end/core/host/UserMetrics.ts +29 -1
  7. package/front_end/core/protocol_client/CDPConnection.ts +53 -5
  8. package/front_end/core/protocol_client/InspectorBackend.ts +0 -89
  9. package/front_end/core/protocol_client/protocol_client.ts +2 -0
  10. package/front_end/core/root/Runtime.ts +1 -0
  11. package/front_end/core/sdk/RehydratingConnection.ts +1 -1
  12. package/front_end/devtools_compatibility.js +230 -32
  13. package/front_end/generated/SupportedCSSProperties.js +38 -0
  14. package/front_end/models/ai_assistance/BuiltInAi.ts +141 -39
  15. package/front_end/panels/ai_assistance/PatchWidget.ts +39 -40
  16. package/front_end/panels/ai_assistance/components/ExploreWidget.ts +0 -2
  17. package/front_end/panels/autofill/AutofillView.ts +2 -3
  18. package/front_end/panels/changes/CombinedDiffView.ts +13 -14
  19. package/front_end/panels/common/BadgeNotification.ts +1 -3
  20. package/front_end/panels/console/ConsoleInsightTeaser.ts +8 -1
  21. package/front_end/panels/console/ConsoleView.ts +1 -0
  22. package/front_end/panels/console/consoleView.css +0 -1
  23. package/front_end/panels/elements/ElementsTreeOutline.ts +1 -1
  24. package/front_end/panels/network/components/DirectSocketConnectionView.ts +4 -6
  25. package/front_end/panels/network/components/ResponseHeaderSection.ts +1 -2
  26. package/front_end/panels/security/CookieControlsView.ts +72 -66
  27. package/front_end/panels/security/CookieReportView.ts +15 -14
  28. package/front_end/panels/security/IPProtectionView.ts +1 -2
  29. package/front_end/panels/security/SecurityPanel.ts +19 -19
  30. package/front_end/panels/timeline/TimelineSelectorStatsView.ts +36 -36
  31. package/front_end/panels/timeline/components/SidebarAnnotationsTab.ts +1 -2
  32. package/front_end/third_party/chromium/README.chromium +1 -1
  33. package/front_end/ui/components/dialogs/Dialog.ts +7 -17
  34. package/front_end/ui/components/text_editor/TextEditor.ts +2 -3
  35. package/front_end/ui/components/text_editor/config.ts +1 -3
  36. package/front_end/ui/legacy/UIUtils.ts +5 -0
  37. package/front_end/ui/legacy/components/inline_editor/CSSAngle.ts +1 -1
  38. package/front_end/ui/legacy/components/perf_ui/BrickBreaker.ts +2 -2
  39. package/front_end/ui/legacy/components/perf_ui/Font.ts +1 -14
  40. package/front_end/ui/visual_logging/KnownContextValues.ts +2 -0
  41. package/inspector_overlay/testing/InspectorOverlayHelpers.ts +2 -10
  42. package/package.json +1 -1
  43. package/front_end/services/window_bounds/WindowBoundsService.ts +0 -27
  44. package/front_end/services/window_bounds/window_bounds.ts +0 -9
@@ -13,6 +13,7 @@
13
13
  *
14
14
  * @returns {number|null}
15
15
  */
16
+
16
17
  function getRemoteMajorVersion() {
17
18
  try {
18
19
  const remoteVersion = new URLSearchParams(window.location.search).get('remoteVersion');
@@ -24,6 +25,8 @@
24
25
  return null;
25
26
  }
26
27
  }
28
+ // eslint-disable-next-line no-unused-vars
29
+ const majorVersion = getRemoteMajorVersion();
27
30
 
28
31
  // DevToolsAPI ----------------------------------------------------------------
29
32
  /**
@@ -55,9 +58,19 @@
55
58
  _addExtensionCallback = null;
56
59
 
57
60
  /**
58
- * @type {ReturnType<typeof Promise.withResolvers<string>>}
61
+ * @type {Promise<string>}
62
+ */
63
+ _initialTargetIdPromise;
64
+ /**
65
+ * @type {(param:string) => void}
59
66
  */
60
- _initialTargetIdPromiseWithResolver = Promise.withResolvers();
67
+ _setInitialTargetId;
68
+
69
+ constructor() {
70
+ this._initialTargetIdPromise = new Promise(resolve => {
71
+ this._setInitialTargetId = resolve;
72
+ });
73
+ }
61
74
 
62
75
  /**
63
76
  * @param id
@@ -91,7 +104,7 @@
91
104
  /**
92
105
  * @typedef {import('./core/host/InspectorFrontendHostAPI.js').Events} Events
93
106
  * @typedef {import('./core/host/InspectorFrontendHost.js').InspectorFrontendAPIImplMethods} Methods
94
- * @param method {`${Events|Methods}`}
107
+ * @param {`${Events|Methods}`} method
95
108
  * @param args
96
109
  */
97
110
  _dispatchOnInspectorFrontendAPI(method, args) {
@@ -108,7 +121,7 @@
108
121
  // API methods below this line --------------------------------------------
109
122
 
110
123
  /**
111
- * @param extensions {ExtensionDescriptor[]}
124
+ * @param {ExtensionDescriptor[]} extensions
112
125
  */
113
126
  addExtensions(extensions) {
114
127
  // The addExtensions command is sent as the onload event happens for
@@ -122,7 +135,7 @@
122
135
  }
123
136
 
124
137
  /**
125
- * @param forbiddenOrigins {string[]}
138
+ * @param {string[]} forbiddenOrigins
126
139
  */
127
140
  setOriginsForbiddenForExtensions(forbiddenOrigins) {
128
141
  this._originsForbiddenForExtensions = forbiddenOrigins;
@@ -136,14 +149,14 @@
136
149
  }
137
150
 
138
151
  /**
139
- * @param url {string}
152
+ * @param {string} url
140
153
  */
141
154
  appendedToURL(url) {
142
155
  this._dispatchOnInspectorFrontendAPI('appendedToURL', [url]);
143
156
  }
144
157
 
145
158
  /**
146
- * @param url {string}
159
+ * @param {string} url
147
160
  */
148
161
  canceledSaveURL(url) {
149
162
  this._dispatchOnInspectorFrontendAPI('canceledSaveURL', [url]);
@@ -161,7 +174,7 @@
161
174
  }
162
175
 
163
176
  /**
164
- * @param count {number}
177
+ * @param {number} count
165
178
  */
166
179
  deviceCountUpdated(count) {
167
180
  this._dispatchOnInspectorFrontendAPI('deviceCountUpdated', [count]);
@@ -281,7 +294,7 @@
281
294
  }
282
295
 
283
296
  /**
284
- * @param callback {(param: object) => unknown}
297
+ * @param {(param: object) => unknown} callback
285
298
  */
286
299
  setAddExtensionCallback(callback) {
287
300
  this._addExtensionCallback = callback;
@@ -292,7 +305,7 @@
292
305
  }
293
306
 
294
307
  /**
295
- * @param hard {boolean}
308
+ * @param {boolean} hard
296
309
  */
297
310
  reloadInspectedPage(hard) {
298
311
  this._dispatchOnInspectorFrontendAPI('reloadInspectedPage', [hard]);
@@ -329,7 +342,7 @@
329
342
  }
330
343
 
331
344
  /**
332
- * @param tabId {string}
345
+ * @param {string} tabId
333
346
  */
334
347
  setInspectedTabId(tabId) {
335
348
  this._inspectedTabIdValue = tabId;
@@ -338,10 +351,10 @@
338
351
  }
339
352
 
340
353
  /**
341
- * @param targetId {string}
354
+ * @param {string} targetId
342
355
  */
343
356
  setInitialTargetId(targetId) {
344
- this._initialTargetIdPromiseWithResolver.resolve(targetId);
357
+ this._setInitialTargetId(targetId);
345
358
  }
346
359
 
347
360
  /**
@@ -352,30 +365,30 @@
352
365
  }
353
366
 
354
367
  /**
355
- * @param useSoftMenu {boolean}
368
+ * @param {boolean} useSoftMenu
356
369
  */
357
370
  setUseSoftMenu(useSoftMenu) {
358
371
  this._dispatchOnInspectorFrontendAPI('setUseSoftMenu', [useSoftMenu]);
359
372
  }
360
373
 
361
374
  /**
362
- * @param panelName {string}
375
+ * @param {string} panelName
363
376
  */
364
377
  showPanel(panelName) {
365
378
  this._dispatchOnInspectorFrontendAPI('showPanel', [panelName]);
366
379
  }
367
380
 
368
381
  /**
369
- * @param id {number}
370
- * @param chunk {string}
371
- * @param encoded {boolean}
382
+ * @param {number} id
383
+ * @param {string} chunk
384
+ * @param {boolean} encoded
372
385
  */
373
386
  streamWrite(id, chunk, encoded) {
374
387
  this._dispatchOnInspectorFrontendAPI('streamWrite', [id, encoded ? this._decodeBase64(chunk) : chunk]);
375
388
  }
376
389
 
377
390
  /**
378
- * @param chunk {string}
391
+ * @param {string} chunk
379
392
  * @returns {string}
380
393
  */
381
394
  _decodeBase64(chunk) {
@@ -437,7 +450,8 @@
437
450
  TimelineNavigationSettingState: 'DevTools.TimelineNavigationSettingState',
438
451
  SyncSetting: 'DevTools.SyncSetting',
439
452
  SwatchActivated: 'DevTools.SwatchActivated',
440
- AnimationPlaybackRateChanged: 'DevTools.AnimationPlaybackRateChanged'
453
+ AnimationPlaybackRateChanged: 'DevTools.AnimationPlaybackRateChanged',
454
+ BuiltInAiAvailability: 'DevTools.BuiltInAiAvailability'
441
455
  // LINT.ThenChange(/front_end/core/host/InspectorFrontendHostAPI.ts:EnumeratedHistogram)
442
456
  };
443
457
 
@@ -452,6 +466,34 @@
452
466
  */
453
467
  events;
454
468
 
469
+ /**
470
+ * @returns
471
+ */
472
+ getSelectionBackgroundColor() {
473
+ return '#6e86ff';
474
+ }
475
+
476
+ /**
477
+ * @returns
478
+ */
479
+ getSelectionForegroundColor() {
480
+ return '#ffffff';
481
+ }
482
+
483
+ /**
484
+ * @returns
485
+ */
486
+ getInactiveSelectionBackgroundColor() {
487
+ return '#c9c8c8';
488
+ }
489
+
490
+ /**
491
+ * @returns
492
+ */
493
+ getInactiveSelectionForegroundColor() {
494
+ return '#323232';
495
+ }
496
+
455
497
  /**
456
498
  * @returns
457
499
  */
@@ -481,7 +523,7 @@
481
523
 
482
524
  /**
483
525
  * @param trigger
484
- * @param callback {(param: object) => unknown}
526
+ * @param {(param: object) => unknown} callback
485
527
  */
486
528
  showSurvey(trigger, callback) {
487
529
  DevToolsAPI.sendMessageToEmbedder('showSurvey', [trigger], callback);
@@ -489,7 +531,7 @@
489
531
 
490
532
  /**
491
533
  * @param trigger
492
- * @param callback {(param: object) => unknown}
534
+ * @param {(param: object) => unknown} callback
493
535
  */
494
536
  canShowSurvey(trigger, callback) {
495
537
  DevToolsAPI.sendMessageToEmbedder('canShowSurvey', [trigger], callback);
@@ -511,7 +553,7 @@
511
553
  * @param url
512
554
  * @param headers
513
555
  * @param streamId
514
- * @param callback {(param: object) => unknown}
556
+ * @param {(param: object) => unknown} callback
515
557
  */
516
558
  loadNetworkResource(url, headers, streamId, callback) {
517
559
  DevToolsAPI.sendMessageToEmbedder('loadNetworkResource', [url, headers, streamId], callback);
@@ -526,7 +568,7 @@
526
568
  }
527
569
 
528
570
  /**
529
- * @param callback {(param: object) => unknown}
571
+ * @param {(param: object) => unknown} callback
530
572
  */
531
573
  getPreferences(callback) {
532
574
  DevToolsAPI.sendMessageToEmbedder('getPreferences', [], callback);
@@ -534,7 +576,7 @@
534
576
 
535
577
  /**
536
578
  * @param name
537
- * @param callback {(param: object) => unknown}
579
+ * @param {(param: object) => unknown} callback
538
580
  */
539
581
  getPreference(name, callback) {
540
582
  DevToolsAPI.sendMessageToEmbedder('getPreference', [name], callback);
@@ -674,9 +716,10 @@
674
716
  }
675
717
 
676
718
  /**
677
- * @param url
719
+ * @param {string} _url
678
720
  */
679
- close(url) {
721
+ close(_url) {
722
+ // This is required when InspectorFrontendHostStub is used
680
723
  }
681
724
 
682
725
  /**
@@ -986,12 +1029,21 @@
986
1029
  }
987
1030
 
988
1031
  // Backward-compatible methods below this line --------------------------------------------
1032
+ /**
1033
+ * Support for legacy front-ends (<M65).
1034
+ * @returns
1035
+ */
1036
+ isUnderTest() {
1037
+ return false;
1038
+ }
1039
+
1040
+ // Backward-compatible methods end before line --------------------------------------------
989
1041
 
990
1042
  /**
991
1043
  * @returns
992
1044
  */
993
1045
  initialTargetId() {
994
- return DevToolsAPI._initialTargetIdPromiseWithResolver.promise;
1046
+ return DevToolsAPI._initialTargetIdPromise;
995
1047
  }
996
1048
 
997
1049
  /**
@@ -1092,7 +1144,7 @@
1092
1144
  ]);
1093
1145
 
1094
1146
  /**
1095
- * @param keyCode {number}
1147
+ * @param {number} keyCode
1096
1148
  * @returns
1097
1149
  */
1098
1150
  function keyCodeToKeyIdentifier(keyCode) {
@@ -1110,9 +1162,155 @@
1110
1162
  }
1111
1163
 
1112
1164
  function installBackwardsCompatibility() {
1113
- // Any polyfill that we need for backwards compatibility should be
1114
- // Added in this function
1115
- // Use getRemoteMajorVersion to get the correct Major Chrome version
1165
+ const majorVersion = getRemoteMajorVersion();
1166
+ if (!majorVersion) {
1167
+ return;
1168
+ }
1169
+
1170
+ /** @type {!Array<string>} */
1171
+ const styleRules = [];
1172
+ // Shadow DOM V0 polyfill
1173
+ if (majorVersion <= 73 && !Element.prototype.createShadowRoot) {
1174
+ Element.prototype.createShadowRoot = function() {
1175
+ try {
1176
+ return this.attachShadow({mode: 'open'});
1177
+ } catch {
1178
+ // some elements we use to add shadow roots can no
1179
+ // longer have shadow roots.
1180
+ const fakeShadowHost = document.createElement('span');
1181
+ this.appendChild(fakeShadowHost);
1182
+ fakeShadowHost.className = 'fake-shadow-host';
1183
+ return fakeShadowHost.createShadowRoot();
1184
+ }
1185
+ };
1186
+
1187
+ const origAdd = DOMTokenList.prototype.add;
1188
+ DOMTokenList.prototype.add = function(...tokens) {
1189
+ if (tokens[0].startsWith('insertion-point') || tokens[0].startsWith('tabbed-pane-header')) {
1190
+ this._myElement.slot = '.' + tokens[0];
1191
+ }
1192
+ return origAdd.apply(this, tokens);
1193
+ };
1194
+
1195
+ const origCreateElement = Document.prototype.createElement;
1196
+ Document.prototype.createElement = function(tagName, ...rest) {
1197
+ if (tagName === 'content') {
1198
+ tagName = 'slot';
1199
+ }
1200
+ const element = origCreateElement.call(this, tagName, ...rest);
1201
+ element.classList._myElement = element;
1202
+ return element;
1203
+ };
1204
+
1205
+ Object.defineProperty(HTMLSlotElement.prototype, 'select', {
1206
+ set(selector) {
1207
+ this.name = selector;
1208
+ }
1209
+ });
1210
+ }
1211
+
1212
+ // Custom Elements V0 polyfill
1213
+ if (majorVersion <= 73 && !Document.prototype.hasOwnProperty('registerElement')) {
1214
+ const fakeRegistry = new Map();
1215
+ Document.prototype.registerElement = function(typeExtension, options) {
1216
+ const {prototype, extends: localName} = options;
1217
+ const document = this;
1218
+ const callback = function() {
1219
+ const element = document.createElement(localName || typeExtension);
1220
+ const skip = new Set(['constructor', '__proto__']);
1221
+ for (const key of Object.keys(Object.getOwnPropertyDescriptors(prototype.__proto__ || {}))) {
1222
+ if (skip.has(key)) {
1223
+ continue;
1224
+ }
1225
+ element[key] = prototype[key];
1226
+ }
1227
+ element.setAttribute('is', typeExtension);
1228
+ if (element['createdCallback']) {
1229
+ element['createdCallback']();
1230
+ }
1231
+ return element;
1232
+ };
1233
+ fakeRegistry.set(typeExtension, callback);
1234
+ return callback;
1235
+ };
1236
+
1237
+ const origCreateElement = Document.prototype.createElement;
1238
+ Document.prototype.createElement = function(tagName, fakeCustomElementType) {
1239
+ const fakeConstructor = fakeRegistry.get(fakeCustomElementType);
1240
+ if (fakeConstructor) {
1241
+ return fakeConstructor();
1242
+ }
1243
+ return origCreateElement.call(this, tagName, fakeCustomElementType);
1244
+ };
1245
+
1246
+ // DevTools front-ends mistakenly assume that
1247
+ // classList.toggle('a', undefined) works as
1248
+ // classList.toggle('a', false) rather than as
1249
+ // classList.toggle('a');
1250
+ const originalDOMTokenListToggle = DOMTokenList.prototype.toggle;
1251
+ DOMTokenList.prototype.toggle = function(token, force) {
1252
+ if (arguments.length === 1) {
1253
+ force = !this.contains(token);
1254
+ }
1255
+ return originalDOMTokenListToggle.call(this, token, Boolean(force));
1256
+ };
1257
+ }
1258
+
1259
+ if (majorVersion <= 66) {
1260
+ /** @type {(!function(number, number):Element|undefined)} */
1261
+ ShadowRoot.prototype.__originalShadowRootElementFromPoint;
1262
+
1263
+ if (!ShadowRoot.prototype.__originalShadowRootElementFromPoint) {
1264
+ ShadowRoot.prototype.__originalShadowRootElementFromPoint = ShadowRoot.prototype.elementFromPoint;
1265
+ /**
1266
+ * @param x
1267
+ * @param y
1268
+ * @returns
1269
+ */
1270
+ ShadowRoot.prototype.elementFromPoint = function(x, y) {
1271
+ const originalResult = ShadowRoot.prototype.__originalShadowRootElementFromPoint.apply(this, arguments);
1272
+ if (this.host && originalResult === this.host) {
1273
+ return null;
1274
+ }
1275
+ return originalResult;
1276
+ };
1277
+ }
1278
+ }
1279
+
1280
+ if (majorVersion <= 71) {
1281
+ styleRules.push(
1282
+ '.coverage-toolbar-container, .animation-timeline-toolbar-container, .computed-properties { flex-basis: auto; }');
1283
+ }
1284
+
1285
+ installExtraStyleRules(styleRules);
1286
+ }
1287
+
1288
+ /**
1289
+ * @param styleRules
1290
+ */
1291
+ function installExtraStyleRules(styleRules) {
1292
+ if (!styleRules.length) {
1293
+ return;
1294
+ }
1295
+ const styleText = styleRules.join('\n');
1296
+ document.head.appendChild(createStyleElement(styleText));
1297
+
1298
+ const origCreateShadowRoot = HTMLElement.prototype.createShadowRoot;
1299
+ HTMLElement.prototype.createShadowRoot = function(...args) {
1300
+ const shadowRoot = origCreateShadowRoot.call(this, ...args);
1301
+ shadowRoot.appendChild(createStyleElement(styleText));
1302
+ return shadowRoot;
1303
+ };
1304
+ }
1305
+
1306
+ /**
1307
+ * @param styleText
1308
+ * @returns
1309
+ */
1310
+ function createStyleElement(styleText) {
1311
+ const style = document.createElement('style');
1312
+ style.textContent = styleText;
1313
+ return style;
1116
1314
  }
1117
1315
 
1118
1316
  installBackwardsCompatibility();
@@ -421,6 +421,7 @@ export const generatedProperties = [
421
421
  "column-rule-color",
422
422
  "column-rule-outset",
423
423
  "column-rule-style",
424
+ "column-rule-visibility-items",
424
425
  "column-rule-width",
425
426
  "column-span",
426
427
  "column-width",
@@ -720,6 +721,7 @@ export const generatedProperties = [
720
721
  "text-emphasis-style",
721
722
  "text-grow",
722
723
  "text-indent",
724
+ "text-justify",
723
725
  "text-orientation",
724
726
  "text-overflow",
725
727
  "text-rendering",
@@ -1736,6 +1738,16 @@ export const generatedProperties = [
1736
1738
  ],
1737
1739
  "name": "column-rule-style"
1738
1740
  },
1741
+ {
1742
+ "inherited": false,
1743
+ "keywords": [
1744
+ "all",
1745
+ "around",
1746
+ "between",
1747
+ "none"
1748
+ ],
1749
+ "name": "column-rule-visibility-items"
1750
+ },
1739
1751
  {
1740
1752
  "keywords": [
1741
1753
  "thin",
@@ -4321,6 +4333,16 @@ export const generatedProperties = [
4321
4333
  "inherited": true,
4322
4334
  "name": "text-indent"
4323
4335
  },
4336
+ {
4337
+ "inherited": true,
4338
+ "keywords": [
4339
+ "auto",
4340
+ "none",
4341
+ "inter-word",
4342
+ "inter-character"
4343
+ ],
4344
+ "name": "text-justify"
4345
+ },
4324
4346
  {
4325
4347
  "inherited": true,
4326
4348
  "keywords": [
@@ -5364,6 +5386,14 @@ export const generatedPropertyValues = {
5364
5386
  "double"
5365
5387
  ]
5366
5388
  },
5389
+ "column-rule-visibility-items": {
5390
+ "values": [
5391
+ "all",
5392
+ "around",
5393
+ "between",
5394
+ "none"
5395
+ ]
5396
+ },
5367
5397
  "column-rule-width": {
5368
5398
  "values": [
5369
5399
  "thin",
@@ -6773,6 +6803,14 @@ export const generatedPropertyValues = {
6773
6803
  "currentcolor"
6774
6804
  ]
6775
6805
  },
6806
+ "text-justify": {
6807
+ "values": [
6808
+ "auto",
6809
+ "none",
6810
+ "inter-word",
6811
+ "inter-character"
6812
+ ]
6813
+ },
6776
6814
  "text-orientation": {
6777
6815
  "values": [
6778
6816
  "sideways",