chrome-devtools-frontend 1.0.959955 → 1.0.961797

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 (83) hide show
  1. package/.vscode/devtools-workspace-launch.json +29 -0
  2. package/.vscode/devtools-workspace-settings.json +6 -1
  3. package/.vscode/devtools-workspace-tasks.json +28 -0
  4. package/config/gni/devtools_grd_files.gni +1 -3
  5. package/front_end/core/common/ParsedURL.ts +5 -2
  6. package/front_end/core/host/UserMetrics.ts +2 -1
  7. package/front_end/core/i18n/locales/en-US.json +36 -24
  8. package/front_end/core/i18n/locales/en-XL.json +36 -24
  9. package/front_end/core/sdk/DebuggerModel.ts +8 -1
  10. package/front_end/core/sdk/ServiceWorkerCacheModel.ts +3 -0
  11. package/front_end/core/sdk/SourceMap.ts +9 -1
  12. package/front_end/entrypoints/main/MainImpl.ts +5 -0
  13. package/front_end/generated/InspectorBackendCommands.js +21 -2
  14. package/front_end/generated/SupportedCSSProperties.js +3 -1
  15. package/front_end/generated/protocol-mapping.d.ts +17 -1
  16. package/front_end/generated/protocol-proxy-api.d.ts +18 -1
  17. package/front_end/generated/protocol.d.ts +79 -0
  18. package/front_end/models/issues_manager/IssuesManager.ts +0 -5
  19. package/front_end/models/issues_manager/issues_manager.ts +0 -2
  20. package/front_end/panels/application/IndexedDBModel.ts +3 -0
  21. package/front_end/panels/application/components/FrameDetailsView.ts +5 -1
  22. package/front_end/panels/application/components/PermissionsPolicySection.ts +16 -4
  23. package/front_end/panels/console/ConsoleView.ts +10 -1
  24. package/front_end/panels/console/ConsoleViewMessage.ts +5 -106
  25. package/front_end/panels/console/ErrorStackParser.ts +117 -0
  26. package/front_end/panels/console/console.ts +2 -0
  27. package/front_end/panels/elements/ElementsPanel.ts +10 -1
  28. package/front_end/panels/issues/IssueAggregator.ts +0 -10
  29. package/front_end/panels/issues/IssueView.ts +0 -2
  30. package/front_end/panels/snippets/SnippetsQuickOpen.ts +5 -0
  31. package/front_end/panels/sources/BreakpointEditDialog.ts +1 -1
  32. package/front_end/panels/sources/DebuggerPlugin.ts +7 -1
  33. package/front_end/panels/sources/SourcesPanel.ts +20 -2
  34. package/front_end/panels/timeline/TimelineTreeView.ts +10 -1
  35. package/front_end/third_party/acorn/README.chromium +1 -1
  36. package/front_end/third_party/acorn-loose/README.chromium +2 -2
  37. package/front_end/third_party/additional_readme_paths.json +15 -0
  38. package/front_end/third_party/codemirror/README.chromium +2 -2
  39. package/front_end/third_party/codemirror.next/README.chromium +1 -1
  40. package/front_end/third_party/lighthouse/README.chromium +1 -1
  41. package/front_end/third_party/lit-html/README.chromium +2 -2
  42. package/front_end/third_party/marked/README.chromium +2 -2
  43. package/front_end/third_party/puppeteer/README.chromium +2 -2
  44. package/front_end/third_party/puppeteer/package/README.md +11 -11
  45. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.d.ts +0 -1
  46. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.d.ts.map +1 -1
  47. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.js +2 -1
  48. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.js.map +1 -1
  49. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/JSHandle.d.ts +3 -1
  50. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/JSHandle.d.ts.map +1 -1
  51. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/JSHandle.js +40 -8
  52. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/JSHandle.js.map +1 -1
  53. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +1 -1
  54. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FrameManager.d.ts +0 -1
  55. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FrameManager.d.ts.map +1 -1
  56. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FrameManager.js +2 -1
  57. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FrameManager.js.map +1 -1
  58. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/JSHandle.d.ts +3 -1
  59. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/JSHandle.d.ts.map +1 -1
  60. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/JSHandle.js +40 -8
  61. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/JSHandle.js.map +1 -1
  62. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +1 -1
  63. package/front_end/third_party/puppeteer/package/lib/types.d.ts +3 -2
  64. package/front_end/third_party/puppeteer/package/package.json +2 -2
  65. package/front_end/third_party/wasmparser/README.chromium +2 -2
  66. package/front_end/ui/components/buttons/Button.ts +6 -1
  67. package/front_end/ui/components/buttons/button.css +0 -1
  68. package/front_end/ui/components/docs/button/basic.ts +1 -0
  69. package/front_end/ui/components/docs/icon_button/basic.ts +2 -7
  70. package/front_end/ui/components/icon_button/IconButton.ts +1 -1
  71. package/front_end/ui/legacy/SplitWidget.ts +6 -2
  72. package/front_end/ui/legacy/components/data_grid/DataGrid.ts +10 -8
  73. package/front_end/ui/legacy/toolbar.css +4 -0
  74. package/package.json +1 -1
  75. package/scripts/build/assert_third_party_readmes.py +69 -0
  76. package/front_end/models/issues_manager/WasmCrossOriginModuleSharingIssue.ts +0 -67
  77. package/front_end/models/issues_manager/descriptions/wasmCrossOriginModuleSharing.md +0 -5
  78. package/front_end/panels/issues/WasmCrossOriginModuleSharingAffectedResourcesView.ts +0 -90
  79. package/front_end/third_party/acorn/LICENSE +0 -19
  80. package/front_end/third_party/acorn-loose/LICENSE +0 -19
  81. package/front_end/third_party/codemirror/LICENSE +0 -21
  82. package/front_end/third_party/lit-html/LICENSE +0 -28
  83. package/front_end/third_party/wasmparser/LICENSE +0 -177
