chrome-devtools-frontend 1.0.967596 → 1.0.968818

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 (45) hide show
  1. package/config/gni/devtools_grd_files.gni +20 -0
  2. package/front_end/core/host/UserMetrics.ts +2 -1
  3. package/front_end/core/i18n/locales/en-US.json +6 -0
  4. package/front_end/core/i18n/locales/en-XL.json +6 -0
  5. package/front_end/core/root/Runtime.ts +1 -0
  6. package/front_end/core/sdk/CSSMatchedStyles.ts +1 -1
  7. package/front_end/devtools_compatibility.js +0 -36
  8. package/front_end/entrypoints/main/MainImpl.ts +4 -0
  9. package/front_end/models/issues_manager/FederatedAuthRequestIssue.ts +265 -0
  10. package/front_end/models/issues_manager/IssuesManager.ts +5 -0
  11. package/front_end/models/issues_manager/descriptions/federatedAuthRequestAccountsHttpNotFound.md +1 -0
  12. package/front_end/models/issues_manager/descriptions/federatedAuthRequestAccountsInvalidResponse.md +1 -0
  13. package/front_end/models/issues_manager/descriptions/federatedAuthRequestAccountsNoResponse.md +1 -0
  14. package/front_end/models/issues_manager/descriptions/federatedAuthRequestApprovalDeclined.md +1 -0
  15. package/front_end/models/issues_manager/descriptions/federatedAuthRequestCanceled.md +1 -0
  16. package/front_end/models/issues_manager/descriptions/federatedAuthRequestClientIdMetadataHttpNotFound.md +1 -0
  17. package/front_end/models/issues_manager/descriptions/federatedAuthRequestClientIdMetadataInvalidResponse.md +1 -0
  18. package/front_end/models/issues_manager/descriptions/federatedAuthRequestClientIdMetadataNoResponse.md +1 -0
  19. package/front_end/models/issues_manager/descriptions/federatedAuthRequestErrorFetchingSignin.md +1 -0
  20. package/front_end/models/issues_manager/descriptions/federatedAuthRequestErrorIdToken.md +1 -0
  21. package/front_end/models/issues_manager/descriptions/federatedAuthRequestIdTokenHttpNotFound.md +1 -0
  22. package/front_end/models/issues_manager/descriptions/federatedAuthRequestIdTokenInvalidRequest.md +1 -0
  23. package/front_end/models/issues_manager/descriptions/federatedAuthRequestIdTokenInvalidResponse.md +1 -0
  24. package/front_end/models/issues_manager/descriptions/federatedAuthRequestIdTokenNoResponse.md +1 -0
  25. package/front_end/models/issues_manager/descriptions/federatedAuthRequestInvalidSigninResponse.md +1 -0
  26. package/front_end/models/issues_manager/descriptions/federatedAuthRequestTooManyRequests.md +1 -0
  27. package/front_end/models/issues_manager/descriptions/federatedAuthRequestWellKnownHttpNotFound.md +1 -0
  28. package/front_end/models/issues_manager/descriptions/federatedAuthRequestWellKnownInvalidResponse.md +1 -0
  29. package/front_end/models/issues_manager/descriptions/federatedAuthRequestWellKnownNoResponse.md +1 -0
  30. package/front_end/panels/application/InterestGroupStorageView.ts +21 -7
  31. package/front_end/panels/console/ConsoleViewMessage.ts +3 -5
  32. package/front_end/panels/console/ErrorStackParser.ts +5 -3
  33. package/front_end/panels/lighthouse/LighthouseReportRenderer.ts +6 -3
  34. package/front_end/panels/sources/DebuggerPlugin.ts +1 -1
  35. package/front_end/panels/sources/ScopeChainSidebarPane.ts +31 -0
  36. package/front_end/panels/sources/SourceMapNamesResolver.ts +15 -9
  37. package/front_end/ui/components/settings/settingCheckbox.css +2 -0
  38. package/front_end/ui/legacy/components/object_ui/ObjectPopoverHelper.ts +13 -34
  39. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +1 -1
  40. package/front_end/ui/legacy/components/object_ui/objectPopover.css +0 -25
  41. package/package.json +1 -1
  42. package/scripts/build/devtools_plugin.js +32 -1
  43. package/scripts/build/esbuild.js +1 -24
  44. package/scripts/build/tests/plugins_test.js +60 -1
  45. package/scripts/devtools_paths.js +1 -29
