chrome-devtools-frontend 1.0.1021582 → 1.0.1022475

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 (49) hide show
  1. package/.eslintignore +14 -1
  2. package/extension-api/ExtensionAPI.d.ts +54 -4
  3. package/front_end/.eslintrc.js +3 -1
  4. package/front_end/core/host/InspectorFrontendHostAPI.ts +1 -0
  5. package/front_end/core/host/UserMetrics.ts +18 -0
  6. package/front_end/core/i18n/locales/en-US.json +60 -0
  7. package/front_end/core/i18n/locales/en-XL.json +60 -0
  8. package/front_end/core/sdk/DebuggerModel.ts +10 -0
  9. package/front_end/devtools_compatibility.js +1 -0
  10. package/front_end/legacy_test_runner/sources_test_runner/DebuggerTestRunner.js +4 -3
  11. package/front_end/models/bindings/DebuggerLanguagePlugins.ts +166 -117
  12. package/front_end/models/bindings/ResourceScriptMapping.ts +12 -1
  13. package/front_end/models/extensions/ExtensionAPI.ts +101 -13
  14. package/front_end/models/extensions/ExtensionServer.ts +63 -1
  15. package/front_end/models/extensions/LanguageExtensionEndpoint.ts +16 -3
  16. package/front_end/models/issues_manager/RelatedIssue.ts +1 -1
  17. package/front_end/models/issues_manager/descriptions/federatedAuthRequestErrorIdToken.md +1 -1
  18. package/front_end/models/issues_manager/descriptions/federatedAuthRequestIdTokenInvalidRequest.md +1 -1
  19. package/front_end/models/issues_manager/descriptions/federatedAuthRequestIdTokenInvalidResponse.md +1 -1
  20. package/front_end/models/issues_manager/descriptions/federatedAuthRequestIdTokenNoResponse.md +1 -1
  21. package/front_end/models/timeline_model/TimelineModel.ts +164 -7
  22. package/front_end/panels/application/AppManifestView.ts +13 -2
  23. package/front_end/panels/application/ApplicationPanelSidebar.ts +67 -5
  24. package/front_end/panels/elements/ElementsTreeOutline.ts +41 -7
  25. package/front_end/panels/elements/TopLayerContainer.ts +9 -1
  26. package/front_end/panels/elements/components/AdornerManager.ts +7 -0
  27. package/front_end/panels/elements/elementsTreeOutline.css +4 -0
  28. package/front_end/panels/network/components/RequestHeadersView.css +55 -0
  29. package/front_end/panels/network/components/RequestHeadersView.ts +278 -14
  30. package/front_end/panels/sources/AddSourceMapURLDialog.ts +17 -3
  31. package/front_end/panels/sources/CallStackSidebarPane.ts +7 -0
  32. package/front_end/panels/sources/DebuggerPlugin.ts +29 -3
  33. package/front_end/panels/sources/ScopeChainSidebarPane.ts +8 -0
  34. package/front_end/panels/sources/SourcesPanel.ts +14 -0
  35. package/front_end/third_party/acorn/acorn.ts +1 -1
  36. package/front_end/third_party/chromium/client-variations/client-variations.ts +1 -1
  37. package/front_end/third_party/diff/DiffWrapper.ts +2 -0
  38. package/front_end/third_party/i18n/i18n-impl.ts +5 -1
  39. package/front_end/third_party/i18n/i18n.ts +1 -1
  40. package/front_end/third_party/i18n/locales.ts +1 -1
  41. package/front_end/third_party/marked/marked.ts +1 -1
  42. package/front_end/third_party/puppeteer/puppeteer.ts +6 -6
  43. package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorController.ts +23 -1
  44. package/front_end/ui/legacy/ReportView.ts +8 -0
  45. package/package.json +1 -1
  46. package/scripts/eslint_rules/lib/custom_element_definitions_location.js +29 -14
  47. package/scripts/eslint_rules/lib/es_modules_import.js +5 -1
  48. package/scripts/eslint_rules/tests/custom_element_definitions_location_test.js +14 -2
  49. package/scripts/eslint_rules/tests/es_modules_import_test.js +5 -0
