chrome-devtools-frontend 1.0.998787 → 1.0.1000057

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 (76) hide show
  1. package/.clang-format +1 -0
  2. package/front_end/.eslintrc.js +4 -4
  3. package/front_end/core/common/Color.ts +9 -1
  4. package/front_end/core/common/Object.ts +2 -1
  5. package/front_end/core/common/ParsedURL.ts +3 -3
  6. package/front_end/core/common/Settings.ts +13 -1
  7. package/front_end/core/dom_extension/DOMExtension.ts +0 -10
  8. package/front_end/core/host/InspectorFrontendHost.ts +4 -1
  9. package/front_end/core/i18n/locales/en-US.json +4 -10
  10. package/front_end/core/i18n/locales/en-XL.json +4 -10
  11. package/front_end/core/sdk/CSSProperty.ts +6 -7
  12. package/front_end/core/sdk/ChildTargetManager.ts +0 -3
  13. package/front_end/core/sdk/ConsoleModel.ts +2 -1
  14. package/front_end/core/sdk/NetworkManager.ts +3 -1
  15. package/front_end/core/sdk/RuntimeModel.ts +7 -1
  16. package/front_end/core/sdk/SourceMapManager.ts +10 -1
  17. package/front_end/entrypoints/formatter_worker/FormatterWorker.ts +5 -1
  18. package/front_end/legacy/legacy-defs.d.ts +2 -2
  19. package/front_end/models/formatter/ScriptFormatter.ts +3 -1
  20. package/front_end/models/issues_manager/DeprecationIssue.ts +1 -1
  21. package/front_end/models/issues_manager/SourceFrameIssuesManager.ts +5 -1
  22. package/front_end/models/text_utils/CodeMirrorUtils.ts +14 -17
  23. package/front_end/models/timeline_model/TimelineModel.ts +1 -1
  24. package/front_end/models/workspace/WorkspaceImpl.ts +1 -1
  25. package/front_end/panels/application/IndexedDBViews.ts +5 -2
  26. package/front_end/panels/console/ConsoleView.ts +9 -1
  27. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +3 -1
  28. package/front_end/panels/elements/PropertiesWidget.ts +0 -1
  29. package/front_end/panels/elements/StylesSidebarPane.ts +7 -1
  30. package/front_end/panels/lighthouse/LighthouseController.ts +15 -0
  31. package/front_end/panels/lighthouse/LighthousePanel.ts +2 -1
  32. package/front_end/panels/lighthouse/LighthouseTimespanView.ts +9 -2
  33. package/front_end/panels/lighthouse/lighthouseDialog.css +5 -0
  34. package/front_end/panels/mobile_throttling/ThrottlingManager.ts +3 -1
  35. package/front_end/panels/network/NetworkLogView.ts +5 -1
  36. package/front_end/panels/network/NetworkLogViewColumns.ts +3 -1
  37. package/front_end/panels/network/RequestTimingView.ts +1 -1
  38. package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +8 -1
  39. package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +3 -1
  40. package/front_end/panels/profiler/HeapSnapshotView.ts +14 -2
  41. package/front_end/panels/sources/AddSourceMapURLDialog.ts +5 -4
  42. package/front_end/panels/sources/DebuggerPausedMessage.ts +2 -1
  43. package/front_end/panels/sources/DebuggerPlugin.ts +2 -2
  44. package/front_end/panels/sources/EditingLocationHistoryManager.ts +2 -4
  45. package/front_end/panels/sources/NavigatorView.ts +4 -5
  46. package/front_end/panels/sources/ScriptFormatterEditorAction.ts +2 -1
  47. package/front_end/panels/sources/SourcesPanel.ts +7 -1
  48. package/front_end/panels/sources/TabbedEditorContainer.ts +14 -13
  49. package/front_end/panels/timeline/TimelineController.ts +1 -1
  50. package/front_end/panels/timeline/TimelineEventOverview.ts +0 -60
  51. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +1 -9
  52. package/front_end/panels/timeline/TimelineFlameChartView.ts +4 -1
  53. package/front_end/panels/timeline/TimelineHistoryManager.ts +5 -2
  54. package/front_end/panels/timeline/TimelinePanel.ts +9 -2
  55. package/front_end/panels/timeline/TimelineUIUtils.ts +0 -6
  56. package/front_end/panels/timeline/timeline-legacy.ts +0 -3
  57. package/front_end/panels/timeline/timelinePanel.css +0 -6
  58. package/front_end/panels/web_audio/graph_visualizer/GraphView.ts +3 -1
  59. package/front_end/panels/web_audio/graph_visualizer/NodeRendererUtility.ts +8 -1
  60. package/front_end/panels/web_audio/graph_visualizer/NodeView.ts +13 -1
  61. package/front_end/panels/web_audio/web_audio.ts +8 -1
  62. package/front_end/ui/components/buttons/button.css +16 -3
  63. package/front_end/ui/components/data_grid/DataGrid.ts +9 -1
  64. package/front_end/ui/components/docs/button/basic.ts +10 -0
  65. package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspector.ts +11 -3
  66. package/front_end/ui/components/linear_memory_inspector/ValueInterpreterDisplay.ts +12 -1
  67. package/front_end/ui/components/tree_outline/TreeOutline.ts +16 -11
  68. package/front_end/ui/legacy/Fragment.ts +2 -2
  69. package/front_end/ui/legacy/ViewManager.ts +12 -1
  70. package/front_end/ui/legacy/XLink.ts +6 -1
  71. package/front_end/ui/legacy/components/inline_editor/CSSAngle.ts +8 -1
  72. package/front_end/ui/legacy/components/inline_editor/CSSAngleEditor.ts +7 -1
  73. package/package.json +1 -1
  74. package/scripts/eslint_rules/lib/enforce_bound_render_for_schedule_render.js +110 -0
  75. package/scripts/eslint_rules/tests/enforce_bound_render_for_schedule_render_test.js +74 -0
  76. package/scripts/reformat-clang-js-ts.js +60 -0
