chrome-devtools-frontend 1.0.951410 → 1.0.952713
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.
- package/config/gni/devtools_grd_files.gni +3 -0
- package/extension-api/ExtensionAPI.d.ts +1 -1
- package/front_end/.eslintrc.js +6 -0
- package/front_end/Tests.js +10 -0
- package/front_end/core/common/App.ts +0 -3
- package/front_end/core/common/AppProvider.ts +0 -3
- package/front_end/core/common/JavaScriptMetaData.ts +0 -3
- package/front_end/core/common/QueryParamHandler.ts +0 -3
- package/front_end/core/common/Runnable.ts +0 -3
- package/front_end/core/common/SimpleHistoryManager.ts +0 -3
- package/front_end/core/host/UserMetrics.ts +2 -1
- package/front_end/core/i18n/locales/en-US.json +3 -0
- package/front_end/core/i18n/locales/en-XL.json +3 -0
- package/front_end/core/root/Runtime.ts +4 -12
- package/front_end/core/sdk/OverlayPersistentHighlighter.ts +0 -12
- package/front_end/core/sdk/PageResourceLoader.ts +2 -1
- package/front_end/core/sdk/TracingManager.ts +0 -3
- package/front_end/entrypoints/formatter_worker/AcornTokenizer.ts +39 -39
- package/front_end/entrypoints/formatter_worker/CSSFormatter.ts +54 -54
- package/front_end/entrypoints/formatter_worker/ESTreeWalker.ts +20 -20
- package/front_end/entrypoints/formatter_worker/FormattedContentBuilder.ts +54 -54
- package/front_end/entrypoints/formatter_worker/HTMLFormatter.ts +145 -144
- package/front_end/entrypoints/formatter_worker/JavaScriptFormatter.ts +40 -40
- package/front_end/entrypoints/heap_snapshot_worker/AllocationProfile.ts +64 -69
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +203 -203
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotLoader.ts +109 -108
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotWorkerDispatcher.ts +17 -17
- package/front_end/entrypoints/inspector_main/InspectorMain.ts +30 -30
- package/front_end/entrypoints/inspector_main/RenderingOptions.ts +25 -25
- package/front_end/entrypoints/main/ExecutionContextSelector.ts +52 -55
- package/front_end/entrypoints/main/MainImpl.ts +49 -49
- package/front_end/entrypoints/node_app/NodeConnectionsPanel.ts +43 -43
- package/front_end/entrypoints/node_app/NodeMain.ts +38 -38
- package/front_end/generated/InspectorBackendCommands.js +5 -1
- package/front_end/generated/protocol.d.ts +16 -0
- package/front_end/legacy/legacy-defs.d.ts +0 -21
- package/front_end/models/bindings/CSSWorkspaceBinding.ts +0 -3
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +0 -3
- package/front_end/models/bindings/FileUtils.ts +0 -3
- package/front_end/models/extensions/ExtensionAPI.ts +2 -1
- package/front_end/models/extensions/ExtensionTraceProvider.ts +0 -3
- package/front_end/models/heap_snapshot_model/HeapSnapshotModel.ts +1 -1
- package/front_end/models/issues_manager/ClientHintIssue.ts +95 -0
- package/front_end/models/issues_manager/ContentSecurityPolicyIssue.ts +6 -6
- package/front_end/models/issues_manager/ContrastCheckTrigger.ts +15 -15
- package/front_end/models/issues_manager/CorsIssue.ts +9 -9
- package/front_end/models/issues_manager/CrossOriginEmbedderPolicyIssue.ts +5 -5
- package/front_end/models/issues_manager/DeprecationIssue.ts +7 -7
- package/front_end/models/issues_manager/GenericIssue.ts +5 -5
- package/front_end/models/issues_manager/HeavyAdIssue.ts +5 -5
- package/front_end/models/issues_manager/Issue.ts +10 -10
- package/front_end/models/issues_manager/IssueResolver.ts +11 -10
- package/front_end/models/issues_manager/IssuesManager.ts +61 -56
- package/front_end/models/issues_manager/LowTextContrastIssue.ts +4 -4
- package/front_end/models/issues_manager/MixedContentIssue.ts +7 -7
- package/front_end/models/issues_manager/NavigatorUserAgentIssue.ts +7 -7
- package/front_end/models/issues_manager/QuirksModeIssue.ts +4 -4
- package/front_end/models/issues_manager/SameSiteCookieIssue.ts +16 -16
- package/front_end/models/issues_manager/SharedArrayBufferIssue.ts +5 -5
- package/front_end/models/issues_manager/SourceFrameIssuesManager.ts +32 -31
- package/front_end/models/issues_manager/TrustedWebActivityIssue.ts +5 -5
- package/front_end/models/issues_manager/WasmCrossOriginModuleSharingIssue.ts +5 -5
- package/front_end/models/issues_manager/descriptions/clientHintMetaTagAllowListInvalidOrigin.md +4 -0
- package/front_end/models/issues_manager/descriptions/clientHintMetaTagModifiedHTML.md +4 -0
- package/front_end/models/issues_manager/issues_manager.ts +2 -0
- package/front_end/models/timeline_model/TimelineModel.ts +1 -1
- package/front_end/panels/application/components/BackForwardCacheView.ts +33 -33
- package/front_end/panels/application/components/EndpointsGrid.ts +12 -12
- package/front_end/panels/application/components/FrameDetailsView.ts +108 -110
- package/front_end/panels/application/components/OriginTrialTreeView.ts +45 -45
- package/front_end/panels/application/components/PermissionsPolicySection.ts +19 -19
- package/front_end/panels/application/components/ReportsGrid.ts +30 -30
- package/front_end/panels/application/components/StackTrace.ts +48 -47
- package/front_end/panels/application/components/TrustTokensView.ts +31 -31
- package/front_end/panels/console/ConsoleView.ts +1 -1
- package/front_end/panels/console/ConsoleViewMessage.ts +1 -25
- package/front_end/panels/console/consoleView.css +5 -0
- package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +41 -52
- package/front_end/panels/css_overview/CSSOverviewController.ts +2 -2
- package/front_end/panels/css_overview/CSSOverviewPanel.ts +18 -27
- package/front_end/panels/css_overview/CSSOverviewProcessingView.ts +2 -2
- package/front_end/panels/css_overview/CSSOverviewSidebarPanel.ts +6 -6
- package/front_end/panels/css_overview/components/CSSOverviewStartView.ts +4 -4
- package/front_end/panels/elements/ElementsTreeElement.ts +2 -6
- package/front_end/panels/elements/components/AccessibilityTreeNode.ts +17 -17
- package/front_end/panels/elements/components/AdornerManager.ts +21 -21
- package/front_end/panels/elements/components/AdornerSettingsPane.ts +14 -14
- package/front_end/panels/elements/components/CSSQuery.ts +16 -16
- package/front_end/panels/elements/components/ComputedStyleProperty.ts +14 -14
- package/front_end/panels/elements/components/ComputedStyleTrace.ts +15 -15
- package/front_end/panels/elements/components/ElementsBreadcrumbs.ts +78 -78
- package/front_end/panels/elements/components/ElementsPanelLink.ts +16 -16
- package/front_end/panels/elements/components/LayoutPane.ts +47 -47
- package/front_end/panels/elements/components/NodeText.ts +18 -18
- package/front_end/panels/elements/components/QueryContainer.ts +40 -40
- package/front_end/panels/elements/components/StylePropertyEditor.ts +18 -18
- package/front_end/panels/emulation/components/DeviceSizeInputElement.ts +4 -4
- package/front_end/panels/event_listeners/EventListenersUtils.ts +2 -1
- package/front_end/panels/issues/AffectedBlockedByResponseView.ts +4 -4
- package/front_end/panels/issues/AffectedCookiesView.ts +4 -5
- package/front_end/panels/issues/AffectedDirectivesView.ts +19 -19
- package/front_end/panels/issues/AffectedDocumentsInQuirksModeView.ts +7 -8
- package/front_end/panels/issues/AffectedElementsView.ts +4 -4
- package/front_end/panels/issues/AffectedElementsWithLowContrastView.ts +7 -8
- package/front_end/panels/issues/AffectedHeavyAdView.ts +8 -8
- package/front_end/panels/issues/AffectedResourcesView.ts +25 -26
- package/front_end/panels/issues/AffectedSharedArrayBufferIssueDetailsView.ts +8 -8
- package/front_end/panels/issues/AffectedSourcesView.ts +4 -4
- package/front_end/panels/issues/AffectedTrustedWebActivityIssueDetailsView.ts +4 -4
- package/front_end/panels/issues/AttributionReportingIssueDetailsView.ts +17 -17
- package/front_end/panels/issues/CSPViolationsListView.ts +22 -23
- package/front_end/panels/issues/CSPViolationsView.ts +17 -17
- package/front_end/panels/issues/ComboBoxOfCheckBoxes.ts +13 -13
- package/front_end/panels/issues/CorsIssueDetailsView.ts +23 -23
- package/front_end/panels/issues/GenericIssueDetailsView.ts +4 -4
- package/front_end/panels/issues/HiddenIssuesRow.ts +7 -7
- package/front_end/panels/issues/IssueAggregator.ts +95 -95
- package/front_end/panels/issues/IssueKindView.ts +14 -14
- package/front_end/panels/issues/IssueView.ts +98 -98
- package/front_end/panels/issues/IssuesPane.ts +102 -102
- package/front_end/panels/issues/WasmCrossOriginModuleSharingAffectedResourcesView.ts +5 -5
- package/front_end/panels/issues/components/HideIssuesMenu.ts +10 -10
- package/front_end/panels/media/PlayerListView.ts +160 -97
- package/front_end/panels/media/PlayerMessagesView.ts +1 -0
- package/front_end/panels/media/playerListView.css +58 -0
- package/front_end/panels/network/NetworkLogView.ts +2 -6
- package/front_end/panels/network/NetworkWaterfallColumn.ts +2 -4
- package/front_end/panels/network/components/RequestTrustTokensView.ts +40 -40
- package/front_end/panels/network/components/WebBundleInfoView.ts +9 -9
- package/front_end/panels/performance_monitor/PerformanceMonitor.ts +92 -37
- package/front_end/panels/performance_monitor/performanceMonitor.css +32 -0
- package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +2 -2
- package/front_end/panels/search/SearchConfig.ts +0 -6
- package/front_end/panels/settings/KeybindsSettingsTab.ts +4 -0
- package/front_end/panels/settings/components/SyncSection.ts +14 -14
- package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +96 -96
- package/front_end/panels/sources/BreakpointEditDialog.ts +4 -3
- package/front_end/panels/sources/NavigatorView.ts +3 -9
- package/front_end/panels/sources/SourceMapNamesResolver.ts +3 -3
- package/front_end/panels/sources/SourcesPanel.ts +1 -3
- package/front_end/panels/sources/SourcesView.ts +0 -3
- package/front_end/panels/sources/TabbedEditorContainer.ts +0 -3
- package/front_end/panels/timeline/TimelineFlameChartView.ts +1 -1
- package/front_end/panels/timeline/TimelineLoader.ts +0 -3
- package/front_end/panels/timeline/TimelineTreeView.ts +1 -1
- package/front_end/panels/timeline/components/WebVitalsLane.ts +77 -76
- package/front_end/panels/timeline/components/WebVitalsTimeline.ts +133 -133
- package/front_end/panels/timeline/components/WebVitalsTooltip.ts +9 -9
- package/front_end/panels/webauthn/WebauthnPane.ts +203 -205
- package/front_end/third_party/codemirror.next/bundle.ts +3 -3
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/markdown.js +2 -1
- package/front_end/third_party/codemirror.next/codemirror.next.d.ts +10 -1
- package/front_end/third_party/codemirror.next/codemirror.next.js +2 -1
- package/front_end/third_party/codemirror.next/package.json +3 -3
- package/front_end/third_party/diff/DiffWrapper.ts +7 -0
- package/front_end/ui/components/adorners/Adorner.ts +2 -2
- package/front_end/ui/components/buttons/Button.ts +9 -9
- package/front_end/ui/components/data_grid/DataGrid.ts +64 -64
- package/front_end/ui/components/data_grid/DataGridController.ts +22 -22
- package/front_end/ui/components/data_grid/DataGridUtils.ts +3 -0
- package/front_end/ui/components/diff_view/DiffView.ts +6 -6
- package/front_end/ui/components/expandable_list/ExpandableList.ts +5 -5
- package/front_end/ui/components/icon_button/Icon.ts +4 -4
- package/front_end/ui/components/icon_button/IconButton.ts +4 -4
- package/front_end/ui/components/issue_counter/IssueCounter.ts +3 -3
- package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +11 -11
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspector.ts +50 -50
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorController.ts +6 -6
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorPane.ts +4 -4
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryNavigator.ts +12 -12
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryValueInterpreter.ts +11 -11
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryViewer.ts +40 -39
- package/front_end/ui/components/linear_memory_inspector/ValueInterpreterDisplay.ts +18 -18
- package/front_end/ui/components/linear_memory_inspector/ValueInterpreterSettings.ts +6 -6
- package/front_end/ui/components/linkifier/LinkifierImpl.ts +4 -4
- package/front_end/ui/components/markdown_view/MarkdownImage.ts +5 -5
- package/front_end/ui/components/markdown_view/MarkdownLink.ts +2 -2
- package/front_end/ui/components/markdown_view/MarkdownView.ts +4 -4
- package/front_end/ui/components/panel_feedback/FeedbackButton.ts +2 -2
- package/front_end/ui/components/panel_feedback/PanelFeedback.ts +2 -2
- package/front_end/ui/components/panel_feedback/PreviewToggle.ts +4 -4
- package/front_end/ui/components/render_coordinator/RenderCoordinator.ts +22 -22
- package/front_end/ui/components/report_view/ReportView.ts +16 -16
- package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +14 -14
- package/front_end/ui/components/settings/SettingCheckbox.ts +5 -5
- package/front_end/ui/components/survey_link/SurveyLink.ts +8 -8
- package/front_end/ui/components/text_editor/TextEditor.ts +9 -9
- package/front_end/ui/components/text_editor/cursor_tooltip.ts +7 -1
- package/front_end/ui/components/text_prompt/TextPrompt.ts +18 -18
- package/front_end/ui/components/tree_outline/TreeOutline.ts +69 -70
- package/front_end/ui/legacy/ContextFlavorListener.ts +0 -4
- package/front_end/ui/legacy/SearchableView.ts +13 -4
- package/front_end/ui/legacy/SuggestBox.ts +0 -3
- package/front_end/ui/legacy/components/data_grid/DataGrid.ts +6 -6
- package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +0 -3
- package/front_end/ui/legacy/components/source_frame/JSONView.ts +1 -1
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +13 -12
- package/front_end/ui/legacy/components/source_frame/XMLView.ts +2 -2
- package/front_end/ui/legacy/themeColors.css +2 -0
- package/front_end/ui/legacy/theme_support/theme_support_impl.ts +34 -7
- package/package.json +1 -1
- package/scripts/eslint_rules/lib/use_private_class_members.js +41 -0
- package/scripts/eslint_rules/tests/use_private_class_members_test.js +62 -0
- package/scripts/migration/class-fields/migrate.js +2 -3
- package/scripts/migration/class-fields/migrate.sh +1 -3
- package/scripts/migration/class-fields/package.json +1 -1
- package/config/gni/all_devtools_files.gni +0 -255
- package/scripts/build/devtools_file_hashes.py +0 -82
- package/scripts/devtools_run/devtools_run_cli +0 -49
- package/scripts/devtools_run/package.json +0 -13
- package/scripts/unzip.py +0 -20
- package/scripts/visualize_deps/jquery_svg.html +0 -57
- package/scripts/visualize_deps/run_visualize.js +0 -119
|
@@ -281,6 +281,8 @@ grd_files_release_sources = [
|
|
|
281
281
|
"front_end/models/issues_manager/descriptions/arInvalidTriggerPriority.md",
|
|
282
282
|
"front_end/models/issues_manager/descriptions/arMissingAttributionData.md",
|
|
283
283
|
"front_end/models/issues_manager/descriptions/arPermissionPolicyDisabled.md",
|
|
284
|
+
"front_end/models/issues_manager/descriptions/clientHintMetaTagAllowListInvalidOrigin.md",
|
|
285
|
+
"front_end/models/issues_manager/descriptions/clientHintMetaTagModifiedHTML.md",
|
|
284
286
|
"front_end/models/issues_manager/descriptions/corsAllowCredentialsRequired.md",
|
|
285
287
|
"front_end/models/issues_manager/descriptions/corsDisabledScheme.md",
|
|
286
288
|
"front_end/models/issues_manager/descriptions/corsDisallowedByMode.md",
|
|
@@ -692,6 +694,7 @@ grd_files_debug_sources = [
|
|
|
692
694
|
"front_end/models/har/Writer.js",
|
|
693
695
|
"front_end/models/heap_snapshot_model/HeapSnapshotModel.js",
|
|
694
696
|
"front_end/models/issues_manager/AttributionReportingIssue.js",
|
|
697
|
+
"front_end/models/issues_manager/ClientHintIssue.js",
|
|
695
698
|
"front_end/models/issues_manager/ContentSecurityPolicyIssue.js",
|
|
696
699
|
"front_end/models/issues_manager/ContrastCheckTrigger.js",
|
|
697
700
|
"front_end/models/issues_manager/CorsIssue.js",
|
package/front_end/.eslintrc.js
CHANGED
package/front_end/Tests.js
CHANGED
|
@@ -1562,6 +1562,16 @@
|
|
|
1562
1562
|
return names.join(',');
|
|
1563
1563
|
};
|
|
1564
1564
|
|
|
1565
|
+
TestSuite.prototype.testSourceMapsFromExtension = function(extensionId) {
|
|
1566
|
+
this.takeControl();
|
|
1567
|
+
const debuggerModel = self.SDK.targetManager.mainTarget().model(SDK.DebuggerModel);
|
|
1568
|
+
debuggerModel.sourceMapManager().addEventListener(
|
|
1569
|
+
SDK.SourceMapManager.Events.SourceMapAttached, this.releaseControl.bind(this));
|
|
1570
|
+
|
|
1571
|
+
this.evaluateInConsole_(
|
|
1572
|
+
`console.log(1) //# sourceMappingURL=chrome-extension://${extensionId}/source.map`, () => {});
|
|
1573
|
+
};
|
|
1574
|
+
|
|
1565
1575
|
/**
|
|
1566
1576
|
* Returns all loaded non anonymous uiSourceCodes.
|
|
1567
1577
|
* @return {!Array.<!Workspace.UISourceCode>}
|
|
@@ -677,7 +677,8 @@ export const IssueCreated: {
|
|
|
677
677
|
'QuirksModeIssue::QuirksMode': 58,
|
|
678
678
|
'QuirksModeIssue::LimitedQuirksMode': 59,
|
|
679
679
|
DeprecationIssue: 60,
|
|
680
|
-
'
|
|
680
|
+
'ClientHintIssue::MetaTagAllowListInvalidOrigin': 61,
|
|
681
|
+
'ClientHintIssue::MetaTagModifiedHTML': 62,
|
|
681
682
|
};
|
|
682
683
|
|
|
683
684
|
// TODO(crbug.com/1167717): Make this a const enum again
|
|
@@ -1322,6 +1322,9 @@
|
|
|
1322
1322
|
"models/har/Writer.ts | writingFile": {
|
|
1323
1323
|
"message": "Writing file…"
|
|
1324
1324
|
},
|
|
1325
|
+
"models/issues_manager/ClientHintIssue.ts | clientHintsInfrastructure": {
|
|
1326
|
+
"message": "Client Hints Infrastructure"
|
|
1327
|
+
},
|
|
1325
1328
|
"models/issues_manager/ContentSecurityPolicyIssue.ts | contentSecurityPolicyEval": {
|
|
1326
1329
|
"message": "Content Security Policy - Eval"
|
|
1327
1330
|
},
|
|
@@ -1322,6 +1322,9 @@
|
|
|
1322
1322
|
"models/har/Writer.ts | writingFile": {
|
|
1323
1323
|
"message": "Ŵŕît́îńĝ f́îĺê…"
|
|
1324
1324
|
},
|
|
1325
|
+
"models/issues_manager/ClientHintIssue.ts | clientHintsInfrastructure": {
|
|
1326
|
+
"message": "Ĉĺîén̂t́ Ĥín̂t́ŝ Ín̂f́r̂áŝt́r̂úĉt́ûŕê"
|
|
1327
|
+
},
|
|
1325
1328
|
"models/issues_manager/ContentSecurityPolicyIssue.ts | contentSecurityPolicyEval": {
|
|
1326
1329
|
"message": "Ĉón̂t́êńt̂ Śêćûŕît́ŷ Ṕôĺîćŷ - Év̂ál̂"
|
|
1327
1330
|
},
|
|
@@ -2,8 +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
|
-
|
|
6
|
-
const originalAssert = console.assert;
|
|
5
|
+
import * as Platform from '../platform/platform.js';
|
|
7
6
|
|
|
8
7
|
const queryParamsObject = new URLSearchParams(location.search);
|
|
9
8
|
|
|
@@ -100,13 +99,6 @@ export class Runtime {
|
|
|
100
99
|
}
|
|
101
100
|
}
|
|
102
101
|
|
|
103
|
-
static assert(value: boolean|undefined, message: string): void {
|
|
104
|
-
if (value) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
originalAssert.call(originalConsole, value, message + ' ' + new Error().stack);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
102
|
static setPlatform(platform: string): void {
|
|
111
103
|
runtimePlatform = platform;
|
|
112
104
|
}
|
|
@@ -197,8 +189,8 @@ export class ExperimentsSupport {
|
|
|
197
189
|
}
|
|
198
190
|
|
|
199
191
|
register(experimentName: string, experimentTitle: string, unstable?: boolean, docLink?: string): void {
|
|
200
|
-
|
|
201
|
-
!this.#experimentNames.has(experimentName), 'Duplicate registration of experiment ' + experimentName);
|
|
192
|
+
Platform.DCHECK(
|
|
193
|
+
() => !this.#experimentNames.has(experimentName), 'Duplicate registration of experiment ' + experimentName);
|
|
202
194
|
this.#experimentNames.add(experimentName);
|
|
203
195
|
this.#experiments.push(new Experiment(this, experimentName, experimentTitle, Boolean(unstable), docLink ?? ''));
|
|
204
196
|
}
|
|
@@ -278,7 +270,7 @@ export class ExperimentsSupport {
|
|
|
278
270
|
}
|
|
279
271
|
|
|
280
272
|
private checkExperiment(experimentName: string): void {
|
|
281
|
-
|
|
273
|
+
Platform.DCHECK(() => this.#experimentNames.has(experimentName), 'Unknown experiment ' + experimentName);
|
|
282
274
|
}
|
|
283
275
|
}
|
|
284
276
|
|
|
@@ -360,15 +360,9 @@ export class OverlayPersistentHighlighter {
|
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
362
|
|
|
363
|
-
/**
|
|
364
|
-
* @interface
|
|
365
|
-
*/
|
|
366
363
|
export interface DOMModel {
|
|
367
364
|
nodeForId(nodeId: Protocol.DOM.NodeId): void;
|
|
368
365
|
}
|
|
369
|
-
/**
|
|
370
|
-
* @interface
|
|
371
|
-
*/
|
|
372
366
|
export interface OverlayAgent {
|
|
373
367
|
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
374
368
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
@@ -415,16 +409,10 @@ export interface OverlayAgent {
|
|
|
415
409
|
}): void;
|
|
416
410
|
}
|
|
417
411
|
|
|
418
|
-
/**
|
|
419
|
-
* @interface
|
|
420
|
-
*/
|
|
421
412
|
export interface Target {
|
|
422
413
|
overlayAgent(): OverlayAgent;
|
|
423
414
|
}
|
|
424
415
|
|
|
425
|
-
/**
|
|
426
|
-
* @interface
|
|
427
|
-
*/
|
|
428
416
|
export interface OverlayModel {
|
|
429
417
|
getDOMModel(): DOMModel;
|
|
430
418
|
|
|
@@ -219,7 +219,8 @@ export class PageResourceLoader extends Common.ObjectWrapper.ObjectWrapper<Event
|
|
|
219
219
|
return this.#loadOverride(url);
|
|
220
220
|
}
|
|
221
221
|
const parsedURL = new Common.ParsedURL.ParsedURL(url);
|
|
222
|
-
const eligibleForLoadFromTarget =
|
|
222
|
+
const eligibleForLoadFromTarget =
|
|
223
|
+
getLoadThroughTargetSetting().get() && parsedURL && parsedURL.scheme !== 'file' && parsedURL.scheme !== 'data';
|
|
223
224
|
Host.userMetrics.developerResourceScheme(this.getDeveloperResourceScheme(parsedURL));
|
|
224
225
|
if (eligibleForLoadFromTarget) {
|
|
225
226
|
try {
|
|
@@ -34,28 +34,28 @@ export type TokenOrComment = Acorn.Token|Acorn.Comment;
|
|
|
34
34
|
* out whether the next token should be the preceding comment or not.
|
|
35
35
|
*/
|
|
36
36
|
export class AcornTokenizer {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
readonly #content: string;
|
|
38
|
+
readonly #comments: Acorn.Comment[];
|
|
39
|
+
#tokenizer: {
|
|
40
40
|
getToken(): Acorn.Token,
|
|
41
41
|
[Symbol.iterator](): Iterator<Acorn.Token>,
|
|
42
42
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
#textCursor: TextUtils.TextCursor.TextCursor;
|
|
44
|
+
#tokenLineStartInternal: number;
|
|
45
|
+
#tokenLineEndInternal: number;
|
|
46
|
+
#tokenColumnStartInternal: number;
|
|
47
|
+
#bufferedToken?: TokenOrComment;
|
|
48
48
|
|
|
49
49
|
constructor(content: string) {
|
|
50
|
-
this
|
|
51
|
-
this
|
|
52
|
-
this
|
|
53
|
-
Acorn.tokenizer(this
|
|
54
|
-
const contentLineEndings = Platform.StringUtilities.findLineEndingIndexes(this
|
|
55
|
-
this
|
|
56
|
-
this
|
|
57
|
-
this
|
|
58
|
-
this
|
|
50
|
+
this.#content = content;
|
|
51
|
+
this.#comments = [];
|
|
52
|
+
this.#tokenizer =
|
|
53
|
+
Acorn.tokenizer(this.#content, {onComment: this.#comments, ecmaVersion: ECMA_VERSION, allowHashBang: true});
|
|
54
|
+
const contentLineEndings = Platform.StringUtilities.findLineEndingIndexes(this.#content);
|
|
55
|
+
this.#textCursor = new TextUtils.TextCursor.TextCursor(contentLineEndings);
|
|
56
|
+
this.#tokenLineStartInternal = 0;
|
|
57
|
+
this.#tokenLineEndInternal = 0;
|
|
58
|
+
this.#tokenColumnStartInternal = 0;
|
|
59
59
|
// If the first "token" should be a comment, we don't want to shift
|
|
60
60
|
// the comment from the array (which happens in `nextTokenInternal`).
|
|
61
61
|
// Therefore, we should bail out from retrieving the token if this
|
|
@@ -65,8 +65,8 @@ export class AcornTokenizer {
|
|
|
65
65
|
// themselves. In that case, we first retrieve the actual token, before
|
|
66
66
|
// we see the comment itself. In that case, we should proceed and
|
|
67
67
|
// initialize `bufferedToken` as normal, to allow us to fix the reordering.
|
|
68
|
-
if (this
|
|
69
|
-
this
|
|
68
|
+
if (this.#comments.length === 0) {
|
|
69
|
+
this.#nextTokenInternal();
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
|
|
@@ -94,59 +94,59 @@ export class AcornTokenizer {
|
|
|
94
94
|
return token.type === 'Block';
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
|
|
98
|
-
if (this
|
|
99
|
-
const nextComment = this
|
|
97
|
+
#nextTokenInternal(): TokenOrComment|undefined {
|
|
98
|
+
if (this.#comments.length) {
|
|
99
|
+
const nextComment = this.#comments.shift();
|
|
100
100
|
// If this was the last comment to process, we need to make
|
|
101
101
|
// sure to update our `bufferedToken` to become the actual
|
|
102
102
|
// token. This only happens when we are processing the very
|
|
103
103
|
// first comment of a file (usually a hashbang comment)
|
|
104
104
|
// in which case we don't have to fix the reordering of tokens.
|
|
105
|
-
if (!this
|
|
106
|
-
this
|
|
105
|
+
if (!this.#bufferedToken && this.#comments.length === 0) {
|
|
106
|
+
this.#bufferedToken = this.#tokenizer.getToken();
|
|
107
107
|
}
|
|
108
108
|
return nextComment;
|
|
109
109
|
}
|
|
110
|
-
const token = this
|
|
111
|
-
this
|
|
110
|
+
const token = this.#bufferedToken;
|
|
111
|
+
this.#bufferedToken = this.#tokenizer.getToken();
|
|
112
112
|
return token;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
nextToken(): TokenOrComment|null {
|
|
116
|
-
const token = this
|
|
116
|
+
const token = this.#nextTokenInternal();
|
|
117
117
|
if (!token || token.type === Acorn.tokTypes.eof) {
|
|
118
118
|
return null;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
this
|
|
122
|
-
this
|
|
123
|
-
this
|
|
121
|
+
this.#textCursor.advance(token.start);
|
|
122
|
+
this.#tokenLineStartInternal = this.#textCursor.lineNumber();
|
|
123
|
+
this.#tokenColumnStartInternal = this.#textCursor.columnNumber();
|
|
124
124
|
|
|
125
|
-
this
|
|
126
|
-
this
|
|
125
|
+
this.#textCursor.advance(token.end);
|
|
126
|
+
this.#tokenLineEndInternal = this.#textCursor.lineNumber();
|
|
127
127
|
return token;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
peekToken(): TokenOrComment|null {
|
|
131
|
-
if (this
|
|
132
|
-
return this
|
|
131
|
+
if (this.#comments.length) {
|
|
132
|
+
return this.#comments[0];
|
|
133
133
|
}
|
|
134
|
-
if (!this
|
|
134
|
+
if (!this.#bufferedToken) {
|
|
135
135
|
return null;
|
|
136
136
|
}
|
|
137
|
-
return this
|
|
137
|
+
return this.#bufferedToken.type !== Acorn.tokTypes.eof ? this.#bufferedToken : null;
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
tokenLineStart(): number {
|
|
141
|
-
return this
|
|
141
|
+
return this.#tokenLineStartInternal;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
tokenLineEnd(): number {
|
|
145
|
-
return this
|
|
145
|
+
return this.#tokenLineEndInternal;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
tokenColumnStart(): number {
|
|
149
|
-
return this
|
|
149
|
+
return this.#tokenColumnStartInternal;
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
|
|
@@ -40,21 +40,21 @@ const cssTrimEnd = (tokenValue: string): string => {
|
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
export class CSSFormatter {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
readonly #builder: FormattedContentBuilder;
|
|
44
|
+
#toOffset!: number;
|
|
45
|
+
#fromOffset!: number;
|
|
46
|
+
#lineEndings!: number[];
|
|
47
|
+
#lastLine: number;
|
|
48
|
+
#state: {
|
|
49
49
|
eatWhitespace: (boolean|undefined),
|
|
50
50
|
seenProperty: (boolean|undefined),
|
|
51
51
|
inPropertyValue: (boolean|undefined),
|
|
52
52
|
afterClosingBrace: (boolean|undefined),
|
|
53
53
|
};
|
|
54
54
|
constructor(builder: FormattedContentBuilder) {
|
|
55
|
-
this
|
|
56
|
-
this
|
|
57
|
-
this
|
|
55
|
+
this.#builder = builder;
|
|
56
|
+
this.#lastLine = -1;
|
|
57
|
+
this.#state = {
|
|
58
58
|
eatWhitespace: undefined,
|
|
59
59
|
seenProperty: undefined,
|
|
60
60
|
inPropertyValue: undefined,
|
|
@@ -63,84 +63,84 @@ export class CSSFormatter {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
format(text: string, lineEndings: number[], fromOffset: number, toOffset: number): void {
|
|
66
|
-
this
|
|
67
|
-
this
|
|
68
|
-
this
|
|
69
|
-
this
|
|
66
|
+
this.#lineEndings = lineEndings;
|
|
67
|
+
this.#fromOffset = fromOffset;
|
|
68
|
+
this.#toOffset = toOffset;
|
|
69
|
+
this.#state = {
|
|
70
70
|
eatWhitespace: undefined,
|
|
71
71
|
seenProperty: undefined,
|
|
72
72
|
inPropertyValue: undefined,
|
|
73
73
|
afterClosingBrace: undefined,
|
|
74
74
|
};
|
|
75
|
-
this
|
|
75
|
+
this.#lastLine = -1;
|
|
76
76
|
const tokenize = createTokenizer('text/css');
|
|
77
|
-
const oldEnforce = this
|
|
78
|
-
tokenize(text.substring(this
|
|
79
|
-
this
|
|
77
|
+
const oldEnforce = this.#builder.setEnforceSpaceBetweenWords(false);
|
|
78
|
+
tokenize(text.substring(this.#fromOffset, this.#toOffset), this.#tokenCallback.bind(this));
|
|
79
|
+
this.#builder.setEnforceSpaceBetweenWords(oldEnforce);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
startPosition += this
|
|
84
|
-
const startLine =
|
|
85
|
-
|
|
86
|
-
if (startLine !== this
|
|
87
|
-
this
|
|
82
|
+
#tokenCallback(token: string, type: string|null, startPosition: number): void {
|
|
83
|
+
startPosition += this.#fromOffset;
|
|
84
|
+
const startLine = Platform.ArrayUtilities.lowerBound(
|
|
85
|
+
this.#lineEndings, startPosition, Platform.ArrayUtilities.DEFAULT_COMPARATOR);
|
|
86
|
+
if (startLine !== this.#lastLine) {
|
|
87
|
+
this.#state.eatWhitespace = true;
|
|
88
88
|
}
|
|
89
|
-
if (type && (/^property/.test(type) || /^variable-2/.test(type)) && !this
|
|
90
|
-
this
|
|
89
|
+
if (type && (/^property/.test(type) || /^variable-2/.test(type)) && !this.#state.inPropertyValue) {
|
|
90
|
+
this.#state.seenProperty = true;
|
|
91
91
|
}
|
|
92
|
-
this
|
|
92
|
+
this.#lastLine = startLine;
|
|
93
93
|
// https://drafts.csswg.org/css-syntax/#whitespace
|
|
94
94
|
const isWhitespace = /^(?:\r?\n|[\t\f\r ])+$/.test(token);
|
|
95
95
|
if (isWhitespace) {
|
|
96
|
-
if (!this
|
|
97
|
-
this
|
|
96
|
+
if (!this.#state.eatWhitespace) {
|
|
97
|
+
this.#builder.addSoftSpace();
|
|
98
98
|
}
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
|
-
this
|
|
101
|
+
this.#state.eatWhitespace = false;
|
|
102
102
|
if (token === '\n') {
|
|
103
103
|
return;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
if (token !== '}') {
|
|
107
|
-
if (this
|
|
108
|
-
this
|
|
107
|
+
if (this.#state.afterClosingBrace) {
|
|
108
|
+
this.#builder.addNewLine(true);
|
|
109
109
|
}
|
|
110
|
-
this
|
|
110
|
+
this.#state.afterClosingBrace = false;
|
|
111
111
|
}
|
|
112
112
|
if (token === '}') {
|
|
113
|
-
if (this
|
|
114
|
-
this
|
|
113
|
+
if (this.#state.inPropertyValue) {
|
|
114
|
+
this.#builder.addNewLine();
|
|
115
115
|
}
|
|
116
|
-
this
|
|
117
|
-
this
|
|
118
|
-
this
|
|
119
|
-
} else if (token === ':' && !this
|
|
120
|
-
this
|
|
121
|
-
this
|
|
122
|
-
this
|
|
123
|
-
this
|
|
124
|
-
this
|
|
116
|
+
this.#builder.decreaseNestingLevel();
|
|
117
|
+
this.#state.afterClosingBrace = true;
|
|
118
|
+
this.#state.inPropertyValue = false;
|
|
119
|
+
} else if (token === ':' && !this.#state.inPropertyValue && this.#state.seenProperty) {
|
|
120
|
+
this.#builder.addToken(token, startPosition);
|
|
121
|
+
this.#builder.addSoftSpace();
|
|
122
|
+
this.#state.eatWhitespace = true;
|
|
123
|
+
this.#state.inPropertyValue = true;
|
|
124
|
+
this.#state.seenProperty = false;
|
|
125
125
|
return;
|
|
126
126
|
} else if (token === '{') {
|
|
127
|
-
this
|
|
128
|
-
this
|
|
129
|
-
this
|
|
130
|
-
this
|
|
127
|
+
this.#builder.addSoftSpace();
|
|
128
|
+
this.#builder.addToken(token, startPosition);
|
|
129
|
+
this.#builder.addNewLine();
|
|
130
|
+
this.#builder.increaseNestingLevel();
|
|
131
131
|
return;
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
this
|
|
134
|
+
this.#builder.addToken(cssTrimEnd(token), startPosition);
|
|
135
135
|
|
|
136
|
-
if (type === 'comment' && !this
|
|
137
|
-
this
|
|
136
|
+
if (type === 'comment' && !this.#state.inPropertyValue && !this.#state.seenProperty) {
|
|
137
|
+
this.#builder.addNewLine();
|
|
138
138
|
}
|
|
139
|
-
if (token === ';' && this
|
|
140
|
-
this
|
|
141
|
-
this
|
|
139
|
+
if (token === ';' && this.#state.inPropertyValue) {
|
|
140
|
+
this.#state.inPropertyValue = false;
|
|
141
|
+
this.#builder.addNewLine();
|
|
142
142
|
} else if (token === '}') {
|
|
143
|
-
this
|
|
143
|
+
this.#builder.addNewLine();
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
}
|
|
@@ -7,16 +7,16 @@ import type * as Acorn from '../../third_party/acorn/acorn.js';
|
|
|
7
7
|
const SkipSubTreeObject: Object = {};
|
|
8
8
|
|
|
9
9
|
export class ESTreeWalker {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
readonly #beforeVisit: (arg0: Acorn.ESTree.Node) => (Object | undefined);
|
|
11
|
+
readonly #afterVisit: Function;
|
|
12
|
+
#walkNulls: boolean;
|
|
13
13
|
|
|
14
14
|
constructor(
|
|
15
15
|
beforeVisit: (arg0: Acorn.ESTree.Node) => (Object | undefined),
|
|
16
16
|
afterVisit?: ((arg0: Acorn.ESTree.Node) => void)) {
|
|
17
|
-
this
|
|
18
|
-
this
|
|
19
|
-
this
|
|
17
|
+
this.#beforeVisit = beforeVisit;
|
|
18
|
+
this.#afterVisit = afterVisit || function(): void {};
|
|
19
|
+
this.#walkNulls = false;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
@@ -26,15 +26,15 @@ export class ESTreeWalker {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
setWalkNulls(value: boolean): void {
|
|
29
|
-
this
|
|
29
|
+
this.#walkNulls = value;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
walk(ast: Acorn.ESTree.Node): void {
|
|
33
|
-
this
|
|
33
|
+
this.#innerWalk(ast, null);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
if (!node && parent && this
|
|
36
|
+
#innerWalk(node: Acorn.ESTree.Node, parent: Acorn.ESTree.Node|null): void {
|
|
37
|
+
if (!node && parent && this.#walkNulls) {
|
|
38
38
|
const result = ({raw: 'null', value: null, parent: null} as Acorn.ESTree.SimpleLiteral);
|
|
39
39
|
// Otherwise Closure can't handle the definition
|
|
40
40
|
result.type = 'Literal';
|
|
@@ -47,8 +47,8 @@ export class ESTreeWalker {
|
|
|
47
47
|
}
|
|
48
48
|
node.parent = parent;
|
|
49
49
|
|
|
50
|
-
if (this
|
|
51
|
-
this
|
|
50
|
+
if (this.#beforeVisit.call(null, node) === ESTreeWalker.SkipSubtree) {
|
|
51
|
+
this.#afterVisit.call(null, node);
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
54
|
|
|
@@ -62,10 +62,10 @@ export class ESTreeWalker {
|
|
|
62
62
|
const templateLiteral = (node as Acorn.ESTree.TemplateLiteral);
|
|
63
63
|
const expressionsLength = templateLiteral.expressions.length;
|
|
64
64
|
for (let i = 0; i < expressionsLength; ++i) {
|
|
65
|
-
this
|
|
66
|
-
this
|
|
65
|
+
this.#innerWalk(templateLiteral.quasis[i], templateLiteral);
|
|
66
|
+
this.#innerWalk(templateLiteral.expressions[i], templateLiteral);
|
|
67
67
|
}
|
|
68
|
-
this
|
|
68
|
+
this.#innerWalk(templateLiteral.quasis[expressionsLength], templateLiteral);
|
|
69
69
|
} else {
|
|
70
70
|
for (let i = 0; i < walkOrder.length; ++i) {
|
|
71
71
|
// @ts-ignore We are doing type traversal here, but the strings
|
|
@@ -75,19 +75,19 @@ export class ESTreeWalker {
|
|
|
75
75
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
76
76
|
const entity = (node[walkOrder[i]] as any);
|
|
77
77
|
if (Array.isArray(entity)) {
|
|
78
|
-
this
|
|
78
|
+
this.#walkArray((entity as Acorn.ESTree.Node[]), node);
|
|
79
79
|
} else {
|
|
80
|
-
this
|
|
80
|
+
this.#innerWalk((entity as Acorn.ESTree.Node), node);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
this
|
|
85
|
+
this.#afterVisit.call(null, node);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
#walkArray(nodeArray: Acorn.ESTree.Node[], parentNode: Acorn.ESTree.Node|null): void {
|
|
89
89
|
for (let i = 0; i < nodeArray.length; ++i) {
|
|
90
|
-
this
|
|
90
|
+
this.#innerWalk(nodeArray[i], parentNode);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
}
|