@@ -99,6 +99,8 @@ export class ScopeChainSidebarPane extends UI.Widget.VBox implements UI.ContextF
99
99
  this.infoElement = document.createElement('div');
100
100
  this.infoElement.className = 'gray-info-message';
101
101
  this.infoElement.tabIndex = -1;
102
+ SDK.TargetManager.TargetManager.instance().addModelListener(
103
+ SDK.DebuggerModel.DebuggerModel, SDK.DebuggerModel.Events.DebugInfoAttached, this.debugInfoAttached, this);
102
104
  void this.update();
103
105
  }
104
106
 
@@ -151,6 +153,12 @@ export class ScopeChainSidebarPane extends UI.Widget.VBox implements UI.ContextF
151
153
  }
152
154
  }
153
155
 
156
+ private debugInfoAttached(event: Common.EventTarget.EventTargetEvent<SDK.Script.Script>): void {
157
+ if (event.data === this.#scopesScript) {
158
+ void this.update();
159
+ }
160
+ }
161
+
154
162
  private async update(): Promise<void> {
155
163
  // The `resolveThisObject(callFrame)` and `resolveScopeChain(callFrame)` calls
156
164
  // below may take a while to complete, so indicate to the user that something
@@ -314,6 +314,8 @@ export class SourcesPanel extends UI.Panel.Panel implements UI.ContextMenu.Provi
314
314
  SDK.DebuggerModel.DebuggerModel, SDK.DebuggerModel.Events.DebuggerWasEnabled, this.debuggerWasEnabled, this);
315
315
  SDK.TargetManager.TargetManager.instance().addModelListener(
316
316
  SDK.DebuggerModel.DebuggerModel, SDK.DebuggerModel.Events.DebuggerPaused, this.debuggerPaused, this);
317
+ SDK.TargetManager.TargetManager.instance().addModelListener(
318
+ SDK.DebuggerModel.DebuggerModel, SDK.DebuggerModel.Events.DebugInfoAttached, this.debugInfoAttached, this);
317
319
  SDK.TargetManager.TargetManager.instance().addModelListener(
318
320
  SDK.DebuggerModel.DebuggerModel, SDK.DebuggerModel.Events.DebuggerResumed,
319
321
  event => this.debuggerResumed(event.data));
@@ -474,6 +476,18 @@ export class SourcesPanel extends UI.Panel.Panel implements UI.ContextMenu.Provi
474
476
  }
475
477
  }
476
478
 