@@ -10031,6 +10031,7 @@ declare namespace Protocol {
10031
10031
  export const enum PermissionsPolicyBlockReason {
10032
10032
  Header = 'Header',
10033
10033
  IframeAttribute = 'IframeAttribute',
10034
+ InFencedFrameTree = 'InFencedFrameTree',
10034
10035
  }
10035
10036
 
10036
10037
  export interface PermissionsPolicyBlockLocator {
@@ -10480,6 +10481,20 @@ declare namespace Protocol {
10480
10481
  pictograph?: string;
10481
10482
  }
10482
10483
 
10484
+ /**
10485
+ * Font families collection for a script.
10486
+ */
10487
+ export interface ScriptFontFamilies {
10488
+ /**
10489
+ * Name of the script which these font families are defined for.
10490
+ */
10491
+ script: string;
10492
+ /**
10493
+ * Generic font families collection for the script.
10494
+ */
10495
+ fontFamilies: FontFamilies;
10496
+ }
10497
+
10483
10498
  /**
10484
10499
  * Default font sizes.
10485
10500
  */
@@ -11286,6 +11301,10 @@ declare namespace Protocol {
11286
11301
  * Specifies font families to set. If a font family is not specified, it won't be changed.
11287
11302
  */
11288
11303
  fontFamilies: FontFamilies;
11304
+ /**
11305
+ * Specifies font families to set for individual scripts.
11306
+ */
11307
+ forScripts?: ScriptFontFamilies[];
11289
11308
  }
11290
11309
 
11291
11310
  export interface SetFontSizesRequest {
@@ -12416,6 +12435,7 @@ declare namespace Protocol {
12416
12435
  Websql = 'websql',
12417
12436
  Service_workers = 'service_workers',
12418
12437
  Cache_storage = 'cache_storage',
12438
+ Interest_groups = 'interest_groups',
12419
12439
  All = 'all',
12420
12440
  Other = 'other',
12421
12441
  }
@@ -12443,6 +12463,43 @@ declare namespace Protocol {
12443
12463
  count: number;
12444
12464
  }
12445
12465
 
12466
+ /**
12467
+ * Enum of interest group access types.
12468
+ */
12469
+ export const enum InterestGroupAccessType {
12470
+ Join = 'join',
12471
+ Leave = 'leave',
12472
+ Update = 'update',
12473
+ Bid = 'bid',
12474
+ Win = 'win',
12475
+ }
12476
+
12477
+ /**
12478
+ * Ad advertising element inside an interest group.
12479
+ */
12480
+ export interface InterestGroupAd {
12481
+ renderUrl: string;
12482
+ metadata?: string;
12483
+ }
12484
+
12485
+ /**
12486
+ * The full details of an interest group.
12487
+ */
12488
+ export interface InterestGroupDetails {
12489
+ ownerOrigin: string;
12490
+ name: string;
12491
+ expirationTime: number;
12492
+ joiningOrigin: string;
12493
+ biddingUrl?: string;
12494
+ biddingWasmHelperUrl?: string;
12495
+ updateUrl?: string;
12496
+ trustedBiddingSignalsUrl?: string;
12497
+ trustedBiddingSignalsKeys: string[];
12498
+ userBiddingSignals?: string;
12499
+ ads: InterestGroupAd[];
12500
+ adComponents: InterestGroupAd[];
12501
+ }
12502
+
12446
12503
  export interface ClearDataForOriginRequest {
12447
12504
  /**
12448
12505
  * Security origin.
@@ -12572,6 +12629,19 @@ declare namespace Protocol {
12572
12629
  didDeleteTokens: boolean;
12573
12630
  }
12574
12631
 
12632
+ export interface GetInterestGroupDetailsRequest {
12633
+ ownerOrigin: string;
12634
+ name: string;
12635
+ }
12636
+
12637
+ export interface GetInterestGroupDetailsResponse extends ProtocolResponseWithError {
12638
+ details: InterestGroupDetails;
12639
+ }
12640
+
12641
+ export interface SetInterestGroupTrackingRequest {
12642
+ enable: boolean;
12643
+ }
12644
+
12575
12645
  /**
12576
12646
  * A cache's contents have been modified.
12577
12647
  */
@@ -12623,6 +12693,15 @@ declare namespace Protocol {
12623
12693
  */
12624
12694
  origin: string;
12625
12695
  }
12696
+
12697
+ /**
12698
+ * One of the interest groups was accessed by the associated page.
12699
+ */
12700
+ export interface InterestGroupAccessedEvent {
12701
+ type: InterestGroupAccessType;
12702
+ ownerOrigin: string;
12703
+ name: string;
12704
+ }
12626
12705
  }
12627
12706
 
12628
12707
  /**
@@ -25,7 +25,6 @@ import {SameSiteCookieIssue} from './SameSiteCookieIssue.js';
25
25
  import {SharedArrayBufferIssue} from './SharedArrayBufferIssue.js';
26
26
  import {SourceFrameIssuesManager} from './SourceFrameIssuesManager.js';
27
27
  import {TrustedWebActivityIssue} from './TrustedWebActivityIssue.js';
28
- import {WasmCrossOriginModuleSharingIssue} from './WasmCrossOriginModuleSharingIssue.js';
29
28
 
30
29
  export {Events} from './IssuesManagerEvents.js';
31
30
 
@@ -93,10 +92,6 @@ const issueCodeHandlers = new Map<
93
92
  Protocol.Audits.InspectorIssueCode.AttributionReportingIssue,
94
93
  AttributionReportingIssue.fromInspectorIssue,
95
94
  ],
96
- [
97
- Protocol.Audits.InspectorIssueCode.WasmCrossOriginModuleSharingIssue,
98
- WasmCrossOriginModuleSharingIssue.fromInspectorIssue,
99
- ],
100
95
  [
101
96
  Protocol.Audits.InspectorIssueCode.GenericIssue,
102
97
  GenericIssue.fromInspectorIssue,
@@ -24,7 +24,6 @@ import * as SameSiteCookieIssue from './SameSiteCookieIssue.js';
24
24
  import * as SharedArrayBufferIssue from './SharedArrayBufferIssue.js';
25
25
  import * as SourceFrameIssuesManager from './SourceFrameIssuesManager.js';
26
26
  import * as TrustedWebActivityIssue from './TrustedWebActivityIssue.js';
27
- import * as WasmCrossOriginModuleSharingIssue from './WasmCrossOriginModuleSharingIssue.js';
28
27
 
29
28
  export {
30
29
  AttributionReportingIssue,
@@ -49,5 +48,4 @@ export {
49
48
  SharedArrayBufferIssue,
50
49
  SourceFrameIssuesManager,
51
50
  TrustedWebActivityIssue,
52
- WasmCrossOriginModuleSharingIssue,
53
51
  };
@@ -410,6 +410,9 @@ export class IndexedDBModel extends SDK.SDKModel.SDKModel<EventTypes> implements
410
410
 
411
411
  cacheStorageContentUpdated(_event: Protocol.Storage.CacheStorageContentUpdatedEvent): void {
412
412
  }
413
+
414
+ interestGroupAccessed(_event: Protocol.Storage.InterestGroupAccessedEvent): void {
415
+ }
413
416
  }
414
417
 
415
418
  SDK.SDKModel.SDKModel.register(IndexedDBModel, {capabilities: SDK.Target.Capability.Storage, autostart: false});
@@ -236,6 +236,10 @@ const UIStrings = {
236
236
  */
237
237
  createdByAdScriptExplanation:
238
238
  'There was an ad script in the `(async) stack` when this frame was created. Examining the creation `stack trace` of this frame might provide more insight.',
239
+ /**
240
+ *@description Label for a button which when clicked causes some information to be refreshed/updated.
241
+ */
242
+ refresh: 'Refresh',
239
243
  };
240
244
  const str_ = i18n.i18n.registerUIStrings('panels/application/components/FrameDetailsView.ts', UIStrings);
241
245
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -337,7 +341,7 @@ export class FrameDetailsReportView extends HTMLElement {
337
341
  groups: [
338
342
  {
339
343
  iconName: 'refresh_12x12_icon',
340
- text: 'Refresh',
344
+ text: i18nString(UIStrings.refresh),
341
345
  } as IconButton.IconButton.IconWithTextData,
342
346
  ],
343
347
  } as IconButton.IconButton.IconButtonData}>
@@ -52,6 +52,10 @@ const UIStrings = {
52
52
  *@description Text describing that a specific feature is blocked by a Permissions Policy specified in a request header.
53
53
  */
54
54
  disabledByHeader: 'disabled by "`Permissions-Policy`" header',
55
+ /**
56
+ *@description Text describing that a specific feature is blocked by virtue of being inside a fenced frame tree.
57
+ */
58
+ disabledByFencedFrame: 'disabled inside a `fencedframe`',
55
59
  };
56
60
  const str_ = i18n.i18n.registerUIStrings('panels/application/components/PermissionsPolicySection.ts', UIStrings);
57
61
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -144,10 +148,18 @@ export class PermissionsPolicySection extends HTMLElement {
144
148
  const resource = frame && frame.resourceForURL(frame.url);
145
149
  const linkTargetRequest =
146
150
  blockReason === Protocol.Page.PermissionsPolicyBlockReason.Header && resource && resource.request;
147
- const blockReasonText = blockReason === Protocol.Page.PermissionsPolicyBlockReason.IframeAttribute ?
148
- i18nString(UIStrings.disabledByIframe) :
149
- blockReason === Protocol.Page.PermissionsPolicyBlockReason.Header ? i18nString(UIStrings.disabledByHeader) :
150
- '';
151
+ const blockReasonText = ((): String => {
152
+ switch (blockReason) {
153
+ case Protocol.Page.PermissionsPolicyBlockReason.IframeAttribute:
154
+ return i18nString(UIStrings.disabledByIframe);
155
+ case Protocol.Page.PermissionsPolicyBlockReason.Header:
156
+ return i18nString(UIStrings.disabledByHeader);
157
+ case Protocol.Page.PermissionsPolicyBlockReason.InFencedFrameTree:
158
+ return i18nString(UIStrings.disabledByFencedFrame);
159
+ default:
160
+ return '';
161
+ }
162
+ })();
151
163
  const revealHeader = async(): Promise<void> => {
152
164
  if (!linkTargetRequest) {
153
165
  return;
@@ -107,6 +107,14 @@ const UIStrings = {
107
107
  * open/show the sidebar.
108
108
  */
109
109
  hideConsoleSidebar: 'Hide console sidebar',
110
+ /**
111
+ * @description Screen reader announcement when the sidebar is shown in the Console panel.
112
+ */
113
+ consoleSidebarShown: 'Console sidebar shown',
114
+ /**
115
+ * @description Screen reader announcement when the sidebar is hidden in the Console panel.
116
+ */
117
+ consoleSidebarHidden: 'Console sidebar hidden',
110
118
  /**
111
119
  *@description Tooltip text that appears on the setting to preserve log when hovering over the item
112
120
  */
@@ -382,7 +390,8 @@ export class ConsoleView extends UI.Widget.VBox implements UI.SearchableView.Sea
382
390
  toolbar.makeWrappable(true);
383
391
  const rightToolbar = new UI.Toolbar.Toolbar('', this.consoleToolbarContainer);
384
392
  toolbar.appendToolbarItem(this.splitWidget.createShowHideSidebarButton(
385
- i18nString(UIStrings.showConsoleSidebar), i18nString(UIStrings.hideConsoleSidebar)));
393
+ i18nString(UIStrings.showConsoleSidebar), i18nString(UIStrings.hideConsoleSidebar),
394
+ i18nString(UIStrings.consoleSidebarShown), i18nString(UIStrings.consoleSidebarHidden)));
386
395
  toolbar.appendToolbarItem(UI.Toolbar.Toolbar.createActionButton(
387
396
  (UI.ActionRegistry.ActionRegistry.instance().action('console.clear') as UI.ActionRegistration.Action)));
388
397
  toolbar.appendSeparator();
@@ -56,6 +56,7 @@ import type {Chrome} from '../../../extension-api/ExtensionAPI.js'; // eslint-di
56
56
  import {format} from './ConsoleFormat.js';
57
57
  import type {ConsoleViewportElement} from './ConsoleViewport.js';
58
58
  import consoleViewStyles from './consoleView.css.js';
59
+ import {parseSourcePositionsFromErrorStack} from './ErrorStackParser.js';
59
60
 
60
61
  const UIStrings = {
61
62
  /**
@@ -1422,100 +1423,17 @@ export class ConsoleViewMessage implements ConsoleViewportElement {
1422
1423
  }
1423
1424
 
1424
1425
  private tryFormatAsError(string: string): HTMLElement|null {
1425
- function startsWith(prefix: string): boolean {
1426
- return string.startsWith(prefix);
1427
- }
1428
-
1429
1426
  const runtimeModel = this.message.runtimeModel();
1430
- // TODO: Consider removing these in favor of a simpler regex.
1431
- const errorPrefixes = [
1432
- 'AggregateError',
1433
- 'Error',
1434
- 'EvalError',
1435
- 'RangeError',
1436
- 'ReferenceError',
1437
- 'SyntaxError',
1438
- 'TypeError',
1439
- 'URIError',
1440
- ];
1441
- if (!runtimeModel || !errorPrefixes.some(startsWith) && !/^[\w.]+Error\b/.test(string)) {
1427
+ if (!runtimeModel) {
1442
1428
  return null;
1443
1429
  }
1444
- const debuggerModel = runtimeModel.debuggerModel();
1445
- const baseURL = runtimeModel.target().inspectedURL();
1446
-
1447
- const lines = string.split('\n');
1448
- const linkInfos = [];
1449
- for (const line of lines) {
1450
- const isCallFrameLine = /^\s*at\s/.test(line);
1451
- if (!isCallFrameLine && linkInfos.length && linkInfos[linkInfos.length - 1].link) {
1452
- return null;
1453
- }
1454
-
1455
- if (!isCallFrameLine) {
1456
- linkInfos.push({line});
1457
- continue;
1458
- }
1459
-
1460
- let openBracketIndex = -1;
1461
- let closeBracketIndex = -1;
1462
- const inBracketsWithLineAndColumn = /\([^\)\(]+:\d+:\d+\)/g;
1463
- const inBrackets = /\([^\)\(]+\)/g;
1464
- let lastMatch: RegExpExecArray|null = null;
1465
- let currentMatch;
1466
- while ((currentMatch = inBracketsWithLineAndColumn.exec(line))) {
1467
- lastMatch = currentMatch;
1468
- }
1469
- if (!lastMatch) {
1470
- while ((currentMatch = inBrackets.exec(line))) {
1471
- lastMatch = currentMatch;
1472
- }
1473
- }
1474
- if (lastMatch) {
1475
- openBracketIndex = lastMatch.index;
1476
- closeBracketIndex = lastMatch.index + lastMatch[0].length - 1;
1477
- }
1478
- const hasOpenBracket = openBracketIndex !== -1;
1479
- let left = hasOpenBracket ? openBracketIndex + 1 : line.indexOf('at') + 3;
1480
- if (!hasOpenBracket && line.indexOf('async ') === left) {
1481
- left += 6;
1482
- }
1483
- const right = hasOpenBracket ? closeBracketIndex : line.length;
1484
- const linkCandidate = line.substring(left, right);
1485
- const splitResult = Common.ParsedURL.ParsedURL.splitLineAndColumn(linkCandidate);
1486
- if (!splitResult) {
1487
- return null;
1488
- }
1489
-
1490
- if (splitResult.url === '<anonymous>') {
1491
- linkInfos.push({line});
1492
- continue;
1493
- }
1494
- let url = parseOrScriptMatch(splitResult.url);
1495
- if (!url && Common.ParsedURL.ParsedURL.isRelativeURL(splitResult.url)) {
1496
- url = parseOrScriptMatch(Common.ParsedURL.ParsedURL.completeURL(baseURL, splitResult.url));
1497
- }
1498
- if (!url) {
1499
- return null;
1500
- }
1501
-
1502
- linkInfos.push({
1503
- line,
1504
- link: {
1505
- url,
1506
- enclosedInBraces: hasOpenBracket,
1507
- positionLeft: left,
1508
- positionRight: right,
1509
- lineNumber: splitResult.lineNumber,
1510
- columnNumber: splitResult.columnNumber,
1511
- },
1512
- });
1513
- }
1514
1430
 
1515
- if (!linkInfos.length) {
1431
+ const linkInfos = parseSourcePositionsFromErrorStack(runtimeModel, string);
1432
+ if (!linkInfos?.length) {
1516
1433
  return null;
1517
1434
  }
1518
1435
 
1436
+ const debuggerModel = runtimeModel.debuggerModel();
1519
1437
  const formattedResult = document.createElement('span');
1520
1438
  for (let i = 0; i < linkInfos.length; ++i) {
1521
1439
  const newline = i < linkInfos.length - 1 ? '\n' : '';
@@ -1565,25 +1483,6 @@ export class ConsoleViewMessage implements ConsoleViewportElement {
1565
1483
  }
1566
1484
 
1567
1485
  return formattedResult;
1568
-
1569
- function parseOrScriptMatch(url: string|null): string|null {
1570
- if (!url) {
1571
- return null;
1572
- }
1573
- const parsedURL = Common.ParsedURL.ParsedURL.fromString(url);
1574
- if (parsedURL) {
1575
- return parsedURL.url;
1576
- }
1577
- if (debuggerModel.scriptsForSourceURL(url).length) {
1578
- return url;
1579
- }
1580
- // nodejs stack traces contain (absolute) file paths, but v8 reports them as file: urls.
1581
- const fileUrl = new URL(url, 'file://');
1582
- if (debuggerModel.scriptsForSourceURL(fileUrl.href).length) {
1583
- return fileUrl.href;
1584
- }
1585
- return null;
1586
- }
1587
1486
  }
1588
1487
 
1589
1488
  private linkifyWithCustomLinkifier(
@@ -0,0 +1,117 @@
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 Common from '../../core/common/common.js';
6
+ import type * as SDK from '../../core/sdk/sdk.js';
7
+
8
+ export interface ParsedErrorFrame {
9
+ line: string;
10
+ link?: {
11
+ url: string,
12
+ lineNumber?: number,
13
+ columnNumber?: number, enclosedInBraces: boolean, positionLeft: number, positionRight: number,
14
+ };
15
+ }
16
+
17
+ /**
18
+ * Takes a V8 Error#stack string and extracts source position information.
19
+ *
20
+ * The result includes the url, line and column number, as well as where
21
+ * the url is found in the raw line.
22
+ *
23
+ * @returns Null if the provided string has an unexpected format. A
24
+ * populated `ParsedErrorFrame[]` otherwise.
25
+ */
26
+ export function parseSourcePositionsFromErrorStack(
27
+ runtimeModel: SDK.RuntimeModel.RuntimeModel, stack: string): ParsedErrorFrame[]|null {
28
+ if (!/^[\w.]*Error\b/.test(stack)) {
29
+ return null;
30
+ }
31
+ const debuggerModel = runtimeModel.debuggerModel();
32
+ const baseURL = runtimeModel.target().inspectedURL();
33
+
34
+ const lines = stack.split('\n');
35
+ const linkInfos = [];
36
+ for (const line of lines) {
37
+ const isCallFrameLine = /^\s*at\s/.test(line);
38
+ if (!isCallFrameLine && linkInfos.length && linkInfos[linkInfos.length - 1].link) {
39
+ return null;
40
+ }
41
+
42
+ if (!isCallFrameLine) {
43
+ linkInfos.push({line});
44
+ continue;
45
+ }
46
+
47
+ let openBracketIndex = -1;
48
+ let closeBracketIndex = -1;
49
+ const inBracketsWithLineAndColumn = /\([^\)\(]+:\d+:\d+\)/g;
50
+ const inBrackets = /\([^\)\(]+\)/g;
51
+ let lastMatch: RegExpExecArray|null = null;
52
+ let currentMatch;
53
+ while ((currentMatch = inBracketsWithLineAndColumn.exec(line))) {
54
+ lastMatch = currentMatch;
55
+ }
56
+ if (!lastMatch) {
57
+ while ((currentMatch = inBrackets.exec(line))) {
58
+ lastMatch = currentMatch;
59
+ }
60
+ }
61
+ if (lastMatch) {
62
+ openBracketIndex = lastMatch.index;
63
+ closeBracketIndex = lastMatch.index + lastMatch[0].length - 1;
64
+ }
65
+ const hasOpenBracket = openBracketIndex !== -1;
66
+ let left = hasOpenBracket ? openBracketIndex + 1 : line.indexOf('at') + 3;
67
+ if (!hasOpenBracket && line.indexOf('async ') === left) {
68
+ left += 6;
69
+ }
70
+ const right = hasOpenBracket ? closeBracketIndex : line.length;
71
+ const linkCandidate = line.substring(left, right);
72
+ const splitResult = Common.ParsedURL.ParsedURL.splitLineAndColumn(linkCandidate);
73
+ if (splitResult.url === '<anonymous>') {
74
+ linkInfos.push({line});
75
+ continue;
76
+ }
77
+ let url = parseOrScriptMatch(debuggerModel, splitResult.url);
78
+ if (!url && Common.ParsedURL.ParsedURL.isRelativeURL(splitResult.url)) {
79
+ url = parseOrScriptMatch(debuggerModel, Common.ParsedURL.ParsedURL.completeURL(baseURL, splitResult.url));
80
+ }
81
+ if (!url) {
82
+ return null;
83
+ }
84
+
85
+ linkInfos.push({
86
+ line,
87
+ link: {
88
+ url,
89
+ enclosedInBraces: hasOpenBracket,
90
+ positionLeft: left,
91
+ positionRight: right,
92
+ lineNumber: splitResult.lineNumber,
93
+ columnNumber: splitResult.columnNumber,
94
+ },
95
+ });
96
+ }
97
+ return linkInfos;
98
+ }
99
+
100
+ function parseOrScriptMatch(debuggerModel: SDK.DebuggerModel.DebuggerModel, url: string|null): string|null {
101
+ if (!url) {
102
+ return null;
103
+ }
104
+ const parsedURL = Common.ParsedURL.ParsedURL.fromString(url);
105
+ if (parsedURL) {
106
+ return parsedURL.url;
107
+ }
108
+ if (debuggerModel.scriptsForSourceURL(url).length) {
109
+ return url;
110
+ }
111
+ // nodejs stack traces contain (absolute) file paths, but v8 reports them as file: urls.
112
+ const fileUrl = new URL(url, 'file://');
113
+ if (debuggerModel.scriptsForSourceURL(fileUrl.href).length) {
114
+ return fileUrl.href;
115
+ }
116
+ return null;
117
+ }
@@ -23,6 +23,7 @@ import * as ConsoleSidebar from './ConsoleSidebar.js';
23
23
  import * as ConsoleView from './ConsoleView.js';
24
24
  import * as ConsoleViewMessage from './ConsoleViewMessage.js';
25
25
  import * as ConsoleViewport from './ConsoleViewport.js';
26
+ import * as ErrorStackParser from './ErrorStackParser.js';
26
27
 
27
28
  export {
28
29
  ConsoleContextSelector,
@@ -35,4 +36,5 @@ export {
35
36
  ConsoleView,
36
37
  ConsoleViewMessage,
37
38
  ConsoleViewport,
39
+ ErrorStackParser,
38
40
  };
@@ -88,6 +88,14 @@ const UIStrings = {
88
88
  * close/hide the sidebar.
89
89
  */
90
90
  hideComputedStylesSidebar: 'Hide Computed Styles sidebar',
91
+ /**
92
+ * @description Screen reader announcement when the computed styles sidebar is shown in the Elements panel.
93
+ */
94
+ computedStylesShown: 'Computed Styles sidebar shown',
95
+ /**
96
+ * @description Screen reader announcement when the computed styles sidebar is hidden in the Elements panel.
97
+ */
98
+ computedStylesHidden: 'Computed Styles sidebar hidden',
91
99
  /**
92
100
  * @description Title of a pane in the Elements panel that shows computed styles for the selected
93
101
  * HTML element. Computed styles are the final, actual styles of the element, including all
@@ -962,7 +970,8 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
962
970
  });
963
971
  this.stylesWidget.addEventListener(StylesSidebarPaneEvents.InitialUpdateCompleted, () => {
964
972
  this.stylesWidget.appendToolbarItem(stylesSplitWidget.createShowHideSidebarButton(
965
- i18nString(UIStrings.showComputedStylesSidebar), i18nString(UIStrings.hideComputedStylesSidebar)));
973
+ i18nString(UIStrings.showComputedStylesSidebar), i18nString(UIStrings.hideComputedStylesSidebar),
974
+ i18nString(UIStrings.computedStylesShown), i18nString(UIStrings.computedStylesHidden)));
966
975
  });
967
976
 
968
977
  const showMetricsWidgetInComputedPane = (): void => {
@@ -43,8 +43,6 @@ export class AggregatedIssue extends IssuesManager.Issue.Issue {
43
43
  #trustedWebActivityIssues = new Set<IssuesManager.TrustedWebActivityIssue.TrustedWebActivityIssue>();
44
44
  #quirksModeIssues = new Set<IssuesManager.QuirksModeIssue.QuirksModeIssue>();
45
45
  #attributionReportingIssues = new Set<IssuesManager.AttributionReportingIssue.AttributionReportingIssue>();
46
- #wasmCrossOriginModuleSharingIssues =
47
- new Set<IssuesManager.WasmCrossOriginModuleSharingIssue.WasmCrossOriginModuleSharingIssue>();
48
46
  #genericIssues = new Set<IssuesManager.GenericIssue.GenericIssue>();
49
47
  #representative?: IssuesManager.Issue.Issue;
50
48
  #aggregatedIssuesCount = 0;
@@ -126,11 +124,6 @@ export class AggregatedIssue extends IssuesManager.Issue.Issue {
126
124
  return this.#attributionReportingIssues;
127
125
  }
128
126
 
129
- getWasmCrossOriginModuleSharingIssue():
130
- ReadonlySet<IssuesManager.WasmCrossOriginModuleSharingIssue.WasmCrossOriginModuleSharingIssue> {
131
- return this.#wasmCrossOriginModuleSharingIssues;
132
- }
133
-
134
127
  getGenericIssues(): ReadonlySet<IssuesManager.GenericIssue.GenericIssue> {
135
128
  return this.#genericIssues;
136
129
  }
@@ -223,9 +216,6 @@ export class AggregatedIssue extends IssuesManager.Issue.Issue {
223
216
  if (issue instanceof IssuesManager.AttributionReportingIssue.AttributionReportingIssue) {
224
217
  this.#attributionReportingIssues.add(issue);
225
218
  }
226
- if (issue instanceof IssuesManager.WasmCrossOriginModuleSharingIssue.WasmCrossOriginModuleSharingIssue) {
227
- this.#wasmCrossOriginModuleSharingIssues.add(issue);
228
- }
229
219
  if (issue instanceof IssuesManager.GenericIssue.GenericIssue) {
230
220
  this.#genericIssues.add(issue);
231
221
  }
@@ -30,7 +30,6 @@ import {AffectedSourcesView} from './AffectedSourcesView.js';
30
30
  import {AffectedTrustedWebActivityIssueDetailsView} from './AffectedTrustedWebActivityIssueDetailsView.js';
31
31
  import {CorsIssueDetailsView} from './CorsIssueDetailsView.js';
32
32
  import {GenericIssueDetailsView} from './GenericIssueDetailsView.js';
33
- import {WasmCrossOriginModuleSharingAffectedResourcesView} from './WasmCrossOriginModuleSharingAffectedResourcesView.js';
34
33
  import {AttributionReportingIssueDetailsView} from './AttributionReportingIssueDetailsView.js';
35
34
 
36
35
  import type {AggregatedIssue} from './IssueAggregator.js';
@@ -253,7 +252,6 @@ export class IssueView extends UI.TreeOutline.TreeElement {
253
252
  new GenericIssueDetailsView(this, this.#issue),
254
253
  new AffectedDocumentsInQuirksModeView(this, this.#issue),
255
254
  new AttributionReportingIssueDetailsView(this, this.#issue),
256
- new WasmCrossOriginModuleSharingAffectedResourcesView(this, this.#issue),
257
255
  new AffectedRawCookieLinesView(this, this.#issue),
258
256
  ];
259
257
  if (Root.Runtime.experiments.isEnabled('hideIssuesFeature')) {
@@ -63,6 +63,11 @@ export class SnippetsQuickOpen extends QuickOpen.FilteredListWidget.Provider {
63
63
  this.snippets = [];
64
64
  }
65
65
 
66
+ itemScoreAt(itemIndex: number, query: string): number {
67
+ // Prefer short matches over long matches
68
+ return query.length / this.snippets[itemIndex].name().length;
69
+ }
70
+
66
71
  itemCount(): number {
67
72
  return this.snippets.length;
68
73
  }
@@ -206,7 +206,7 @@ export class BreakpointEditDialog extends UI.Widget.Widget {
206
206
  }
207
207
  }
208
208
 
209
- private finishEditing(committed: boolean, condition: string): void {
209
+ finishEditing(committed: boolean, condition: string): void {
210
210
  if (this.finished) {
211
211
  return;
212
212
  }
@@ -192,8 +192,8 @@ export class DebuggerPlugin extends Plugin {
192
192
  private initializedMuted: boolean;
193
193
  private ignoreListInfobar: UI.Infobar.Infobar|null;
194
194
  private prettyPrintInfobar!: UI.Infobar.Infobar|null;
195
- private scheduledBreakpointDecorationUpdates?: Set<BreakpointDecoration>|null;
196
195
  private refreshBreakpointsTimeout: undefined|number = undefined;
196
+ private activeBreakpointDialog: BreakpointEditDialog|null = null;
197
197
 
198
198
  constructor(
199
199
  uiSourceCode: Workspace.UISourceCode.UISourceCode,
@@ -799,6 +799,7 @@ export class DebuggerPlugin extends Plugin {
799
799
  const decorationElement = document.createElement('div');
800
800
  const compartment = new CodeMirror.Compartment();
801
801
  const dialog = new BreakpointEditDialog(line.number - 1, oldCondition, Boolean(preferLogpoint), async result => {
802
+ this.activeBreakpointDialog = null;
802
803
  dialog.detach();
803
804
  editor.dispatch({effects: compartment.reconfigure([])});
804
805
  if (!result.committed) {
@@ -828,6 +829,7 @@ export class DebuggerPlugin extends Plugin {
828
829
  dialog.markAsExternallyManaged();
829
830
  dialog.show(decorationElement);
830
831
  dialog.focusEditor();
832
+ this.activeBreakpointDialog = dialog;
831
833
  }
832
834
 
833
835
  // Create decorations to indicate the current debugging position
@@ -1423,6 +1425,10 @@ export class DebuggerPlugin extends Plugin {
1423
1425
  if (this.muted) {
1424
1426
  return;
1425
1427
  }
1428
+ if (this.activeBreakpointDialog) {
1429
+ this.activeBreakpointDialog.finishEditing(false, '');
1430
+ }
1431
+
1426
1432
  const breakpoints = this.lineBreakpoints(line);
1427
1433
  if (!breakpoints.length) {
1428
1434
  await this.createNewBreakpoint(line, '', true);