package/.clang-format CHANGED
@@ -7,3 +7,4 @@ CommentPragmas: .*\@.*
7
7
  AllowShortBlocksOnASingleLine: false
8
8
  AllowShortFunctionsOnASingleLine: None
9
9
  ReflowComments: false
10
+ JavaScriptWrapImports: true
@@ -2,6 +2,7 @@
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
+ // clang-format off
5
6
  const path = require('path');
6
7
  const rulesDirPlugin = require('eslint-plugin-rulesdir');
7
8
  rulesDirPlugin.RULES_DIR = path.join(__dirname, '..', 'scripts', 'eslint_rules', 'lib');
@@ -28,6 +29,7 @@ module.exports = {
28
29
  'rules': {
29
30
  '@typescript-eslint/explicit-function-return-type': 2,
30
31
  'rulesdir/no_importing_images_from_src': 2,
32
+ 'rulesdir/enforce_bound_render_for_schedule_render': 2,
31
33
  'rulesdir/enforce_custom_event_names': 2,
32
34
  'rulesdir/set_data_type_reference': 2,
33
35
  'rulesdir/no_bound_component_methods': 2,
@@ -120,10 +122,7 @@ module.exports = {
120
122
  },
121
123
  {
122
124
  // Ignore type properties that require quotes
123
- 'selector': [
124
- 'typeProperty',
125
- 'enumMember'
126
- ],
125
+ 'selector': ['typeProperty', 'enumMember'],
127
126
  'format': null,
128
127
  'modifiers': ['requiresQuotes']
129
128
  }
@@ -150,3 +149,4 @@ module.exports = {
150
149
  }
151
150
  ]
152
151
  };
152
+ // clang-format on
@@ -33,7 +33,15 @@
33
33
 
34
34
  import * as Platform from '../platform/platform.js';
35
35
 
36
- import {blendColors, contrastRatioAPCA, desiredLuminanceAPCA, luminance, luminanceAPCA, rgbaToHsla, rgbaToHwba} from './ColorUtils.js';
36
+ import {
37
+ blendColors,
38
+ contrastRatioAPCA,
39
+ desiredLuminanceAPCA,
40
+ luminance,
41
+ luminanceAPCA,
42
+ rgbaToHsla,
43
+ rgbaToHwba,
44
+ } from './ColorUtils.js';
37
45
 