479
+ private debugInfoAttached(event: Common.EventTarget.EventTargetEvent<SDK.Script.Script>): void {
480
+ const {debuggerModel} = event.data;
481
+ if (!debuggerModel.isPaused()) {
482
+ return;
483
+ }
484
+
485
+ const details = debuggerModel.debuggerPausedDetails();
486
+ if (details && UI.Context.Context.instance().flavor(SDK.Target.Target) === debuggerModel.target()) {
487
+ this.showDebuggerPausedDetails(details);
488
+ }
489
+ }
490
+
477
491
  private showDebuggerPausedDetails(details: SDK.DebuggerModel.DebuggerPausedDetails): void {
478
492
  this.pausedInternal = true;
479
493
  void this.updateDebuggerButtonsAndStatus();
@@ -4,7 +4,7 @@
4
4
 
5
5
  import * as acorn from './package/dist/acorn.mjs';
6
6
 
7
- import type * as ESTree from './estree-legacy';
7
+ import type * as ESTree from './estree-legacy.js';
8
8
  export {ESTree};
9
9
 
10
10
  export { type Comment, defaultOptions, getLineInfo, isNewLine, lineBreak, lineBreakG, Node, SourceLocation, Token, tokTypes, tokContexts} from './package/dist/acorn.mjs';
@@ -2,4 +2,4 @@
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
- export * from './ClientVariations.js';
5
+ export * from './ClientVariations.js';
@@ -5,10 +5,12 @@
5
5
  import * as Common from '../../core/common/common.js';
6
6
 
7
7
  declare global {
8
+ /* eslint-disable @typescript-eslint/naming-convention */
8
9
  class diff_match_patch {
9
10
  diff_main(text1: string, text2: string): Array<{0: number, 1: string}>;
10
11
  diff_cleanupSemantic(diff: Array<{0: number, 1: string}>): void;
11
12
  }
13
+ /* eslint-enable @typescript-eslint/naming-convention */
12
14
  }
13
15
 
14
16
  export const DiffWrapper = {
@@ -15,8 +15,12 @@ export class I18n {
15
15
  readonly supportedLocales: ReadonlySet<Intl.UnicodeBCP47LocaleIdentifier>;
16
16
 
17
17
  private localeData = new Map<Intl.UnicodeBCP47LocaleIdentifier, LocalizedMessages>();
18
+ readonly defaultLocale;
19
+
20
+ constructor(
21
+ supportedLocales: readonly Intl.UnicodeBCP47LocaleIdentifier[] = LOCALES, defaultLocale = DEFAULT_LOCALE) {
22
+ this.defaultLocale = defaultLocale;
18
23
 
19
- constructor(supportedLocales: ReadonlyArray<Intl.UnicodeBCP47LocaleIdentifier> = LOCALES, public readonly defaultLocale = DEFAULT_LOCALE) {
20
24
  this.supportedLocales = new Set(supportedLocales);
21
25
  }
22
26
 
@@ -8,4 +8,4 @@ import * as LocalizedStringSet from './localized-string-set.js';
8
8
  export {
9
9
  I18n,
10
10
  LocalizedStringSet,
11
- }
11
+ };
@@ -2,7 +2,7 @@
2
2
  // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
3
3
  // Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
4
4
 
5
- export const LOCALES: ReadonlyArray<Intl.UnicodeBCP47LocaleIdentifier> = [
5
+ export const LOCALES: readonly Intl.UnicodeBCP47LocaleIdentifier[] = [
6
6
  'af',
7
7
  'am',
8
8
  'ar',
@@ -1,3 +1,3 @@
1
1
  import {marked as Marked} from './package/lib/marked.esm.js';
2
2
 
3
- export {Marked}
3
+ export {Marked};
@@ -2,11 +2,11 @@
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
- import { Browser } from "./package/lib/esm/puppeteer/common/Browser.js";
6
- import { Connection } from "./package/lib/esm/puppeteer/common/Connection.js";
7
- import { type ConnectionTransport } from "./package/lib/esm/puppeteer/common/ConnectionTransport.js";
8
- import { Frame } from "./package/lib/esm/puppeteer/common/FrameManager.js";
9
- import { ElementHandle } from "./package/lib/esm/puppeteer/common/ElementHandle";
10
- import { Page } from "./package/lib/esm/puppeteer/common/Page.js";
5
+ import { Browser } from './package/lib/esm/puppeteer/common/Browser.js';
6
+ import { Connection } from './package/lib/esm/puppeteer/common/Connection.js';
7
+ import { type ConnectionTransport } from './package/lib/esm/puppeteer/common/ConnectionTransport.js';
8
+ import { Frame } from './package/lib/esm/puppeteer/common/FrameManager.js';
9
+ import { ElementHandle } from './package/lib/esm/puppeteer/common/ElementHandle.js';
10
+ import { Page } from './package/lib/esm/puppeteer/common/Page.js';
11
11
 
12
12
  export { Browser, Connection, ConnectionTransport, ElementHandle, Frame, Page };
@@ -79,7 +79,13 @@ async function getBufferFromObject(obj: SDK.RemoteObject.RemoteObject): Promise<
79
79
  }
80
80
 
81
81
  export function isDWARFMemoryObject(obj: SDK.RemoteObject.RemoteObject): boolean {
82
- return obj instanceof Bindings.DebuggerLanguagePlugins.ValueNode && obj.inspectableAddress !== undefined;
82
+ if (obj instanceof Bindings.DebuggerLanguagePlugins.ValueNode) {
83
+ return obj.inspectableAddress !== undefined;
84
+ }
85
+ if (obj instanceof Bindings.DebuggerLanguagePlugins.ExtensionRemoteObject) {
86
+ return obj.linearMemoryAddress !== undefined;
87
+ }
88
+ return false;
83
89
  }
84
90
 
85
91
  export function isMemoryObjectProperty(obj: SDK.RemoteObject.RemoteObject): boolean {
@@ -169,6 +175,22 @@ export class LinearMemoryInspectorController extends SDK.TargetManager.SDKModelO
169
175
 
170
176
  static async retrieveDWARFMemoryObjectAndAddress(obj: SDK.RemoteObject.RemoteObject):
171
177
  Promise<{obj: SDK.RemoteObject.RemoteObject, address: number}|undefined> {
178
+ if (obj instanceof Bindings.DebuggerLanguagePlugins.ExtensionRemoteObject) {
179
+ const valueNode = obj;
180
+ const address = valueNode.linearMemoryAddress || 0;
181
+ const callFrame = valueNode.callFrame;
182
+ const response = await obj.debuggerModel().agent.invoke_evaluateOnCallFrame({
183
+ callFrameId: callFrame.id,
184
+ expression: 'memories[0]',
185
+ });
186
+ const error = response.getError();
187
+ if (error) {
188
+ console.error(error);
189
+ Common.Console.Console.instance().error(i18nString(UIStrings.couldNotOpenLinearMemory));
190
+ }
191
+ const runtimeModel = obj.debuggerModel().runtimeModel();
192
+ return {obj: runtimeModel.createRemoteObject(response.result), address};
193
+ }
172
194
  if (!(obj instanceof Bindings.DebuggerLanguagePlugins.ValueNode)) {
173
195
  return;
174
196
  }
@@ -36,6 +36,10 @@ export class ReportView extends VBox {
36
36
  this.sectionList = this.contentBox.createChild('div', 'vbox');
37
37
  }
38
38
 
39
+ getHeaderElement(): Element {
40
+ return this.headerElement;
41
+ }
42
+
39
43
  setTitle(title: string): void {
40
44
  if (this.titleElement.textContent === title) {
41
45
  return;
@@ -122,6 +126,10 @@ export class Section extends VBox {
122
126
  return this.titleElement.textContent || '';
123
127
  }
124
128
 
129
+ getTitleElement(): Element {
130
+ return this.titleElement;
131
+ }
132
+
125
133
  setTitle(title: string, tooltip?: string): void {
126
134
  if (this.titleElement.textContent !== title) {
127
135
  this.titleElement.textContent = title;
package/package.json CHANGED
@@ -55,5 +55,5 @@
55
55
  "unittest": "scripts/test/run_unittests.py --no-text-coverage",
56
56
  "watch": "vpython third_party/node/node.py --output scripts/watch_build.js"
57
57
  },
58
- "version": "1.0.1021582"
58
+ "version": "1.0.1022475"
59
59
  }
@@ -5,18 +5,6 @@
5
5
 
6
6
  const path = require('path');
7
7
 
8
- const FRONT_END_DIRECTORY = path.join(__dirname, '..', '..', '..', 'front_end');
9
- const PANELS_DIRECTORY = path.join(FRONT_END_DIRECTORY, 'panels');
10
-
11
- const ALLOWED_CUSTOM_ELEMENT_LOCATIONS = new Set([
12
- path.join(FRONT_END_DIRECTORY, 'ui', 'components'),
13
-
14
- // These should be moved to `ui/components` at some point
15
- path.join(FRONT_END_DIRECTORY, 'ui', 'legacy', 'components', 'inline_editor'),
16
- path.join(FRONT_END_DIRECTORY, 'ui', 'legacy', 'components', 'perf_ui', 'PieChart.ts'),
17
- path.join(FRONT_END_DIRECTORY, 'ui', 'legacy', 'XElement.ts'),
18
- ]);
19
-
20
8
  module.exports = {
21
9
  meta: {
22
10
  type: 'problem',
@@ -32,11 +20,38 @@ module.exports = {
32
20
  'either place it in `ui/components/` or in a `components` sub-folder of a panel. ' +
33
21
  'E.g. `panels/elements/components/`.'
34
22
  },
35
- schema: [] // no options
23
+ schema: [{
24
+ 'type': 'object',
25
+ 'properties': {
26
+ 'rootFrontendDirectory': {
27
+ 'type': 'string',
28
+ },
29
+ },
30
+ additionalProperties: false,
31
+ }]
36
32
  },
37
33
  create: function(context) {
38
34
  const classDefiningFileName = path.resolve(context.getFilename());
39
35
 
36
+ let frontEndDirectory = '';
37
+ if (context.options?.[0]?.rootFrontendDirectory) {
38
+ frontEndDirectory = context.options[0].rootFrontendDirectory;
39
+ }
40
+ if (!frontEndDirectory) {
41
+ throw new Error('rootFrontEndDirectory must be provided to custom_elements_definitions_location.');
42
+ }
43
+
44
+ const PANELS_DIRECTORY = path.join(frontEndDirectory, 'panels');
45
+
46
+ const ALLOWED_CUSTOM_ELEMENT_LOCATIONS = new Set([
47
+ path.join(frontEndDirectory, 'ui', 'components'),
48
+
49
+ // These should be moved to `ui/components` at some point
50
+ path.join(frontEndDirectory, 'ui', 'legacy', 'components', 'inline_editor'),
51
+ path.join(frontEndDirectory, 'ui', 'legacy', 'components', 'perf_ui', 'PieChart.ts'),
52
+ path.join(frontEndDirectory, 'ui', 'legacy', 'XElement.ts'),
53
+ ]);
54
+
40
55
  return {
41
56
  ['ClassDeclaration[superClass.name=\'HTMLElement\']'](node) {
42
57
  for (const allowedLocation of ALLOWED_CUSTOM_ELEMENT_LOCATIONS) {
@@ -49,7 +64,7 @@ module.exports = {
49
64
  const filePathWithPanelName = classDefiningFileName.substring(PANELS_DIRECTORY.length + 1);
50
65
  const filePathWithoutPanelName = filePathWithPanelName.substring(filePathWithPanelName.indexOf(path.sep) + 1);
51
66
 
52
- if (filePathWithoutPanelName.startsWith('components' + path.sep)) {
67
+ if (filePathWithoutPanelName.includes(`components${path.sep}`)) {
53
68
  return;
54
69
  }
55
70
  }
@@ -11,6 +11,7 @@
11
11
  const path = require('path');
12
12
 
13
13
  const FRONT_END_DIRECTORY = path.join(__dirname, '..', '..', '..', 'front_end');
14
+ const THIRD_PARTY_DIRECTORY = path.join(FRONT_END_DIRECTORY, 'third_party');
14
15
  const INSPECTOR_OVERLAY_DIRECTORY = path.join(__dirname, '..', '..', '..', 'front_end', 'inspector_overlay');
15
16
  const COMPONENT_DOCS_DIRECTORY = path.join(FRONT_END_DIRECTORY, 'ui', 'components', 'docs');
16
17
 
@@ -164,7 +165,10 @@ module.exports = {
164
165
  });
165
166
  }
166
167
 
167
- if (importingFileName.startsWith(INSPECTOR_OVERLAY_DIRECTORY)) {
168
+ // the Module import rules do not apply within:
169
+ // 1. inspector_overlay
170
+ // 2. front_end/third_party
171
+ if (importingFileName.startsWith(INSPECTOR_OVERLAY_DIRECTORY) || importingFileName.startsWith(THIRD_PARTY_DIRECTORY)) {
168
172
  return;
169
173
  }
170
174
 
@@ -4,6 +4,7 @@
4
4
  'use strict';
5
5
 
6
6
  const rule = require('../lib/custom_element_definitions_location.js');
7
+ const path = require('path');
7
8
  const ruleTester = new (require('eslint').RuleTester)({
8
9
  parserOptions: {ecmaVersion: 9, sourceType: 'module'},
9
10
  parser: require.resolve('@typescript-eslint/parser'),
@@ -14,30 +15,41 @@ ruleTester.run('custom_element_definitions_location', rule, {
14
15
  {
15
16
  code: 'class Foo extends HTMLElement {}',
16
17
  filename: 'front_end/ui/components/foo/Foo.ts',
18
+ options: [{rootFrontendDirectory: path.join(__dirname, '..', '..', '..', 'front_end')}]
17
19
  },
18
20
  {
19
21
  code: 'class Foo extends HTMLElement {}',
20
22
  filename: 'front_end/panels/issues/components/Foo.ts',
23
+ options: [{rootFrontendDirectory: path.join(__dirname, '..', '..', '..', 'front_end')}]
21
24
  },
22
25
  {
23
26
  code: 'class Foo extends HTMLElement {}',
24
27
  filename: 'front_end/panels/issues/components/nested/folder/Foo.ts',
28
+ options: [{rootFrontendDirectory: path.join(__dirname, '..', '..', '..', 'front_end')}]
29
+ },
30
+ {
31
+ code: 'class Foo extends HTMLElement {}',
32
+ filename: 'front_end/panels/performance/library/components/metrics/Metric.ts',
33
+ options: [{rootFrontendDirectory: path.join(__dirname, '..', '..', '..', 'front_end')}]
25
34
  },
26
35
  {
27
36
  code: 'class Foo extends OtherClass {}',
28
37
  filename: 'front_end/models/some/Model.ts',
38
+ options: [{rootFrontendDirectory: path.join(__dirname, '..', '..', '..', 'front_end')}]
29
39
  },
30
40
  ],
31
41
  invalid: [
32
42
  {
33
43
  code: 'class Foo extends HTMLElement {}',
34
44
  filename: 'front_end/panels/issues/IssuesPanel.ts',
35
- errors: [{messageId: 'definitionInWrongFolder'}]
45
+ errors: [{messageId: 'definitionInWrongFolder'}],
46
+ options: [{rootFrontendDirectory: path.join(__dirname, '..', '..', '..', 'front_end')}]
36
47
  },
37
48
  {
38
49
  code: 'class Foo extends HTMLElement {}',
39
50
  filename: 'front_end/models/bindings/Bindings.ts',
40
- errors: [{messageId: 'definitionInWrongFolder'}]
51
+ errors: [{messageId: 'definitionInWrongFolder'}],
52
+ options: [{rootFrontendDirectory: path.join(__dirname, '..', '..', '..', 'front_end')}]
41
53
  },
42
54
  ]
43
55
  });
@@ -127,6 +127,11 @@ ruleTester.run('es_modules_import', rule, {
127
127
  {
128
128
  code: 'import checkboxStyles from \'./checkbox.css.js\';',
129
129
  filename: 'front_end/ui/components/input/input.ts',
130
+ },
131
+ {
132
+ // Valid even though it breaks the rules, because it's in front_end/third_party.
133
+ code: 'import { Browser } from "./package/lib/esm/puppeteer/common/Browser.js";',
134
+ filename: 'front_end/third_party/puppeteer/puppeteer.ts',
130
135
  }
131
136
  ],
132
137