@@ -304,6 +304,25 @@ grd_files_release_sources = [
304
304
  "front_end/models/issues_manager/descriptions/cspURLViolation.md",
305
305
  "front_end/models/issues_manager/descriptions/deprecation.md",
306
306
  "front_end/models/issues_manager/descriptions/deprecationNavigatorUserAgent.md",
307
+ "front_end/models/issues_manager/descriptions/federatedAuthRequestAccountsHttpNotFound.md",
308
+ "front_end/models/issues_manager/descriptions/federatedAuthRequestAccountsInvalidResponse.md",
309
+ "front_end/models/issues_manager/descriptions/federatedAuthRequestAccountsNoResponse.md",
310
+ "front_end/models/issues_manager/descriptions/federatedAuthRequestApprovalDeclined.md",
311
+ "front_end/models/issues_manager/descriptions/federatedAuthRequestCanceled.md",
312
+ "front_end/models/issues_manager/descriptions/federatedAuthRequestClientIdMetadataHttpNotFound.md",
313
+ "front_end/models/issues_manager/descriptions/federatedAuthRequestClientIdMetadataInvalidResponse.md",
314
+ "front_end/models/issues_manager/descriptions/federatedAuthRequestClientIdMetadataNoResponse.md",
315
+ "front_end/models/issues_manager/descriptions/federatedAuthRequestErrorFetchingSignin.md",
316
+ "front_end/models/issues_manager/descriptions/federatedAuthRequestErrorIdToken.md",
317
+ "front_end/models/issues_manager/descriptions/federatedAuthRequestIdTokenHttpNotFound.md",
318
+ "front_end/models/issues_manager/descriptions/federatedAuthRequestIdTokenInvalidRequest.md",
319
+ "front_end/models/issues_manager/descriptions/federatedAuthRequestIdTokenInvalidResponse.md",
320
+ "front_end/models/issues_manager/descriptions/federatedAuthRequestIdTokenNoResponse.md",
321
+ "front_end/models/issues_manager/descriptions/federatedAuthRequestInvalidSigninResponse.md",
322
+ "front_end/models/issues_manager/descriptions/federatedAuthRequestTooManyRequests.md",
323
+ "front_end/models/issues_manager/descriptions/federatedAuthRequestWellKnownHttpNotFound.md",
324
+ "front_end/models/issues_manager/descriptions/federatedAuthRequestWellKnownInvalidResponse.md",
325
+ "front_end/models/issues_manager/descriptions/federatedAuthRequestWellKnownNoResponse.md",
307
326
  "front_end/models/issues_manager/descriptions/genericCrossOriginPortalPostMessageError.md",
308
327
  "front_end/models/issues_manager/descriptions/heavyAd.md",
309
328
  "front_end/models/issues_manager/descriptions/mixedContent.md",
@@ -703,6 +722,7 @@ grd_files_debug_sources = [
703
722
  "front_end/models/issues_manager/CorsIssue.js",
704
723
  "front_end/models/issues_manager/CrossOriginEmbedderPolicyIssue.js",
705
724
  "front_end/models/issues_manager/DeprecationIssue.js",
725
+ "front_end/models/issues_manager/FederatedAuthRequestIssue.js",
706
726
  "front_end/models/issues_manager/GenericIssue.js",
707
727
  "front_end/models/issues_manager/HeavyAdIssue.js",
708
728
  "front_end/models/issues_manager/Issue.js",
@@ -585,7 +585,8 @@ export enum DevtoolsExperiments {
585
585
  'preciseChanges' = 53,
586
586
  'bfcacheDisplayTree' = 54,
587
587
  'stylesPaneCSSChanges' = 55,
588
- 'MaxValue' = 56,
588
+ 'headerOverrides' = 56,
589
+ 'MaxValue' = 57,
589
590
  }
590
591
  /* eslint-enable @typescript-eslint/naming-convention */
591
592
 
@@ -1337,6 +1337,9 @@
1337
1337
  "models/issues_manager/CrossOriginEmbedderPolicyIssue.ts | samesiteAndSameorigin": {
1338
1338
  "message": "Same-Site and Same-Origin"
1339
1339
  },
1340
+ "models/issues_manager/FederatedAuthRequestIssue.ts | fedCm": {
1341
+ "message": "Federated Credential Management API"
1342
+ },
1340
1343
  "models/issues_manager/GenericIssue.ts | crossOriginPortalPostMessage": {
1341
1344
  "message": "Portals - Same-origin communication channels"
1342
1345
  },
@@ -3200,6 +3203,9 @@
3200
3203
  "panels/application/InterestGroupStorageView.ts | clickToDisplayBody": {
3201
3204
  "message": "Click on any interest group event to display the group's current state"
3202
3205
  },
3206
+ "panels/application/InterestGroupStorageView.ts | noDataAvailable": {
3207
+ "message": "No details available for the selected interest group. The browser may have left the group."
3208
+ },
3203
3209
  "panels/application/InterestGroupTreeElement.ts | interestGroups": {
3204
3210
  "message": "Interest Groups"
3205
3211
  },
@@ -1337,6 +1337,9 @@
1337
1337
  "models/issues_manager/CrossOriginEmbedderPolicyIssue.ts | samesiteAndSameorigin": {
1338
1338
  "message": "Ŝám̂é-Ŝít̂é âńd̂ Śâḿê-Ór̂íĝín̂"
1339
1339
  },
1340
+ "models/issues_manager/FederatedAuthRequestIssue.ts | fedCm": {
1341
+ "message": "F̂éd̂ér̂át̂éd̂ Ćr̂éd̂én̂t́îál̂ Ḿâńâǵêḿêńt̂ ÁP̂Í"
1342
+ },
1340
1343
  "models/issues_manager/GenericIssue.ts | crossOriginPortalPostMessage": {
1341
1344
  "message": "P̂ór̂t́âĺŝ - Śâḿê-ór̂íĝín̂ ćôḿm̂ún̂íĉát̂íôń ĉh́âńn̂él̂ś"
1342
1345
  },
@@ -3200,6 +3203,9 @@
3200
3203
  "panels/application/InterestGroupStorageView.ts | clickToDisplayBody": {
3201
3204
  "message": "Ĉĺîćk̂ ón̂ án̂ý îńt̂ér̂éŝt́ ĝŕôúp̂ év̂én̂t́ t̂ó d̂íŝṕl̂áŷ t́ĥé ĝŕôúp̂'ś ĉúr̂ŕêńt̂ śt̂át̂é"
3202
3205
  },
3206
+ "panels/application/InterestGroupStorageView.ts | noDataAvailable": {
3207
+ "message": "N̂ó d̂ét̂áîĺŝ áv̂áîĺâb́l̂é f̂ór̂ t́ĥé ŝél̂éĉt́êd́ îńt̂ér̂éŝt́ ĝŕôúp̂. T́ĥé b̂ŕôẃŝér̂ ḿâý ĥáv̂é l̂éf̂t́ t̂h́ê ǵr̂óûṕ."
3208
+ },
3203
3209
  "panels/application/InterestGroupTreeElement.ts | interestGroups": {
3204
3210
  "message": "Îńt̂ér̂éŝt́ Ĝŕôúp̂ś"
3205
3211
  },
@@ -274,6 +274,7 @@ export enum ExperimentName {
274
274
  FULL_ACCESSIBILITY_TREE = 'fullAccessibilityTree',
275
275
  PRECISE_CHANGES = 'preciseChanges',
276
276
  STYLES_PANE_CSS_CHANGES = 'stylesPaneCSSChanges',
277
+ HEADER_OVERRIDES = 'headerOverrides',
277
278
  }
278
279
 
279
280
  // TODO(crbug.com/1167717): Make this a const enum again
@@ -273,7 +273,7 @@ export class CSSMatchedStyles {
273
273
  async recomputeMatchingSelectors(rule: CSSStyleRule): Promise<void> {
274
274
  const node = this.nodeForStyle(rule.style);
275
275
  if (!node) {
276
- return Promise.resolve();
276
+ return;
277
277
  }
278
278
  const promises = [];
279
279
  for (const selector of rule.selectors) {
@@ -1481,42 +1481,6 @@
1481
1481
  installObjectObserve();
1482
1482
  }
1483
1483
 
1484
- if (majorVersion <= 45) {
1485
- /**
1486
- * @param {string} property
1487
- * @return {!CSSValue|null}
1488
- * @this {CSSStyleDeclaration}
1489
- */
1490
- function getValue(property) {
1491
- // Note that |property| comes from another context, so we can't use === here.
1492
- // eslint-disable-next-line eqeqeq
1493
- if (property == 'padding-left') {
1494
- return /** @type {!CSSValue} */ ({
1495
- /**
1496
- * @return {number}
1497
- * @this {!{__paddingLeft: number}}
1498
- */
1499
- getFloatValue: function() {
1500
- return this.__paddingLeft;
1501
- },
1502
- __paddingLeft: parseFloat(this.paddingLeft)
1503
- });
1504
- }
1505
- throw new Error('getPropertyCSSValue is undefined');
1506
- }
1507
-
1508
- window.CSSStyleDeclaration.prototype.getPropertyCSSValue = getValue;
1509
-
1510
- function CSSPrimitiveValue() {
1511
- }
1512
- CSSPrimitiveValue.CSS_PX = 5;
1513
- window.CSSPrimitiveValue = CSSPrimitiveValue;
1514
- }
1515
-
1516
- if (majorVersion <= 45) {
1517
- styleRules.push('* { min-width: 0; min-height: 0; }');
1518
- }
1519
-
1520
1484
  if (majorVersion <= 71) {
1521
1485
  styleRules.push(
1522
1486
  '.coverage-toolbar-container, .animation-timeline-toolbar-container, .computed-properties { flex-basis: auto; }');
@@ -372,6 +372,10 @@ export class MainImpl {
372
372
  Root.Runtime.experiments.register(
373
373
  Root.Runtime.ExperimentName.STYLES_PANE_CSS_CHANGES, 'Sync CSS changes in the Styles pane');
374
374
 
375
+ // Local overrides for response headers
376
+ Root.Runtime.experiments.register(
377
+ Root.Runtime.ExperimentName.HEADER_OVERRIDES, 'Local overrides for response headers');
378
+
375
379
  Root.Runtime.experiments.enableExperimentsByDefault([
376
380
  'sourceOrderViewer',
377
381
  'hideIssuesFeature',
@@ -0,0 +1,265 @@
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 i18n from '../../core/i18n/i18n.js';
6
+ import type * as SDK from '../../core/sdk/sdk.js';
7
+ import * as Protocol from '../../generated/protocol.js';
8
+
9
+ import {Issue, IssueCategory, IssueKind} from './Issue.js';
10
+ import type {MarkdownIssueDescription, LazyMarkdownIssueDescription} from './MarkdownIssueDescription.js';
11
+ import {resolveLazyDescription} from './MarkdownIssueDescription.js';
12
+
13
+ const UIStrings = {
14
+ /**
15
+ *@description Title for Client Hint specification url link
16
+ */
17
+ fedCm: 'Federated Credential Management API',
18
+ };
19
+ const str_ = i18n.i18n.registerUIStrings('models/issues_manager/FederatedAuthRequestIssue.ts', UIStrings);
20
+ const i18nLazyString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined, str_);
21
+
22
+ export class FederatedAuthRequestIssue extends Issue {
23
+ readonly #issueDetails: Protocol.Audits.FederatedAuthRequestIssueDetails;
24
+
25
+ constructor(
26
+ issueDetails: Protocol.Audits.FederatedAuthRequestIssueDetails, issuesModel: SDK.IssuesModel.IssuesModel) {
27
+ super(
28
+ {
29
+ code: Protocol.Audits.InspectorIssueCode.FederatedAuthRequestIssue,
30
+ umaCode: [
31
+ Protocol.Audits.InspectorIssueCode.FederatedAuthRequestIssue,
32
+ issueDetails.federatedAuthRequestIssueReason,
33
+ ].join('::'),
34
+ },
35
+ issuesModel);
36
+ this.#issueDetails = issueDetails;
37
+ }
38
+
39
+ getCategory(): IssueCategory {
40
+ return IssueCategory.Other;
41
+ }
42
+
43
+ details(): Protocol.Audits.FederatedAuthRequestIssueDetails {
44
+ return this.#issueDetails;
45
+ }
46
+
47
+ getDescription(): MarkdownIssueDescription|null {
48
+ const description = issueDescriptions.get(this.#issueDetails.federatedAuthRequestIssueReason);
49
+ if (!description) {
50
+ return null;
51
+ }
52
+ return resolveLazyDescription(description);
53
+ }
54
+
55
+ primaryKey(): string {
56
+ return JSON.stringify(this.#issueDetails);
57
+ }
58
+
59
+ getKind(): IssueKind {
60
+ return IssueKind.PageError;
61
+ }
62
+
63
+ static fromInspectorIssue(issuesModel: SDK.IssuesModel.IssuesModel, inspectorIssue: Protocol.Audits.InspectorIssue):
64
+ FederatedAuthRequestIssue[] {
65
+ const details = inspectorIssue.details.federatedAuthRequestIssueDetails;
66
+ if (!details) {
67
+ console.warn('Federated auth request issue without details received.');
68
+ return [];
69
+ }
70
+ return [new FederatedAuthRequestIssue(details, issuesModel)];
71
+ }
72
+ }
73
+
74
+ const issueDescriptions: Map<Protocol.Audits.FederatedAuthRequestIssueReason, LazyMarkdownIssueDescription> = new Map([
75
+ [
76
+ Protocol.Audits.FederatedAuthRequestIssueReason.ApprovalDeclined,
77
+ {
78
+ file: 'federatedAuthRequestApprovalDeclined.md',
79
+ links: [{
80
+ link: 'https://fedidcg.github.io/FedCM/',
81
+ linkTitle: i18nLazyString(UIStrings.fedCm),
82
+ }],
83
+ },
84
+ ],
85
+ [
86
+ Protocol.Audits.FederatedAuthRequestIssueReason.TooManyRequests,
87
+ {
88
+ file: 'federatedAuthRequestTooManyRequests.md',
89
+ links: [{
90
+ link: 'https://fedidcg.github.io/FedCM/',
91
+ linkTitle: i18nLazyString(UIStrings.fedCm),
92
+ }],
93
+ },
94
+ ],
95
+ [
96
+ Protocol.Audits.FederatedAuthRequestIssueReason.WellKnownHttpNotFound,
97
+ {
98
+ file: 'federatedAuthRequestWellKnownHttpNotFound.md',
99
+ links: [{
100
+ link: 'https://fedidcg.github.io/FedCM/',
101
+ linkTitle: i18nLazyString(UIStrings.fedCm),
102
+ }],
103
+ },
104
+ ],
105
+ [
106
+ Protocol.Audits.FederatedAuthRequestIssueReason.WellKnownNoResponse,
107
+ {
108
+ file: 'federatedAuthRequestWellKnownNoResponse.md',
109
+ links: [{
110
+ link: 'https://fedidcg.github.io/FedCM/',
111
+ linkTitle: i18nLazyString(UIStrings.fedCm),
112
+ }],
113
+ },
114
+ ],
115
+ [
116
+ Protocol.Audits.FederatedAuthRequestIssueReason.WellKnownInvalidResponse,
117
+ {
118
+ file: 'federatedAuthRequestWellKnownInvalidResponse.md',
119
+ links: [{
120
+ link: 'https://fedidcg.github.io/FedCM/',
121
+ linkTitle: i18nLazyString(UIStrings.fedCm),
122
+ }],
123
+ },
124
+ ],
125
+ [
126
+ Protocol.Audits.FederatedAuthRequestIssueReason.ClientIdMetadataHttpNotFound,
127
+ {
128
+ file: 'federatedAuthRequestClientIdMetadataHttpNotFound.md',
129
+ links: [{
130
+ link: 'https://fedidcg.github.io/FedCM/',
131
+ linkTitle: i18nLazyString(UIStrings.fedCm),
132
+ }],
133
+ },
134
+ ],
135
+ [
136
+ Protocol.Audits.FederatedAuthRequestIssueReason.ClientIdMetadataNoResponse,
137
+ {
138
+ file: 'federatedAuthRequestClientIdMetadataNoResponse.md',
139
+ links: [{
140
+ link: 'https://fedidcg.github.io/FedCM/',
141
+ linkTitle: i18nLazyString(UIStrings.fedCm),
142
+ }],
143
+ },
144
+ ],
145
+ [
146
+ Protocol.Audits.FederatedAuthRequestIssueReason.ClientIdMetadataInvalidResponse,
147
+ {
148
+ file: 'federatedAuthRequestClientIdMetadataInvalidResponse.md',
149
+ links: [{
150
+ link: 'https://fedidcg.github.io/FedCM/',
151
+ linkTitle: i18nLazyString(UIStrings.fedCm),
152
+ }],
153
+ },
154
+ ],
155
+ [
156
+ Protocol.Audits.FederatedAuthRequestIssueReason.ErrorFetchingSignin,
157
+ {
158
+ file: 'federatedAuthRequestErrorFetchingSignin.md',
159
+ links: [{
160
+ link: 'https://fedidcg.github.io/FedCM/',
161
+ linkTitle: i18nLazyString(UIStrings.fedCm),
162
+ }],
163
+ },
164
+ ],
165
+ [
166
+ Protocol.Audits.FederatedAuthRequestIssueReason.InvalidSigninResponse,
167
+ {
168
+ file: 'federatedAuthRequestInvalidSigninResponse.md',
169
+ links: [{
170
+ link: 'https://fedidcg.github.io/FedCM/',
171
+ linkTitle: i18nLazyString(UIStrings.fedCm),
172
+ }],
173
+ },
174
+ ],
175
+ [
176
+ Protocol.Audits.FederatedAuthRequestIssueReason.AccountsHttpNotFound,
177
+ {
178
+ file: 'federatedAuthRequestAccountsHttpNotFound.md',
179
+ links: [{
180
+ link: 'https://fedidcg.github.io/FedCM/',
181
+ linkTitle: i18nLazyString(UIStrings.fedCm),
182
+ }],
183
+ },
184
+ ],
185
+ [
186
+ Protocol.Audits.FederatedAuthRequestIssueReason.AccountsNoResponse,
187
+ {
188
+ file: 'federatedAuthRequestAccountsNoResponse.md',
189
+ links: [{
190
+ link: 'https://fedidcg.github.io/FedCM/',
191
+ linkTitle: i18nLazyString(UIStrings.fedCm),
192
+ }],
193
+ },
194
+ ],
195
+ [
196
+ Protocol.Audits.FederatedAuthRequestIssueReason.AccountsInvalidResponse,
197
+ {
198
+ file: 'federatedAuthRequestAccountsInvalidResponse.md',
199
+ links: [{
200
+ link: 'https://fedidcg.github.io/FedCM/',
201
+ linkTitle: i18nLazyString(UIStrings.fedCm),
202
+ }],
203
+ },
204
+ ],
205
+ [
206
+ Protocol.Audits.FederatedAuthRequestIssueReason.IdTokenHttpNotFound,
207
+ {
208
+ file: 'federatedAuthRequestIdTokenHttpNotFound.md',
209
+ links: [{
210
+ link: 'https://fedidcg.github.io/FedCM/',
211
+ linkTitle: i18nLazyString(UIStrings.fedCm),
212
+ }],
213
+ },
214
+ ],
215
+ [
216
+ Protocol.Audits.FederatedAuthRequestIssueReason.IdTokenNoResponse,
217
+ {
218
+ file: 'federatedAuthRequestIdTokenNoResponse.md',
219
+ links: [{
220
+ link: 'https://fedidcg.github.io/FedCM/',
221
+ linkTitle: i18nLazyString(UIStrings.fedCm),
222
+ }],
223
+ },
224
+ ],
225
+ [
226
+ Protocol.Audits.FederatedAuthRequestIssueReason.IdTokenInvalidResponse,
227
+ {
228
+ file: 'federatedAuthRequestIdTokenInvalidResponse.md',
229
+ links: [{
230
+ link: 'https://fedidcg.github.io/FedCM/',
231
+ linkTitle: i18nLazyString(UIStrings.fedCm),
232
+ }],
233
+ },
234
+ ],
235
+ [
236
+ Protocol.Audits.FederatedAuthRequestIssueReason.IdTokenInvalidRequest,
237
+ {
238
+ file: 'federatedAuthRequestIdTokenInvalidRequest.md',
239
+ links: [{
240
+ link: 'https://fedidcg.github.io/FedCM/',
241
+ linkTitle: i18nLazyString(UIStrings.fedCm),
242
+ }],
243
+ },
244
+ ],
245
+ [
246
+ Protocol.Audits.FederatedAuthRequestIssueReason.ErrorIdToken,
247
+ {
248
+ file: 'federatedAuthRequestErrorIdToken.md',
249
+ links: [{
250
+ link: 'https://fedidcg.github.io/FedCM/',
251
+ linkTitle: i18nLazyString(UIStrings.fedCm),
252
+ }],
253
+ },
254
+ ],
255
+ [
256
+ Protocol.Audits.FederatedAuthRequestIssueReason.Canceled,
257
+ {
258
+ file: 'federatedAuthRequestCanceled.md',
259
+ links: [{
260
+ link: 'https://fedidcg.github.io/FedCM/',
261
+ linkTitle: i18nLazyString(UIStrings.fedCm),
262
+ }],
263
+ },
264
+ ],
265
+ ]);
@@ -13,6 +13,7 @@ import {ContentSecurityPolicyIssue} from './ContentSecurityPolicyIssue.js';
13
13
  import {CorsIssue} from './CorsIssue.js';
14
14
  import {CrossOriginEmbedderPolicyIssue, isCrossOriginEmbedderPolicyIssue} from './CrossOriginEmbedderPolicyIssue.js';
15
15
  import {DeprecationIssue} from './DeprecationIssue.js';
16
+ import {FederatedAuthRequestIssue} from './FederatedAuthRequestIssue.js';
16
17
  import {GenericIssue} from './GenericIssue.js';
17
18
  import {HeavyAdIssue} from './HeavyAdIssue.js';
18
19
  import type {Issue, IssueKind} from './Issue.js';
@@ -104,6 +105,10 @@ const issueCodeHandlers = new Map<
104
105
  Protocol.Audits.InspectorIssueCode.ClientHintIssue,
105
106
  ClientHintIssue.fromInspectorIssue,
106
107
  ],
108
+ [
109
+ Protocol.Audits.InspectorIssueCode.FederatedAuthRequestIssue,
110
+ FederatedAuthRequestIssue.fromInspectorIssue,
111
+ ],
107
112
  ]);
108
113
 
109
114
  /**
@@ -0,0 +1 @@
1
+ # The provider's accounts list endpoint cannot be found.
@@ -0,0 +1 @@
1
+ # Provider's accounts list is invalid.
@@ -0,0 +1 @@
1
+ # The response body is empty when fetching the provider's accounts list.
@@ -0,0 +1 @@
1
+ # User declined the sign-in attempt.
@@ -0,0 +1 @@
1
+ # The request has been aborted.
@@ -0,0 +1 @@
1
+ # The provider's client metadata endpoint cannot be found.
@@ -0,0 +1 @@
1
+ # The response body is empty when fetching the provider's client metadata.
@@ -0,0 +1 @@
1
+ # Error attempting to reach the provider's sign-in endpoint.
@@ -0,0 +1 @@
1
+ # Error retrieving an id token.
@@ -0,0 +1 @@
1
+ # The provider's id token endpoint cannot be found.
@@ -0,0 +1 @@
1
+ # The id token fetching request is invalid.
@@ -0,0 +1 @@
1
+ # The response body is empty when fetching the provider's id token.
@@ -0,0 +1 @@
1
+ # Provider's sign-in response is invalid.
@@ -0,0 +1 @@
1
+ # Only one navigator.credentials.get request may be outstanding at one time.
@@ -0,0 +1 @@
1
+ # The provider's .well-known configuration cannot be found.
@@ -0,0 +1 @@
1
+ # Provider's .well-known configuration is invalid.
@@ -0,0 +1 @@
1
+ # The response body is empty when fetching the provider's .well-known configuration.
@@ -18,8 +18,10 @@ const UIStrings = {
18
18
  */
19
19
  clickToDisplayBody: 'Click on any interest group event to display the group\'s current state',
20
20
  /**
21
- interestGroupStorageItems: 'InterestGroup Storage Items',
21
+ *@description Placeholder text telling the user no details are available for
22
+ *the selected interest group.
22
23
  */
24
+ noDataAvailable: 'No details available for the selected interest group. The browser may have left the group.',
23
25
  };
24
26
  const str_ = i18n.i18n.registerUIStrings('panels/application/InterestGroupStorageView.ts', UIStrings);
25
27
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -37,24 +39,33 @@ export class InterestGroupStorageView extends UI.SplitWidget.SplitWidget {
37
39
  private readonly interestGroupGrid = new ApplicationComponents.InterestGroupAccessGrid.InterestGroupAccessGrid();
38
40
  private events: Protocol.Storage.InterestGroupAccessedEvent[] = [];
39
41
  private detailsGetter: InterestGroupDetailsGetter;
42
+ private noDataView: UI.Widget.VBox;
43
+ private noDisplayView: UI.Widget.VBox;
40
44
 
41
45
  constructor(detailsGetter: InterestGroupDetailsGetter) {
42
46
  super(/* isVertical */ false, /* secondIsSidebar: */ true);
43
47
  this.detailsGetter = detailsGetter;
44
48
 
45
49
  const topPanel = new UI.Widget.VBox();
46
- const bottomPanel = new UI.Widget.VBox();
50
+ this.noDisplayView = new UI.Widget.VBox();
51
+ this.noDataView = new UI.Widget.VBox();
52
+
47
53
  topPanel.setMinimumSize(0, 80);
48
54
  this.setMainWidget(topPanel);
49
- bottomPanel.setMinimumSize(0, 40);
50
- this.setSidebarWidget(bottomPanel);
55
+ this.noDisplayView.setMinimumSize(0, 40);
56
+ this.setSidebarWidget(this.noDisplayView);
57
+ this.noDataView.setMinimumSize(0, 40);
51
58
 
52
59
  topPanel.contentElement.appendChild(this.interestGroupGrid);
53
60
  this.interestGroupGrid.addEventListener('cellfocused', this.onFocus.bind(this));
54
61
 
55
- bottomPanel.contentElement.classList.add('placeholder');
56
- const centered = bottomPanel.contentElement.createChild('div');
57
- centered.textContent = i18nString(UIStrings.clickToDisplayBody);
62
+ this.noDisplayView.contentElement.classList.add('placeholder');
63
+ const noDisplayDiv = this.noDisplayView.contentElement.createChild('div');
64
+ noDisplayDiv.textContent = i18nString(UIStrings.clickToDisplayBody);
65
+
66
+ this.noDataView.contentElement.classList.add('placeholder');
67
+ const noDataDiv = this.noDataView.contentElement.createChild('div');
68
+ noDataDiv.textContent = i18nString(UIStrings.noDataAvailable);
58
69
  }
59
70
 
60
71
  wasShown(): void {
@@ -77,6 +88,7 @@ export class InterestGroupStorageView extends UI.SplitWidget.SplitWidget {
77
88
  clearEvents(): void {
78
89
  this.events = [];
79
90
  this.interestGroupGrid.data = this.events;
91
+ this.setSidebarWidget(this.noDisplayView);
80
92
  }
81
93
 
82
94
  private async onFocus(event: Event): Promise<void> {
@@ -99,6 +111,8 @@ export class InterestGroupStorageView extends UI.SplitWidget.SplitWidget {
99
111
  if (jsonView) {
100
112
  this.setSidebarWidget(jsonView);
101
113
  }
114
+ } else {
115
+ this.setSidebarWidget(this.noDataView);
102
116
  }
103
117
  }
104
118
 
@@ -1470,10 +1470,8 @@ export class ConsoleViewMessage implements ConsoleViewportElement {
1470
1470
  continue;
1471
1471
  }
1472
1472
  const formattedLine = document.createElement('span');
1473
- const prefix = line.substring(0, link.positionLeft);
1474
- const suffix = `${line.substring(link.positionRight)}${newline}`;
1475
-
1476
- formattedLine.appendChild(this.linkifyStringAsFragment(prefix));
1473
+ const suffix = `${link.suffix}${newline}`;
1474
+ formattedLine.appendChild(this.linkifyStringAsFragment(link.prefix));
1477
1475
  const scriptLocationLink = this.linkifier.linkifyScriptLocation(
1478
1476
  debuggerModel.target(), link.scriptId || null, link.url, link.lineNumber, {
1479
1477
  columnNumber: link.columnNumber,
@@ -1492,7 +1490,7 @@ export class ConsoleViewMessage implements ConsoleViewportElement {
1492
1490
  continue;
1493
1491
  }
1494
1492
 
1495
- const prefixWithoutFunction = prefix.substring(0, prefix.lastIndexOf(' ', prefix.length - 3));
1493
+ const prefixWithoutFunction = link.prefix.substring(0, link.prefix.lastIndexOf(' ', link.prefix.length - 3));
1496
1494
 
1497
1495
  // If we were able to parse the function name from the stack trace line, try to replace it with an expansion of
1498
1496
  // any inline frames.
@@ -10,8 +10,10 @@ export interface ParsedErrorFrame {
10
10
  line: string;
11
11
  link?: {
12
12
  url: string,
13
+ prefix: string,
14
+ suffix: string,
13
15
  lineNumber?: number,
14
- columnNumber?: number, enclosedInBraces: boolean, positionLeft: number, positionRight: number,
16
+ columnNumber?: number, enclosedInBraces: boolean,
15
17
  scriptId?: Protocol.Runtime.ScriptId,
16
18
  };
17
19
  }
@@ -88,9 +90,9 @@ export function parseSourcePositionsFromErrorStack(
88
90
  line,
89
91
  link: {
90
92
  url,
93
+ prefix: line.substring(0, left),
94
+ suffix: line.substring(right),
91
95
  enclosedInBraces: hasOpenBracket,
92
- positionLeft: left,
93
- positionRight: right,
94
96
  lineNumber: splitResult.lineNumber,
95
97
  columnNumber: splitResult.columnNumber,
96
98
  },
@@ -140,9 +140,12 @@ export class LighthouseReportRenderer extends LighthouseReport.ReportRenderer {
140
140
  }
141
141
 
142
142
  static handleDarkMode(el: Element): void {
143
- if (ThemeSupport.ThemeSupport.instance().themeName() === 'dark') {
144
- el.classList.add('lh-dark');
145
- }
143
+ const updateDarkModeIfNecessary = (): void => {
144
+ el.classList.toggle('lh-dark', ThemeSupport.ThemeSupport.instance().themeName() === 'dark');
145
+ };
146
+ ThemeSupport.ThemeSupport.instance().addEventListener(
147
+ ThemeSupport.ThemeChangeEvent.eventName, updateDarkModeIfNecessary);
148
+ updateDarkModeIfNecessary();
146
149
  }
147
150
  }
148
151
 
@@ -607,7 +607,7 @@ export class DebuggerPlugin extends Plugin {
607
607
  return null;
608
608
  }
609
609
  while (
610
- node && node.name !== 'VariableDefinition' && node.name !== 'VariableName' &&
610
+ node && node.name !== 'this' && node.name !== 'VariableDefinition' && node.name !== 'VariableName' &&
611
611
  node.name !== 'MemberExpression' &&
612
612
  !(node.name === 'PropertyName' && node.parent?.name === 'PatternProperty' &&
613
613
  node.nextSibling?.name !== ':') &&
@@ -90,6 +90,8 @@ export class ScopeChainSidebarPane extends UI.Widget.VBox implements UI.ContextF
90
90
  private readonly expandController: ObjectUI.ObjectPropertiesSection.ObjectPropertiesSectionsTreeExpandController;
91
91
  private readonly linkifier: Components.Linkifier.Linkifier;
92
92
  private infoElement: HTMLDivElement;
93
+ #scopesScript: SDK.Script.Script|null = null;
94
+
93
95
  private constructor() {
94
96
  super(true);
95
97
 
@@ -126,6 +128,34 @@ export class ScopeChainSidebarPane extends UI.Widget.VBox implements UI.ContextF
126
128
  }
127
129
  }
128
130
 
131
+ private sourceMapAttached(
132
+ event: Common.EventTarget.EventTargetEvent<{client: SDK.Script.Script, sourceMap: SDK.SourceMap.SourceMap}>):
133
+ void {
134
+ if (event.data.client === this.#scopesScript) {
135
+ void this.update();
136
+ }
137
+ }
138
+
139
+ private setScopeSourceMapSubscription(callFrame: SDK.DebuggerModel.CallFrame|null): void {
140
+ const oldScript = this.#scopesScript;
141
+ this.#scopesScript = callFrame?.script ?? null;
142
+
143
+ // Shortcut for the case when we are listening to the same model.
144
+ if (oldScript?.debuggerModel === this.#scopesScript?.debuggerModel) {
145
+ return;
146
+ }
147
+
148
+ if (oldScript) {
149
+ oldScript.debuggerModel.sourceMapManager().removeEventListener(
150
+ SDK.SourceMapManager.Events.SourceMapAttached, this.sourceMapAttached, this);
151
+ }
152
+
153
+ if (this.#scopesScript) {
154
+ this.#scopesScript.debuggerModel.sourceMapManager().addEventListener(
155
+ SDK.SourceMapManager.Events.SourceMapAttached, this.sourceMapAttached, this);
156
+ }
157
+ }
158
+
129
159
  private async update(): Promise<void> {
130
160
  // The `resolveThisObject(callFrame)` and `resolveScopeChain(callFrame)` calls
131
161
  // below may take a while to complete, so indicate to the user that something
@@ -137,6 +167,7 @@ export class ScopeChainSidebarPane extends UI.Widget.VBox implements UI.ContextF
137
167
  this.linkifier.reset();
138
168
 
139
169
  const callFrame = UI.Context.Context.instance().flavor(SDK.DebuggerModel.CallFrame);
170
+ this.setScopeSourceMapSubscription(callFrame);
140
171
  const [thisObject, scopeChain] = await Promise.all([resolveThisObject(callFrame), resolveScopeChain(callFrame)]);
141
172
  // By now the developer might have moved on, and we don't want to show stale
142
173
  // scope information, so check again that we're still on the same CallFrame.
@@ -10,9 +10,14 @@ import * as TextUtils from '../../models/text_utils/text_utils.js';
10
10
  import type * as Workspace from '../../models/workspace/workspace.js';
11
11
  import * as Protocol from '../../generated/protocol.js';
12
12
 
13
- const scopeToCachedIdentifiersMap = new WeakMap<SDK.DebuggerModel.ScopeChainEntry, Promise<Map<string, string>>>();
13
+ interface CachedScopeMap {
14
+ sourceMap: SDK.SourceMap.SourceMap|null;
15
+ identifiersPromise: Promise<Map<string, string>>;
16
+ }
14
17
 
18
+ const scopeToCachedIdentifiersMap = new WeakMap<SDK.DebuggerModel.ScopeChainEntry, CachedScopeMap>();
15
19
  const cachedMapByCallFrame = new WeakMap<SDK.DebuggerModel.CallFrame, Map<string, string>>();
20
+
16
21
  export class Identifier {
17
22
  name: string;
18
23
  lineNumber: number;
@@ -79,17 +84,17 @@ export const resolveScopeChain =
79
84
  };
80
85
 
81
86
  export const resolveScope = async(scope: SDK.DebuggerModel.ScopeChainEntry): Promise<Map<string, string>> => {
82
- let identifiersPromise = scopeToCachedIdentifiersMap.get(scope);
83
- if (!identifiersPromise) {
87
+ let cachedScopeMap = scopeToCachedIdentifiersMap.get(scope);
88
+ const script = scope.callFrame().script;
89
+ const sourceMap = Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance().sourceMapForScript(script);
90
+
91
+ if (!cachedScopeMap || cachedScopeMap.sourceMap !== sourceMap) {
84
92
  // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
85
93
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
86
94
  // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
87
95
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
88
- identifiersPromise = (async(): Promise<Map<any, any>> => {
96
+ const identifiersPromise = (async(): Promise<Map<any, any>> => {
89
97
  const namesMapping = new Map<string, string>();
90
- const script = scope.callFrame().script;
91
- const sourceMap =
92
- Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance().sourceMapForScript(script);
93
98
  if (sourceMap) {
94
99
  const textCache = new Map<string, TextUtils.Text.Text>();
95
100
  // Extract as much as possible from SourceMap and resolve
@@ -111,9 +116,10 @@ export const resolveScope = async(scope: SDK.DebuggerModel.ScopeChainEntry): Pro
111
116
  }
112
117
  return namesMapping;
113
118
  })();
114
- scopeToCachedIdentifiersMap.set(scope, identifiersPromise);
119
+ cachedScopeMap = {sourceMap, identifiersPromise};
120
+ scopeToCachedIdentifiersMap.set(scope, {sourceMap, identifiersPromise});
115
121
  }
116
- return await identifiersPromise;
122
+ return await cachedScopeMap.identifiersPromise;
117
123
 
118
124
  async function resolveSourceName(
119
125
  script: SDK.Script.Script, sourceMap: SDK.SourceMap.SourceMap, id: Identifier,
@@ -12,6 +12,8 @@
12
12
  input {
13
13
  height: 12px;
14
14
  width: 12px;
15
+ min-height: 12px;
16
+ min-width: 12px;
15
17
  }
16
18
 
17
19
  label {
@@ -59,7 +59,7 @@ export class ObjectPopoverHelper {
59
59
  Promise<ObjectPopoverHelper|null> {
60
60
  const description = Platform.StringUtilities.trimEndWithMaxLength(result.description || '', MaxPopoverTextLength);
61
61
  let popoverContentElement: HTMLSpanElement|HTMLDivElement|null = null;
62
- if (result.type === 'object') {
62
+ if (result.type === 'function' || result.type === 'object') {
63
63
  let linkifier: Components.Linkifier.Linkifier|null = null;
64
64
  let resultHighlightedAsDOM = false;
65
65
  if (result.subtype === 'node') {
@@ -74,9 +74,15 @@ export class ObjectPopoverHelper {
74
74
  } else {
75
75
  popoverContentElement = document.createElement('div');
76
76
  popoverContentElement.classList.add('object-popover-content');
77
- popover.registerCSSFiles([objectPopoverStyles]);
78
- const titleElement = popoverContentElement.createChild('div', 'monospace object-popover-title');
79
- titleElement.createChild('span').textContent = description;
77
+ popover.registerCSSFiles([objectValueStyles, objectPopoverStyles]);
78
+ const titleElement = popoverContentElement.createChild('div', 'object-popover-title');
79
+ if (result.type === 'function') {
80
+ titleElement.classList.add('source-code');
81
+ titleElement.appendChild(ObjectPropertiesSection.valueElementForFunctionDescription(result.description));
82
+ } else {
83
+ titleElement.classList.add('monospace');
84
+ titleElement.createChild('span').textContent = description;
85
+ }
80
86
  linkifier = new Components.Linkifier.Linkifier();
81
87
  const section = new ObjectPropertiesSection(result, '', linkifier, true /* showOverflow */);
82
88
  section.element.classList.add('object-popover-tree');
@@ -98,39 +104,12 @@ export class ObjectPopoverHelper {
98
104
 
99
105
  if (result.type === 'string') {
100
106
  UI.UIUtils.createTextChildren(valueElement, `"${description}"`);
101
- } else if (result.type !== 'function') {
107
+ } else {
102
108
  valueElement.textContent = description;
103
109
  }
104
110
 
105
- if (result.type !== 'function') {
106
- popover.contentElement.appendChild(popoverContentElement);
107
- return new ObjectPopoverHelper(null, false);
108
- }
109
-
110
- void ObjectPropertiesSection.formatObjectAsFunction(result, valueElement, true);
111
- const response = await result.debuggerModel().functionDetailsPromise(result);
112
- if (!response) {
113
- return null;
114
- }
115
-
116
- const container = document.createElement('div');
117
- container.classList.add('object-popover-container');
118
- const title = container.createChild('div', 'function-popover-title source-code');
119
- const functionName = title.createChild('span', 'function-name');
120
- functionName.textContent = UI.UIUtils.beautifyFunctionName(response.functionName);
121
-
122
- const rawLocation = response.location;
123
- const linkContainer = title.createChild('div', 'function-title-link-container');
124
- const script = rawLocation && rawLocation.script();
125
- const sourceURL = script && script.sourceURL;
126
- let linkifier: Components.Linkifier.Linkifier|null = null;
127
- if (sourceURL) {
128
- linkifier = new Components.Linkifier.Linkifier(undefined, undefined, popover.positionContent.bind(popover));
129
- linkContainer.appendChild(linkifier.linkifyRawLocation((rawLocation as SDK.DebuggerModel.Location), sourceURL));
130
- }
131
- container.appendChild(popoverContentElement);
132
- popover.contentElement.appendChild(container);
133
- return new ObjectPopoverHelper(linkifier, false);
111
+ popover.contentElement.appendChild(popoverContentElement);
112
+ return new ObjectPopoverHelper(null, false);
134
113
  }
135
114
  }
136
115
 
@@ -260,7 +260,7 @@ export class ObjectPropertiesSection extends UI.TreeOutline.TreeOutlineInShadow
260
260
  return UI.Fragment.html`<span class="name">${name}</span>`;
261
261
  }
262
262
 
263
- static valueElementForFunctionDescription(description?: string|null, includePreview?: boolean, defaultName?: string):
263
+ static valueElementForFunctionDescription(description?: string, includePreview?: boolean, defaultName?: string):
264
264
  Element {
265
265
  const valueElement = document.createElement('span');
266
266
  valueElement.classList.add('object-value-function');
@@ -30,28 +30,3 @@
30
30
  .object-popover-container {
31
31
  display: inline-block;
32
32
  }
33
-
34
- .function-popover-title {
35
- border-bottom: 1px solid var(--color-details-hairline);
36
- margin-bottom: 3px;
37
- padding-bottom: 2px;
38
- display: flex;
39
- justify-content: space-between;
40
- align-items: center;
41
- }
42
-
43
- .function-popover-title .function-name {
44
- font-weight: bold;
45
- }
46
-
47
- .function-title-link-container {
48
- display: flex;
49
- align-items: center;
50
- position: relative;
51
- margin-left: 10px;
52
- }
53
-
54
- .function-title-link-container .devtools-link {
55
- white-space: nowrap;
56
- overflow: hidden;
57
- }
package/package.json CHANGED
@@ -54,5 +54,5 @@
54
54
  "unittest": "scripts/test/run_unittests.py --no-text-coverage",
55
55
  "watch": "third_party/node/node.py --output scripts/watch_build.js"
56
56
  },
57
- "version": "1.0.967596"
57
+ "version": "1.0.968818"
58
58
  }
@@ -111,4 +111,35 @@ function devtoolsPlugin(source, importer) {
111
111
  };
112
112
  }
113
113
 
114
- module.exports = {devtoolsPlugin};
114
+ function esbuildPlugin(outdir) {
115
+ return args => {
116
+ // args.importer is absolute path in esbuild.
117
+ const res = devtoolsPlugin(args.path, args.importer);
118
+ if (!res) {
119
+ return null;
120
+ }
121
+
122
+ if (res.external) {
123
+ // res.id can be both of absolutized local JavaScript path or node's
124
+ // builtin module (e.g. 'fs', 'path'), and only relativize the path in
125
+ // former case.
126
+ if (path.isAbsolute(res.id)) {
127
+ res.id = './' + path.relative(outdir, res.id);
128
+ }
129
+
130
+ return {
131
+ external: res.external,
132
+ path: res.id,
133
+ };
134
+ }
135
+
136
+ return {
137
+ path: res.id,
138
+ };
139
+ };
140
+ }
141
+
142
+ module.exports = {
143
+ devtoolsPlugin,
144
+ esbuildPlugin
145
+ };
@@ -21,30 +21,7 @@ const plugin = {
21
21
  name: 'devtools-plugin',
22
22
  setup(build) {
23
23
  // https://esbuild.github.io/plugins/#on-resolve
24
- build.onResolve({filter: /.*/}, args => {
25
- const res = devtools_plugin.devtoolsPlugin(args.path, args.importer);
26
- if (!res) {
27
- return null;
28
- }
29
-
30
- if (res.external) {
31
- // res.id can be both of absolutized local JavaScript path or node's
32
- // builtin module (e.g. 'fs', 'path'), and only relativize the path in
33
- // former case.
34
- if (path.isAbsolute(res.id)) {
35
- res.id = './' + path.relative(outdir, res.id);
36
- }
37
-
38
- return {
39
- external: res.external,
40
- path: res.id,
41
- };
42
- }
43
-
44
- return {
45
- path: res.id,
46
- };
47
- });
24
+ build.onResolve({filter: /.*/}, devtools_plugin.esbuildPlugin(outdir));
48
25
  },
49
26
  };
50
27
 
@@ -5,7 +5,7 @@
5
5
  const {assert} = require('chai');
6
6
  const path = require('path');
7
7
 
8
- const {devtoolsPlugin} = require('../devtools_plugin.js');
8
+ const {devtoolsPlugin, esbuildPlugin} = require('../devtools_plugin.js');
9
9
 
10
10
  describe('devtools_plugin can compute paths with', () => {
11
11
  it('same directory import', () => {
@@ -27,4 +27,63 @@ describe('devtools_plugin can compute paths with', () => {
27
27
  it('importing generated files', () => {
28
28
  assert.strictEqual(devtoolsPlugin('../../generated/Protocol.js', 'front_end/core/sdk/FirstFile.js'), null);
29
29
  });
30
+
31
+ it('importing lighthouse files', () => {
32
+ assert.deepEqual(
33
+ devtoolsPlugin('./front_end/third_party/lighthouse/lighthouse-dt-bundle.js', 'front_end/core/sdk/FirstFile.js'),
34
+ {
35
+ id: path.join(
36
+ 'front_end', 'core', 'sdk', 'front_end', 'third_party', 'lighthouse', 'lighthouse-dt-bundle.js'),
37
+ external: true,
38
+ });
39
+ });
40
+ });
41
+
42
+ describe('esbuild_plugin can compute paths with', () => {
43
+ const srcdir = __dirname;
44
+ const outdir = path.join(srcdir, 'out');
45
+ const plugin = esbuildPlugin(outdir);
46
+ it('same directory import', () => {
47
+ assert.deepEqual(
48
+ plugin({path: './AnotherFile.js', importer: path.join(srcdir, 'front_end/core/sdk/FirstFile.js')}),
49
+ {path: path.join(srcdir, 'front_end', 'core', 'sdk', 'AnotherFile.js')});
50
+ });
51
+
52
+ it('different directory import', () => {
53
+ assert.deepEqual(
54
+ plugin({path: '../common/common.js', importer: path.join(srcdir, 'front_end/core/sdk/FirstFile.js')}),
55
+ {path: './' + path.join('..', 'front_end', 'core', 'common', 'common.js'), external: true});
56
+ });
57
+
58
+ it('node built-in modules', () => {
59
+ assert.deepEqual(
60
+ plugin({path: 'fs', importer: path.join(srcdir, 'scripts/some-script.js')}), {path: 'fs', external: true});
61
+ });
62
+
63
+ it('codemirror modules', () => {
64
+ assert.deepEqual(
65
+ plugin({path: '../../lib/codemirror', importer: path.join(srcdir, 'scripts/some-script.js')}),
66
+ {path: '../../lib/codemirror', external: true});
67
+ });
68
+
69
+ it('importing generated files', () => {
70
+ assert.strictEqual(
71
+ plugin({path: '../../generated/Protocol.js', importer: path.join(srcdir, 'front_end/core/sdk/FirstFile.js')}),
72
+ null);
73
+ });
74
+
75
+ it('importing lighthouse files', () => {
76
+ assert.deepEqual(
77
+ plugin({
78
+ path: './front_end/third_party/lighthouse/lighthouse-dt-bundle.js',
79
+ importer: path.join(srcdir, 'front_end/core/sdk/FirstFile.js')
80
+ }),
81
+ {
82
+ path: './' +
83
+ path.join(
84
+ '..', 'front_end', 'core', 'sdk', 'front_end', 'third_party', 'lighthouse',
85
+ 'lighthouse-dt-bundle.js'),
86
+ external: true,
87
+ });
88
+ });
30
89
  });
@@ -34,16 +34,6 @@ const os = require('os');
34
34
  */
35
35
  const PATH_TO_EXECUTED_FILE = process.argv[1];
36
36
 
37
- function pathIsMostTopLevelPath(filePath) {
38
- /**
39
- * On Linux/Mac, if we do path.dirname(X) as many times as possible, it will
40
- * eventually equal `/`. On Windows, it will end up equalling C:\, and
41
- * path.dirname('C:\') === 'C:\', so we use that to figure out if we've made
42
- * it as far up the tree as we can.
43
- */
44
- return filePath === path.sep || path.dirname(filePath) === filePath;
45
- }
46
-
47
37
  const _lookUpCaches = new Map(
48
38
  [['chromium', null]],
49
39
  );
@@ -73,25 +63,7 @@ function isInChromiumDirectory() {
73
63
  * If it's standalone, it will be /path/to/devtools-frontend
74
64
  */
75
65
  function devtoolsRootPath() {
76
- const nodeScriptFileThatIsBeingExecuted = PATH_TO_EXECUTED_FILE;
77
- let devtoolsRootFolder = nodeScriptFileThatIsBeingExecuted;
78
- while (path.basename(devtoolsRootFolder) !== 'devtools-frontend') {
79
- devtoolsRootFolder = path.dirname(devtoolsRootFolder);
80
- // We reached the end and can't find devtools-frontend.
81
- if (pathIsMostTopLevelPath(devtoolsRootFolder)) {
82
- throw new Error(
83
- 'Could not find devtools-frontend in path. If you have cloned the repository to a different directory name, it will not work.');
84
- }
85
- }
86
- // In Chromium the path to the source code for devtools-frontend is:
87
- // third_party/devtools-frontend/src
88
- const {isInChromium} = isInChromiumDirectory();
89
- if (isInChromium) {
90
- return path.join(devtoolsRootFolder, 'src');
91
- }
92
-
93
- // But if you're in a standalone repo it's just the devtools-frontend folder.
94
- return devtoolsRootFolder;
66
+ return path.dirname(__dirname);
95
67
  }
96
68
 
97
69
  /**