38
46
  export class Color {
39
47
  #hslaInternal: number[]|undefined;
@@ -28,7 +28,8 @@
28
28
  */
29
29
 
30
30
  import type * as Platform from '../platform/platform.js';
31
- import type {EventDescriptor, EventListener, EventTarget, EventTargetEvent, EventPayloadToRestParameters} from './EventTarget.js';
31
+ import type {
32
+ EventDescriptor, EventListener, EventTarget, EventTargetEvent, EventPayloadToRestParameters} from './EventTarget.js';
32
33
 
33
34
  export interface ListenerCallbackTuple<Events, T extends keyof Events> {
34
35
  thisObject?: Object;
@@ -153,10 +153,10 @@ export class ParsedURL {
153
153
  return null;
154
154
  }
155
155
 
156
- private static preEncodeSpecialCharactersInPath(path: string): string {
156
+ static preEncodeSpecialCharactersInPath(path: string): string {
157
157
  // Based on net::FilePathToFileURL. Ideally we would handle
158
158
  // '\\' as well on non-Windows file systems.
159
- for (const specialChar of ['%', ';', '#', '?']) {
159
+ for (const specialChar of ['%', ';', '#', '?', ' ']) {
160
160
  (path as string) = path.replaceAll(specialChar, encodeURIComponent(specialChar));
161
161
  }
162
162
  return path;
@@ -185,7 +185,7 @@ export class ParsedURL {
185
185
  */
186
186
  static urlFromParentUrlAndName(parentUrl: Platform.DevToolsPath.UrlString, name: string):
187
187
  Platform.DevToolsPath.UrlString {
188
- return ParsedURL.concatenate(parentUrl, '/', encodeURIComponent(name));
188
+ return ParsedURL.concatenate(parentUrl, '/', ParsedURL.preEncodeSpecialCharactersInPath(name));
189
189
  }
190
190
 
191
191
  static encodedPathToRawPathString(encPath: Platform.DevToolsPath.EncodedPathString):
@@ -36,7 +36,19 @@ import {Format} from './Color.js';
36
36
  import {Console} from './Console.js';
37
37
  import type {GenericEvents, EventDescriptor, EventTargetEvent} from './EventTarget.js';
38
38
  import {ObjectWrapper} from './Object.js';
39
- import {getLocalizedSettingsCategory, getRegisteredSettings, maybeRemoveSettingExtension, type RegExpSettingItem, registerSettingExtension, registerSettingsForTest, resetSettings, SettingCategory, type SettingExtensionOption, type SettingRegistration, SettingType} from './SettingRegistration.js';
39
+ import {
40
+ getLocalizedSettingsCategory,
41
+ getRegisteredSettings,
42
+ maybeRemoveSettingExtension,
43
+ type RegExpSettingItem,
44
+ registerSettingExtension,
45
+ registerSettingsForTest,
46
+ resetSettings,
47
+ SettingCategory,
48
+ type SettingExtensionOption,
49
+ type SettingRegistration,
50
+ SettingType,
51
+ } from './SettingRegistration.js';
40
52
 
41
53
  let settingsInstance: Settings|undefined;
42
54
 
@@ -532,16 +532,6 @@ Node.prototype.setTextContentTruncatedIfNeeded = function(text: string|Node, pla
532
532
  return false;
533
533
  };
534
534
 
535
- Document.prototype.deepActiveElement = function(): Element|null {
536
- let activeElement: Element|(Element | null) = this.activeElement;
537
- while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement) {
538
- activeElement = activeElement.shadowRoot.activeElement;
539
- }
540
- return activeElement;
541
- };
542
-
543
- DocumentFragment.prototype.deepActiveElement = Document.prototype.deepActiveElement;
544
-
545
535
  Element.prototype.hasFocus = function(): boolean {
546
536
  const root = this.getComponentRoot();
547
537
  return Boolean(root) && this.isSelfOrAncestor(root.activeElement);
@@ -36,7 +36,10 @@ import * as i18n from '../i18n/i18n.js';
36
36
  import * as Platform from '../platform/platform.js';
37
37
  import * as Root from '../root/root.js';
38
38
 
39
- import type {CanShowSurveyResult, ContextMenuDescriptor, EnumeratedHistogram, EventTypes, ExtensionDescriptor, InspectorFrontendHostAPI, LoadNetworkResourceResult, ShowSurveyResult, SyncInformation} from './InspectorFrontendHostAPI.js';
39
+ import type {
40
+ CanShowSurveyResult, ContextMenuDescriptor, EnumeratedHistogram, EventTypes, ExtensionDescriptor,
41
+ InspectorFrontendHostAPI, LoadNetworkResourceResult, ShowSurveyResult,
42
+ SyncInformation} from './InspectorFrontendHostAPI.js';
40
43
  import {EventDescriptors, Events} from './InspectorFrontendHostAPI.js';
41
44
  import {streamWrite as resourceLoaderStreamWrite} from './ResourceLoader.js';
42
45
 
@@ -5822,6 +5822,9 @@
5822
5822
  "panels/lighthouse/LighthouseController.ts | isThisPageUsableByPeopleWith": {
5823
5823
  "message": "Is this page usable by people with disabilities or impairments"
5824
5824
  },
5825
+ "panels/lighthouse/LighthouseController.ts | javaScriptDisabled": {
5826
+ "message": "JavaScript is disabled. You need to enable JavaScript to audit this page. Open the Command Menu and run the Enable JavaScript command to enable JavaScript."
5827
+ },
5825
5828
  "panels/lighthouse/LighthouseController.ts | legacyNavigation": {
5826
5829
  "message": "Legacy navigation"
5827
5830
  },
@@ -7482,7 +7485,7 @@
7482
7485
  "message": "Unknown"
7483
7486
  },
7484
7487
  "panels/network/RequestTimingView.ts | waitingTtfb": {
7485
- "message": "Waiting (TTFB)"
7488
+ "message": "Waiting for server response"
7486
7489
  },
7487
7490
  "panels/network/RequestTimingView.ts | waterfall": {
7488
7491
  "message": "Waterfall"
@@ -10238,9 +10241,6 @@
10238
10241
  "panels/timeline/TimelineEventOverview.ts | cpu": {
10239
10242
  "message": "CPU"
10240
10243
  },
10241
- "panels/timeline/TimelineEventOverview.ts | fps": {
10242
- "message": "FPS"
10243
- },
10244
10244
  "panels/timeline/TimelineEventOverview.ts | heap": {
10245
10245
  "message": "HEAP"
10246
10246
  },
@@ -10307,9 +10307,6 @@
10307
10307
  "panels/timeline/TimelineFlameChartDataProvider.ts | rasterizerThreadS": {
10308
10308
  "message": "Rasterizer Thread {PH1}"
10309
10309
  },
10310
- "panels/timeline/TimelineFlameChartDataProvider.ts | sFfps": {
10311
- "message": "{PH1} ~ {PH2} fps"
10312
- },
10313
10310
  "panels/timeline/TimelineFlameChartDataProvider.ts | sSelfS": {
10314
10311
  "message": "{PH1} (self {PH2})"
10315
10312
  },
@@ -10823,9 +10820,6 @@
10823
10820
  "panels/timeline/TimelineUIUtils.ts | forcedReflow": {
10824
10821
  "message": "Forced reflow"
10825
10822
  },
10826
- "panels/timeline/TimelineUIUtils.ts | fps": {
10827
- "message": "FPS"
10828
- },
10829
10823
  "panels/timeline/TimelineUIUtils.ts | frame": {
10830
10824
  "message": "Frame"
10831
10825
  },
@@ -5822,6 +5822,9 @@
5822
5822
  "panels/lighthouse/LighthouseController.ts | isThisPageUsableByPeopleWith": {
5823
5823
  "message": "Îś t̂h́îś p̂áĝé ûśâb́l̂é b̂ý p̂éôṕl̂é ŵít̂h́ d̂íŝáb̂íl̂ít̂íêś ôŕ îḿp̂áîŕm̂én̂t́ŝ"
5824
5824
  },
5825
+ "panels/lighthouse/LighthouseController.ts | javaScriptDisabled": {
5826
+ "message": "Ĵáv̂áŜćr̂íp̂t́ îś d̂íŝáb̂ĺêd́. Ŷóû ńêéd̂ t́ô én̂áb̂ĺê J́âv́âŚĉŕîṕt̂ t́ô áûd́ît́ t̂h́îś p̂áĝé. Ôṕêń t̂h́ê Ćôḿm̂án̂d́ M̂én̂ú âńd̂ ŕûń t̂h́ê Én̂áb̂ĺê J́âv́âŚĉŕîṕt̂ ćôḿm̂án̂d́ t̂ó êńâb́l̂é Ĵáv̂áŜćr̂íp̂t́."
5827
+ },
5825
5828
  "panels/lighthouse/LighthouseController.ts | legacyNavigation": {
5826
5829
  "message": "L̂éĝáĉý n̂áv̂íĝát̂íôń"
5827
5830
  },
@@ -7482,7 +7485,7 @@
7482
7485
  "message": "Ûńk̂ńôẃn̂"
7483
7486
  },
7484
7487
  "panels/network/RequestTimingView.ts | waitingTtfb": {
7485
- "message": "Ŵáît́îńĝ (T́T̂F́B̂)"
7488
+ "message": "Ŵáît́îńĝ f́ôŕ ŝér̂v́êŕ r̂éŝṕôńŝé"
7486
7489
  },
7487
7490
  "panels/network/RequestTimingView.ts | waterfall": {
7488
7491
  "message": "Ŵát̂ér̂f́âĺl̂"
@@ -10238,9 +10241,6 @@
10238
10241
  "panels/timeline/TimelineEventOverview.ts | cpu": {
10239
10242
  "message": "ĈṔÛ"
10240
10243
  },
10241
- "panels/timeline/TimelineEventOverview.ts | fps": {
10242
- "message": "F̂ṔŜ"
10243
- },
10244
10244
  "panels/timeline/TimelineEventOverview.ts | heap": {
10245
10245
  "message": "ĤÉÂṔ"
10246
10246
  },
@@ -10307,9 +10307,6 @@
10307
10307
  "panels/timeline/TimelineFlameChartDataProvider.ts | rasterizerThreadS": {
10308
10308
  "message": "R̂áŝt́êŕîźêŕ T̂h́r̂éâd́ {PH1}"
10309
10309
  },
10310
- "panels/timeline/TimelineFlameChartDataProvider.ts | sFfps": {
10311
- "message": "{PH1} ~ {PH2} f̂ṕŝ"
10312
- },
10313
10310
  "panels/timeline/TimelineFlameChartDataProvider.ts | sSelfS": {
10314
10311
  "message": "{PH1} (ŝél̂f́ {PH2})"
10315
10312
  },
@@ -10823,9 +10820,6 @@
10823
10820
  "panels/timeline/TimelineUIUtils.ts | forcedReflow": {
10824
10821
  "message": "F̂ór̂ćêd́ r̂éf̂ĺôẃ"
10825
10822
  },
10826
- "panels/timeline/TimelineUIUtils.ts | fps": {
10827
- "message": "F̂ṔŜ"
10828
- },
10829
10823
  "panels/timeline/TimelineUIUtils.ts | frame": {
10830
10824
  "message": "F̂ŕâḿê"
10831
10825
  },
@@ -163,8 +163,8 @@ export class CSSProperty {
163
163
 
164
164
  const range = this.range.relativeTo(this.ownerStyle.range.startLine, this.ownerStyle.range.startColumn);
165
165
  const indentation = this.ownerStyle.cssText ?
166
- this.detectIndentation(this.ownerStyle.cssText) :
167
- Common.Settings.Settings.instance().moduleSetting('textEditorIndent').get();
166
+ this.detectIndentation(this.ownerStyle.cssText) :
167
+ Common.Settings.Settings.instance().moduleSetting('textEditorIndent').get();
168
168
  const endIndentation = this.ownerStyle.cssText ? indentation.substring(0, this.ownerStyle.range.endColumn) : '';
169
169
  const text = new TextUtils.Text.Text(this.ownerStyle.cssText || '');
170
170
  const newStyleText = text.replaceRange(range, Platform.StringUtilities.sprintf(';%s;', propertyText));
@@ -172,8 +172,7 @@ export class CSSProperty {
172
172
  return this.ownerStyle.setText(styleText, majorChange);
173
173
  }
174
174
 
175
- static async formatStyle(
176
- styleText: string, indentation: string, endIndentation: string): Promise<string> {
175
+ static async formatStyle(styleText: string, indentation: string, endIndentation: string): Promise<string> {
177
176
  const doubleIndent = indentation.substring(endIndentation.length) + indentation;
178
177
  if (indentation) {
179
178
  indentation = '\n' + indentation;
@@ -197,7 +196,7 @@ export class CSSProperty {
197
196
  const disabledProperty = tokenType?.includes('comment') && isDisabledProperty(token);
198
197
  const isPropertyStart =
199
198
  (tokenType?.includes('string') || tokenType?.includes('meta') || tokenType?.includes('property') ||
200
- tokenType?.includes('variableName'));
199
+ tokenType?.includes('variableName'));
201
200
  if (disabledProperty) {
202
201
  result = result.trimEnd() + indentation + token;
203
202
  } else if (isPropertyStart) {
@@ -222,8 +221,8 @@ export class CSSProperty {
222
221
  // implementation takes special care to restore a single
223
222
  // whitespace token in this edge case. https://crbug.com/1071296
224
223
  const trimmedPropertyText = propertyText.trim();
225
- result =
226
- result.trimEnd() + indentation + trimmedPropertyText + (trimmedPropertyText.endsWith(':') ? ' ' : '') + token;
224
+ result = result.trimEnd() + indentation + trimmedPropertyText + (trimmedPropertyText.endsWith(':') ? ' ' : '') +
225
+ token;
227
226
  needsSemi = false;
228
227
  insideProperty = false;
229
228
  propertyName = '';
@@ -142,9 +142,6 @@ export class ChildTargetManager extends SDKModel<EventTypes> implements Protocol
142
142
  }
143
143
  const target = this.#targetManager.createTarget(
144
144
  targetInfo.targetId, targetName, type, this.#parentTarget, sessionId, undefined, undefined, targetInfo);
145
- if (type === Type.Worker || type === Type.ServiceWorker || type === Type.SharedWorker) {
146
- target.setInspectedURL(this.#parentTarget.inspectedURL());
147
- }
148
145
  this.#childTargetsBySessionId.set(sessionId, target);
149
146
  this.#childTargetsById.set(target.id(), target);
150
147
 
@@ -44,7 +44,8 @@ import {Events as DebuggerModelEvents} from './DebuggerModel.js';
44
44
  import {LogModel} from './LogModel.js';
45
45
  import {RemoteObject} from './RemoteObject.js';
46
46
  import {Events as ResourceTreeModelEvents, ResourceTreeModel} from './ResourceTreeModel.js';
47
- import type {ConsoleAPICall, ExceptionWithTimestamp, ExecutionContext, QueryObjectRequestedEvent} from './RuntimeModel.js';
47
+ import type {
48
+ ConsoleAPICall, ExceptionWithTimestamp, ExecutionContext, QueryObjectRequestedEvent} from './RuntimeModel.js';
48
49
  import {Events as RuntimeModelEvents, RuntimeModel} from './RuntimeModel.js';
49
50
  import type {Target} from './Target.js';
50
51
  import {TargetManager} from './TargetManager.js';
@@ -41,7 +41,9 @@ import type * as ProtocolProxyApi from '../../generated/protocol-proxy-api.js';
41
41
  import * as Protocol from '../../generated/protocol.js';
42
42
 
43
43
  import {Cookie} from './Cookie.js';
44
- import type {BlockedCookieWithReason, ContentData, ExtraRequestInfo, ExtraResponseInfo, MIME_TYPE, NameValue, WebBundleInfo, WebBundleInnerRequestInfo} from './NetworkRequest.js';
44
+ import type {
45
+ BlockedCookieWithReason, ContentData, ExtraRequestInfo, ExtraResponseInfo, MIME_TYPE, NameValue, WebBundleInfo,
46
+ WebBundleInnerRequestInfo} from './NetworkRequest.js';
45
47
  import {Events as NetworkRequestEvents, NetworkRequest} from './NetworkRequest.js';
46
48
  import type {Target} from './Target.js';
47
49
  import {Capability} from './Target.js';
@@ -41,7 +41,13 @@ import type {FunctionDetails} from './DebuggerModel.js';
41
41
  import {DebuggerModel} from './DebuggerModel.js';
42
42
  import {HeapProfilerModel} from './HeapProfilerModel.js';
43
43
  import type {ScopeRef} from './RemoteObject.js';
44
- import {RemoteFunction, RemoteObject, RemoteObjectImpl, RemoteObjectProperty, ScopeRemoteObject} from './RemoteObject.js';
44
+ import {
45
+ RemoteFunction,
46
+ RemoteObject,
47
+ RemoteObjectImpl,
48
+ RemoteObjectProperty,
49
+ ScopeRemoteObject,
50
+ } from './RemoteObject.js';
45
51
  import type {Target} from './Target.js';
46
52
  import {Capability, Type} from './Target.js';
47
53
  import {SDKModel} from './SDKModel.js';
@@ -8,6 +8,7 @@ import * as Platform from '../platform/platform.js';
8
8
 
9
9
  import type {FrameAssociated} from './FrameAssociated.js';
10
10
  import type {Target} from './Target.js';
11
+ import {Type} from './Target.js';
11
12
  import {Events as TargetManagerEvents, TargetManager} from './TargetManager.js';
12
13
  import type {SourceMap} from './SourceMap.js';
13
14
  import {TextSourceMap} from './SourceMap.js';
@@ -66,6 +67,14 @@ export class SourceMapManager<T extends FrameAssociated> extends Common.ObjectWr
66
67
  }
67
68
  }
68
69
 
70
+ private getBaseUrl(): Platform.DevToolsPath.UrlString {
71
+ let target: Target|null = this.#target;
72
+ while (target && target.type() !== Type.Frame) {
73
+ target = target.parentTarget();
74
+ }
75
+ return target?.inspectedURL() ?? Platform.DevToolsPath.EmptyUrlString;
76
+ }
77
+
69
78
  private inspectedURLChanged(event: Common.EventTarget.EventTargetEvent<Target>): void {
70
79
  if (event.data !== this.#target) {
71
80
  return;
@@ -156,7 +165,7 @@ export class SourceMapManager<T extends FrameAssociated> extends Common.ObjectWr
156
165
  }|null {
157
166
  // |#sourceURL| can be a random string, but is generally an absolute path.
158
167
  // Complete it to inspected page url for relative links.
159
- const resolvedSourceURL = Common.ParsedURL.ParsedURL.completeURL(this.#target.inspectedURL(), sourceURL);
168
+ const resolvedSourceURL = Common.ParsedURL.ParsedURL.completeURL(this.getBaseUrl(), sourceURL);
160
169
  if (!resolvedSourceURL) {
161
170
  return null;
162
171
  }
@@ -31,7 +31,11 @@
31
31
  import * as Platform from '../../core/platform/platform.js';
32
32
  import * as Root from '../../core/root/root.js';
33
33
  import * as Acorn from '../../third_party/acorn/acorn.js';
34
- import type * as CodeMirrorModule from '../../third_party/codemirror/codemirror-legacy.js'; // eslint-disable-line @typescript-eslint/no-unused-vars
34
+
35
+ // This file is required to bring some types into scope, even though it
36
+ // is not used.
37
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
38
+ import type * as CodeMirrorModule from '../../third_party/codemirror/codemirror-legacy.js';
35
39
 
36
40
  import {AcornTokenizer, ECMA_VERSION} from './AcornTokenizer.js';
37
41
  import {CSSFormatter} from './CSSFormatter.js';
@@ -122,8 +122,8 @@ interface DOMError {
122
122
  }
123
123
 
124
124
  interface ShadowRoot {
125
- elementFromPoint(x: number, y: number): Element | null;
126
- getSelection(): Selection | null;
125
+ elementFromPoint(x: number, y: number): Element|null;
126
+ getSelection(): Selection|null;
127
127
  }
128
128
 
129
129
  interface HTMLDialogElement {
@@ -30,7 +30,9 @@
30
30
 
31
31
  import * as Common from '../../core/common/common.js';
32
32
  import * as Platform from '../../core/platform/platform.js';
33
- import type * as FormatterActions from '../../entrypoints/formatter_worker/FormatterActions.js'; // eslint-disable-line rulesdir/es_modules_import
33
+
34
+ // eslint-disable-next-line rulesdir/es_modules_import
35
+ import type * as FormatterActions from '../../entrypoints/formatter_worker/FormatterActions.js';
34
36
 
35
37
  import {formatterWorkerPool} from './FormatterWorkerPool.js';
36
38
 
@@ -102,7 +102,7 @@ const
102
102
  documentDomainSettingWithoutOriginAgentClusterHeader:
103
103
  'Relaxing the same-origin policy by setting `document.domain` is deprecated, and will be disabled by default. To continue using this feature, please opt-out of origin-keyed agent clusters by sending an `Origin-Agent-Cluster: ?0` header along with the HTTP response for the document and frames. See https://developer.chrome.com/blog/immutable-document-domain/ for more details.',
104
104
  /**
105
- *@description TODO(crbug.com/1320338): Description needed for translation
105
+ *@description Warning displayed to developers when the non-standard `Event.path` API is used to notify them that this API is deprecated.
106
106
  */
107
107
  eventPath: '`Event.path` is deprecated and will be removed. Please use `Event.composedPath()` instead.',
108
108
  /**
@@ -8,7 +8,11 @@ import * as Bindings from '../../models/bindings/bindings.js';
8
8
  import * as TextUtils from '../../models/text_utils/text_utils.js';
9
9
  import * as Workspace from '../../models/workspace/workspace.js';
10
10
 
11
- import {ContentSecurityPolicyIssue, trustedTypesPolicyViolationCode, trustedTypesSinkViolationCode} from './ContentSecurityPolicyIssue.js';
11
+ import {
12
+ ContentSecurityPolicyIssue,
13
+ trustedTypesPolicyViolationCode,
14
+ trustedTypesSinkViolationCode,
15
+ } from './ContentSecurityPolicyIssue.js';
12
16
  import type {Issue, IssueKind} from './Issue.js';
13
17
  import {toZeroBasedLocation} from './Issue.js';
14
18
  import type {IssueAddedEvent, IssuesManager} from './IssuesManager.js';
@@ -29,25 +29,22 @@
29
29
  */
30
30
 
31
31
  import * as CodeMirror from '../../third_party/codemirror.next/codemirror.next.js';
32
- type Tokenizer =
33
- (line: string, callback: (value: string, style: string|null) => void) => void;
32
+ type Tokenizer = (line: string, callback: (value: string, style: string|null) => void) => void;
34
33
 
35
34
  export function createCssTokenizer(): Tokenizer {
36
- async function tokenize(
37
- line: string, callback: (value: string, style: string|null) => void): Promise<void> {
38
- const streamParser = await CodeMirror.cssStreamParser();
39
- const stream = new CodeMirror.StringStream();
40
- stream.string = line;
35
+ async function tokenize(line: string, callback: (value: string, style: string|null) => void): Promise<void> {
36
+ const streamParser = await CodeMirror.cssStreamParser();
37
+ const stream = new CodeMirror.StringStream();
38
+ stream.string = line;
41
39
 
42
- const startState = streamParser.startState();
43
- let lastPos = stream.pos;
44
- while (!stream.eol()) {
45
- const token = streamParser.token(stream, startState);
46
- const segment = stream.current().substring(lastPos, stream.pos);
47
- callback(segment, token);
48
- lastPos = stream.pos;
49
- }
40
+ const startState = streamParser.startState();
41
+ let lastPos = stream.pos;
42
+ while (!stream.eol()) {
43
+ const token = streamParser.token(stream, startState);
44
+ const segment = stream.current().substring(lastPos, stream.pos);
45
+ callback(segment, token);
46
+ lastPos = stream.pos;
50
47
  }
51
- return tokenize;
48
+ }
49
+ return tokenize;
52
50
  }
53
-
@@ -1211,7 +1211,7 @@ export class TimelineModelImpl {
1211
1211
 
1212
1212
  private processBrowserEvent(event: SDK.TracingModel.Event): void {
1213
1213
  if (event.name === RecordType.LatencyInfoFlow) {
1214
- if (event.args.chrome_latency_info.trace_id) {
1214
+ if (event.args.chrome_latency_info?.trace_id) {
1215
1215
  this.knownInputEvents.add(event.args.chrome_latency_info.trace_id);
1216
1216
  }
1217
1217
  return;
@@ -183,7 +183,7 @@ export abstract class ProjectStore implements Project {
183
183
  const oldPath = uiSourceCode.url();
184
184
  const newPath = uiSourceCode.parentURL() ?
185
185
  Common.ParsedURL.ParsedURL.urlFromParentUrlAndName(uiSourceCode.parentURL(), newName) :
186
- encodeURIComponent(newName) as Platform.DevToolsPath.UrlString;
186
+ Common.ParsedURL.ParsedURL.preEncodeSpecialCharactersInPath(newName) as Platform.DevToolsPath.UrlString;
187
187
  const value = this.uiSourceCodesMap.get(oldPath) as {
188
188
  uiSourceCode: UISourceCode,
189
189
  index: number,
@@ -28,14 +28,17 @@
28
28
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
29
  */
30
30
 
31
- import indexedDBViewsStyles from './indexedDBViews.css.js';
32
31
  import * as i18n from '../../core/i18n/i18n.js';
32
+
33
+ import indexedDBViewsStyles from './indexedDBViews.css.js';
34
+
33
35
  import type * as SDK from '../../core/sdk/sdk.js';
34
36
  import * as DataGrid from '../../ui/legacy/components/data_grid/data_grid.js';
35
37
  import * as ObjectUI from '../../ui/legacy/components/object_ui/object_ui.js';
36
38
  import * as UI from '../../ui/legacy/legacy.js';
37
39
 
38
- import type {Database, DatabaseId, Entry, Index, IndexedDBModel, ObjectStore, ObjectStoreMetadata} from './IndexedDBModel.js';
40
+ import type {
41
+ Database, DatabaseId, Entry, Index, IndexedDBModel, ObjectStore, ObjectStoreMetadata} from './IndexedDBModel.js';
39
42
 
40
43
  const UIStrings = {
41
44
  /**
@@ -56,7 +56,15 @@ import {ConsoleFilter, FilterType} from './ConsoleFilter.js';
56
56
  import {ConsolePinPane} from './ConsolePinPane.js';
57
57
  import {ConsolePrompt, Events as ConsolePromptEvents} from './ConsolePrompt.js';
58
58
  import {ConsoleSidebar, Events} from './ConsoleSidebar.js';
59
- import {ConsoleCommand, ConsoleCommandResult, ConsoleGroupViewMessage, ConsoleTableMessageView, ConsoleViewMessage, getMessageForElement, MaxLengthForLinks} from './ConsoleViewMessage.js';
59
+ import {
60
+ ConsoleCommand,
61
+ ConsoleCommandResult,
62
+ ConsoleGroupViewMessage,
63
+ ConsoleTableMessageView,
64
+ ConsoleViewMessage,
65
+ getMessageForElement,
66
+ MaxLengthForLinks,
67
+ } from './ConsoleViewMessage.js';
60
68
 
61
69
  import type {ConsoleViewportElement, ConsoleViewportProvider} from './ConsoleViewport.js';
62
70
  import {ConsoleViewport} from './ConsoleViewport.js';
@@ -14,7 +14,9 @@ import * as UI from '../../ui/legacy/legacy.js';
14
14
  import type * as Protocol from '../../generated/protocol.js';
15
15
 
16
16
  import cssOverviewCompletedViewStyles from './cssOverviewCompletedView.css.js';
17
- import type {OverviewController, PopulateNodesEvent, PopulateNodesEventNodes, PopulateNodesEventNodeTypes} from './CSSOverviewController.js';
17
+ import type {
18
+ OverviewController, PopulateNodesEvent, PopulateNodesEventNodes, PopulateNodesEventNodeTypes} from
19
+ './CSSOverviewController.js';
18
20
  import {Events as CSSOverViewControllerEvents} from './CSSOverviewController.js';
19
21
  import {CSSOverviewSidebarPanel, SidebarEvents} from './CSSOverviewSidebarPanel.js';
20
22
  import type {UnusedDeclaration} from './CSSOverviewUnusedDeclarations.js';
@@ -212,4 +212,3 @@ export class PropertiesWidget extends UI.ThrottledWidget.ThrottledWidget {
212
212
  this.registerCSSFiles([propertiesWidgetStyles]);
213
213
  }
214
214
  }
215
-
@@ -61,7 +61,13 @@ import {StylePropertyHighlighter} from './StylePropertyHighlighter.js';
61
61
  import stylesSidebarPaneStyles from './stylesSidebarPane.css.js';
62
62
 
63
63
  import type {StylePropertyTreeElement} from './StylePropertyTreeElement.js';
64
- import {StylePropertiesSection, BlankStylePropertiesSection, KeyframePropertiesSection, HighlightPseudoStylePropertiesSection} from './StylePropertiesSection.js';
64
+ import {
65
+ StylePropertiesSection,
66
+ BlankStylePropertiesSection,
67
+ KeyframePropertiesSection,
68
+ HighlightPseudoStylePropertiesSection,
69
+ } from './StylePropertiesSection.js';
70
+
65
71
  import * as LayersWidget from './LayersWidget.js';
66
72
 
67
73
  const UIStrings = {
@@ -171,6 +171,11 @@ const UIStrings = {
171
171
  */
172
172
  resetStorageLocalstorage:
173
173
  'Reset storage (`cache`, `service workers`, etc) before auditing. (Good for performance & `PWA` testing)',
174
+ /**
175
+ *@description Explanation for user that Ligthhouse can only audit when JavaScript is enabled
176
+ */
177
+ javaScriptDisabled:
178
+ 'JavaScript is disabled. You need to enable JavaScript to audit this page. Open the Command Menu and run the Enable JavaScript command to enable JavaScript.',
174
179
  };
175
180
  const str_ = i18n.i18n.registerUIStrings('panels/lighthouse/LighthouseController.ts', UIStrings);
176
181
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -196,6 +201,9 @@ export class LighthouseController extends Common.ObjectWrapper.ObjectWrapper<Eve
196
201
  runtimeSetting.setting.addChangeListener(this.recomputePageAuditability.bind(this));
197
202
  }
198
203
 
204
+ const javaScriptDisabledSetting = Common.Settings.Settings.instance().moduleSetting('javaScriptDisabled');
205
+ javaScriptDisabledSetting.addChangeListener(this.recomputePageAuditability.bind(this));
206
+
199
207
  SDK.TargetManager.TargetManager.instance().observeModels(SDK.ServiceWorkerManager.ServiceWorkerManager, this);
200
208
  SDK.TargetManager.TargetManager.instance().addEventListener(
201
209
  SDK.TargetManager.Events.InspectedURLChanged, this.recomputePageAuditability, this);
@@ -273,6 +281,10 @@ export class LighthouseController extends Common.ObjectWrapper.ObjectWrapper<Eve
273
281
  return null;
274
282
  }
275
283
 
284
+ private javaScriptDisabled(): boolean {
285
+ return Common.Settings.Settings.instance().moduleSetting('javaScriptDisabled').get();
286
+ }
287
+
276
288
  private async hasImportantResourcesNotCleared(): Promise<string> {
277
289
  const clearStorageSetting =
278
290
  RuntimeSettings.find(runtimeSetting => runtimeSetting.setting.name === 'lighthouse.clear_storage');
@@ -363,6 +375,7 @@ export class LighthouseController extends Common.ObjectWrapper.ObjectWrapper<Eve
363
375
  const hasActiveServiceWorker = this.hasActiveServiceWorker();
364
376
  const hasAtLeastOneCategory = this.hasAtLeastOneCategory();
365
377
  const unauditablePageMessage = this.unauditablePageMessage();
378
+ const javaScriptDisabled = this.javaScriptDisabled();
366
379
 
367
380
  let helpText = '';
368
381
  if (hasActiveServiceWorker) {
@@ -371,6 +384,8 @@ export class LighthouseController extends Common.ObjectWrapper.ObjectWrapper<Eve
371
384
  helpText = i18nString(UIStrings.atLeastOneCategoryMustBeSelected);
372
385
  } else if (unauditablePageMessage) {
373
386
  helpText = unauditablePageMessage;
387
+ } else if (javaScriptDisabled) {
388
+ helpText = i18nString(UIStrings.javaScriptDisabled);
374
389
  }
375
390
 
376
391
  this.dispatchEventToListeners(Events.PageAuditabilityChanged, {helpText});
@@ -12,7 +12,8 @@ import * as EmulationModel from '../../models/emulation/emulation.js';
12
12
  import * as UI from '../../ui/legacy/legacy.js';
13
13
  import * as Emulation from '../emulation/emulation.js';
14
14
 
15
- import type {AuditProgressChangedEvent, PageAuditabilityChangedEvent, PageWarningsChangedEvent} from './LighthouseController.js';
15
+ import type {
16
+ AuditProgressChangedEvent, PageAuditabilityChangedEvent, PageWarningsChangedEvent} from './LighthouseController.js';
16
17
  import {Events, LighthouseController} from './LighthouseController.js';
17
18
  import lighthousePanelStyles from './lighthousePanel.css.js';
18
19
  import type {LighthouseRun} from './LighthouseProtocolService.js';