chrome-devtools-frontend 1.0.1689415 → 1.0.1690116
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/eslint.config.mjs +8 -2
- package/front_end/core/common/Object.ts +10 -4
- package/front_end/core/i18n/collect-ui-strings.js +5 -5
- package/front_end/core/i18n/generate-locales-js.js +1 -1
- package/front_end/core/i18n/i18n.ts +6 -0
- package/front_end/core/root/Runtime.ts +0 -5
- package/front_end/core/sdk/CSSMetadata.ts +3 -5
- package/front_end/core/sdk/DOMModel.ts +46 -11
- package/front_end/core/sdk/EmulationModel.ts +18 -0
- package/front_end/core/sdk/SDKSettings.ts +9 -0
- package/front_end/core/sdk/Script.ts +0 -1
- package/front_end/core/sdk/SecurityOrigin.ts +135 -25
- package/front_end/core/sdk/Target.ts +1 -5
- package/front_end/models/ai_assistance/AiUtils.ts +0 -10
- package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +6 -10
- package/front_end/models/ai_assistance/agents/StylingAgent.ts +0 -1
- package/front_end/models/ai_assistance/injected.ts +0 -2
- package/front_end/models/javascript_metadata/NativeFunctions.ts +1 -1
- package/front_end/models/trace/insights/CLSCulprits.ts +1 -2
- package/front_end/models/trace/insights/Cache.ts +1 -3
- package/front_end/models/trace/insights/CharacterSet.ts +1 -3
- package/front_end/models/trace/insights/DOMSize.ts +1 -3
- package/front_end/models/trace/insights/DocumentLatency.ts +1 -3
- package/front_end/models/trace/insights/DuplicatedJavaScript.ts +1 -3
- package/front_end/models/trace/insights/FontDisplay.ts +1 -2
- package/front_end/models/trace/insights/ForcedReflow.ts +1 -2
- package/front_end/models/trace/insights/INPBreakdown.ts +1 -3
- package/front_end/models/trace/insights/ImageDelivery.ts +1 -3
- package/front_end/models/trace/insights/LCPBreakdown.ts +1 -3
- package/front_end/models/trace/insights/LCPDiscovery.ts +1 -3
- package/front_end/models/trace/insights/LegacyJavaScript.ts +1 -3
- package/front_end/models/trace/insights/ModernHTTP.ts +1 -2
- package/front_end/models/trace/insights/NetworkDependencyTree.ts +1 -2
- package/front_end/models/trace/insights/RenderBlocking.ts +1 -3
- package/front_end/models/trace/insights/SlowCSSSelector.ts +1 -3
- package/front_end/models/trace/insights/ThirdParties.ts +1 -3
- package/front_end/models/trace/insights/Viewport.ts +1 -2
- package/front_end/panels/accessibility/ARIAAttributesView.ts +1 -1
- package/front_end/panels/accessibility/AccessibilityAnnouncementRecordingView.ts +3 -3
- package/front_end/panels/accessibility/AccessibilityNodeView.ts +1 -2
- package/front_end/panels/accessibility/AccessibilityStrings.ts +7 -3
- package/front_end/panels/ai_assistance/components/AIv2MarkdownRenderer.ts +2 -2
- package/front_end/panels/ai_assistance/components/AccessibilityAgentMarkdownRenderer.ts +1 -3
- package/front_end/panels/animation/AnimationGroupPreviewUI.ts +1 -1
- package/front_end/panels/animation/AnimationTimeline.ts +1 -1
- package/front_end/panels/animation/AnimationUI.ts +1 -1
- package/front_end/panels/application/AppManifestView.ts +6 -2
- package/front_end/panels/application/ApplicationPanelSidebar.ts +2 -4
- package/front_end/panels/application/BounceTrackingMitigationsTreeElement.ts +1 -1
- package/front_end/panels/application/FrameDetailsView.ts +1 -1
- package/front_end/panels/application/IndexedDBViews.ts +3 -2
- package/front_end/panels/application/ReportingApiTreeElement.ts +1 -1
- package/front_end/panels/application/ReportingApiView.ts +2 -2
- package/front_end/panels/application/ServiceWorkerUpdateCycleView.ts +1 -1
- package/front_end/panels/application/ServiceWorkersView.ts +1 -1
- package/front_end/panels/application/StorageBucketsTreeElement.ts +1 -1
- package/front_end/panels/application/StorageItemsToolbar.ts +6 -2
- package/front_end/panels/application/StorageView.ts +9 -8
- package/front_end/panels/application/TrustTokensTreeElement.ts +1 -1
- package/front_end/panels/application/WebMCPView.ts +2 -1
- package/front_end/panels/application/components/BounceTrackingMitigationsView.ts +1 -1
- package/front_end/panels/application/components/CrashReportContextGrid.ts +1 -1
- package/front_end/panels/application/components/EndpointsGrid.ts +1 -1
- package/front_end/panels/application/components/ReportsGrid.ts +1 -1
- package/front_end/panels/application/components/TrustTokensView.ts +1 -1
- package/front_end/panels/application/preloading/components/MismatchedPreloadingGrid.ts +1 -1
- package/front_end/panels/application/preloading/components/PreloadingGrid.ts +1 -1
- package/front_end/panels/application/preloading/components/RuleSetGrid.ts +7 -2
- package/front_end/panels/application/serviceWorkerUpdateCycleView.css +2 -0
- package/front_end/panels/autofill/AutofillView.ts +2 -2
- package/front_end/panels/browser_debugger/CategorizedBreakpointsSidebarPane.ts +2 -3
- package/front_end/panels/browser_debugger/DOMBreakpointsSidebarPane.ts +1 -1
- package/front_end/panels/changes/ChangesSidebar.ts +56 -15
- package/front_end/panels/changes/ChangesView.ts +1 -1
- package/front_end/panels/console/ConsolePrompt.ts +6 -2
- package/front_end/panels/console/ConsoleSidebar.ts +6 -2
- package/front_end/panels/elements/ElementsTreeElement.ts +12 -0
- package/front_end/panels/elements/ElementsTreeOutline.ts +400 -128
- package/front_end/panels/elements/PropertyRenderer.ts +22 -15
- package/front_end/panels/elements/StandaloneStylesContainer.ts +6 -2
- package/front_end/panels/elements/StylePropertyTreeElement.ts +75 -26
- package/front_end/panels/elements/StylesSidebarPane.ts +6 -2
- package/front_end/panels/elements/elementsTreeOutline.css +4 -0
- package/front_end/panels/emulation/DeviceModeView.ts +6 -1
- package/front_end/panels/emulation/InspectedPagePlaceholder.ts +6 -2
- package/front_end/panels/layer_viewer/LayerDetailsView.ts +6 -2
- package/front_end/panels/layer_viewer/LayerTreeOutline.ts +7 -2
- package/front_end/panels/layer_viewer/Layers3DView.ts +8 -1
- package/front_end/panels/layer_viewer/PaintProfilerView.ts +6 -2
- package/front_end/panels/lighthouse/lighthousePanel.css +5 -5
- package/front_end/panels/lighthouse/lighthouseStartView.css +13 -13
- package/front_end/panels/linear_memory_inspector/LinearMemoryInspectorPane.ts +6 -2
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspector.ts +6 -2
- package/front_end/panels/mobile_throttling/NetworkThrottlingSelector.ts +6 -2
- package/front_end/panels/mobile_throttling/ThrottlingManager.ts +25 -54
- package/front_end/panels/network/NetworkLogView.ts +8 -3
- package/front_end/panels/network/components/RequestHeadersView.css +5 -0
- package/front_end/panels/network/networkLogView.css +4 -0
- package/front_end/panels/network/requestInitiatorViewTree.css +2 -0
- package/front_end/panels/performance_monitor/performanceMonitor.css +3 -3
- package/front_end/panels/profiler/HeapDetachedElementsView.ts +7 -2
- package/front_end/panels/profiler/HeapProfileView.ts +7 -2
- package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +8 -4
- package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +8 -4
- package/front_end/panels/profiler/HeapSnapshotView.ts +15 -6
- package/front_end/panels/profiler/HeapTimelineOverview.ts +6 -2
- package/front_end/panels/profiler/ProfileFlameChartDataProvider.ts +12 -5
- package/front_end/panels/profiler/ProfileLauncherView.ts +6 -2
- package/front_end/panels/profiler/profilesPanel.css +8 -9
- package/front_end/panels/profiler/profilesSidebarTree.css +13 -13
- package/front_end/panels/protocol_monitor/JSONEditor.css +2 -2
- package/front_end/panels/protocol_monitor/JSONEditor.ts +6 -1
- package/front_end/panels/protocol_monitor/protocolMonitor.css +2 -2
- package/front_end/panels/sources/SourcesView.ts +7 -2
- package/front_end/panels/sources/TabbedEditorContainer.ts +6 -2
- package/front_end/panels/sources/UISourceCodeFrame.ts +10 -3
- package/front_end/panels/timeline/AnimationsTrackAppender.ts +1 -1
- package/front_end/panels/timeline/AnnotationHelpers.ts +9 -9
- package/front_end/panels/timeline/CountersGraph.ts +8 -8
- package/front_end/panels/timeline/EventsTimelineTreeView.ts +3 -3
- package/front_end/panels/timeline/ExtensionTrackAppender.ts +1 -1
- package/front_end/panels/timeline/GPUTrackAppender.ts +1 -1
- package/front_end/panels/timeline/InteractionsTrackAppender.ts +1 -1
- package/front_end/panels/timeline/IsolateSelector.ts +2 -2
- package/front_end/panels/timeline/LayoutShiftsTrackAppender.ts +3 -3
- package/front_end/panels/timeline/NetworkTrackAppender.ts +1 -1
- package/front_end/panels/timeline/StatusDialog.ts +5 -6
- package/front_end/panels/timeline/ThirdPartyTreeView.ts +4 -4
- package/front_end/panels/timeline/ThreadAppender.ts +12 -14
- package/front_end/panels/timeline/TimelineController.ts +5 -8
- package/front_end/panels/timeline/TimelineDetailsView.ts +13 -9
- package/front_end/panels/timeline/TimelineEventOverview.ts +4 -4
- package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +17 -17
- package/front_end/panels/timeline/TimelineFlameChartView.ts +8 -3
- package/front_end/panels/timeline/TimelineHistoryManager.ts +8 -8
- package/front_end/panels/timeline/TimelineLoader.ts +1 -1
- package/front_end/panels/timeline/TimelineMiniMap.ts +7 -2
- package/front_end/panels/timeline/TimelinePanel.ts +57 -59
- package/front_end/panels/timeline/TimelineSelectorStatsView.ts +27 -27
- package/front_end/panels/timeline/TimelineTreeView.ts +46 -44
- package/front_end/panels/timeline/TimelineUIUtils.ts +142 -116
- package/front_end/panels/timeline/TimingsTrackAppender.ts +1 -1
- package/front_end/panels/timeline/TrackConfigBanner.ts +4 -4
- package/front_end/panels/timeline/UIDevtoolsUtils.ts +15 -15
- package/front_end/panels/timeline/components/insights/Table.ts +1 -1
- package/front_end/panels/timeline/enable-easter-egg.js +1 -1
- package/front_end/panels/timeline/timeline-meta.ts +30 -30
- package/front_end/panels/timeline/timelineFlameChartView.css +10 -10
- package/front_end/panels/timeline/timelineFlamechartPopover.css +5 -5
- package/front_end/panels/timeline/timelineHistoryManager.css +7 -7
- package/front_end/panels/timeline/timelinePaintProfiler.css +2 -2
- package/front_end/panels/timeline/utils/IgnoreList.ts +4 -4
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/ui/comments/CommentAnchorResolver.ts +12 -3
- package/front_end/ui/comments/CommentOverlayManager.ts +9 -1
- package/front_end/ui/components/buttons/Button.docs.ts +1 -1
- package/front_end/ui/components/buttons/button.css +21 -0
- package/front_end/ui/components/report_view/ReportView.docs.ts +1 -1
- package/front_end/ui/components/snackbars/Snackbars.docs.ts +1 -1
- package/front_end/ui/components/spinners/Spinner.ts +1 -1
- package/front_end/ui/components/spinners/Spinners.docs.ts +1 -1
- package/front_end/ui/components/suggestion_input/SuggestionInput.ts +1 -2
- package/front_end/ui/components/switch/Switch.docs.ts +1 -1
- package/front_end/ui/components/text_editor/AiCodeCompletionProvider.ts +10 -8
- package/front_end/ui/components/text_editor/AiCodeGenerationProvider.ts +2 -1
- package/front_end/ui/components/text_editor/ExecutionPositionHighlighter.ts +2 -2
- package/front_end/ui/components/text_editor/TextEditor.ts +19 -0
- package/front_end/ui/components/text_editor/config.ts +109 -96
- package/front_end/ui/components/text_editor/cursor_tooltip.ts +1 -1
- package/front_end/ui/components/text_editor/theme.ts +1 -1
- package/front_end/ui/components/tooltips/Tooltip.docs.ts +1 -1
- package/front_end/ui/components/tooltips/Tooltip.ts +1 -1
- package/front_end/ui/components/tree_outline/TreeOutlineUtils.ts +4 -1
- package/front_end/ui/kit/cards/Card.ts +1 -1
- package/front_end/ui/kit/icons/Icon.ts +1 -1
- package/front_end/ui/kit/link/Link.docs.ts +1 -1
- package/front_end/ui/kit/link/Link.ts +1 -1
- package/front_end/ui/legacy/ContextMenu.docs.ts +1 -1
- package/front_end/ui/legacy/Dialog.ts +10 -2
- package/front_end/ui/legacy/FilterBar.ts +6 -1
- package/front_end/ui/legacy/RadioButton.docs.ts +1 -1
- package/front_end/ui/legacy/SelectMenu.docs.ts +1 -1
- package/front_end/ui/legacy/Slider.docs.ts +1 -1
- package/front_end/ui/legacy/SplitWidget.ts +5 -1
- package/front_end/ui/legacy/TabbedPane.ts +5 -1
- package/front_end/ui/legacy/components/color_picker/Spectrum.ts +6 -1
- package/front_end/ui/legacy/components/data_grid/ViewportDataGrid.ts +6 -2
- package/front_end/ui/legacy/components/inline_editor/BezierEditor.ts +6 -1
- package/front_end/ui/legacy/components/inline_editor/CSSShadowEditor.ts +6 -2
- package/front_end/ui/legacy/components/object_ui/objectPropertiesSection.css +2 -0
- package/front_end/ui/legacy/components/perf_ui/FilmStripView.ts +6 -1
- package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +6 -2
- package/front_end/ui/legacy/components/perf_ui/TimelineOverviewPane.ts +8 -4
- package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +8 -3
- package/front_end/ui/legacy/components/quick_open/QuickOpen.ts +6 -1
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +7 -2
- package/package.json +2 -2
package/eslint.config.mjs
CHANGED
|
@@ -536,8 +536,6 @@ export default defineConfig([
|
|
|
536
536
|
// certain TypeScript compilation errors after fixes
|
|
537
537
|
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
|
|
538
538
|
|
|
539
|
-
'@typescript-eslint/no-inferrable-types': 'error',
|
|
540
|
-
|
|
541
539
|
'@typescript-eslint/consistent-generic-constructors': 'off',
|
|
542
540
|
|
|
543
541
|
// This is more performant
|
|
@@ -856,6 +854,14 @@ export default defineConfig([
|
|
|
856
854
|
files: ['front_end/legacy_test_runner/**/*'],
|
|
857
855
|
rules: {
|
|
858
856
|
'@devtools/es-modules-import': 'off',
|
|
857
|
+
'@typescript-eslint/ban-ts-comment': 'off',
|
|
858
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
859
|
+
'@typescript-eslint/naming-convention': 'off',
|
|
860
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
861
|
+
'@typescript-eslint/no-floating-promises': 'off',
|
|
862
|
+
'@typescript-eslint/no-unused-vars': 'off',
|
|
863
|
+
'@devtools/no-imperative-dom-api': 'off',
|
|
864
|
+
'jsdoc/require-returns-description': 'off',
|
|
859
865
|
},
|
|
860
866
|
},
|
|
861
867
|
{
|
|
@@ -119,10 +119,16 @@ export type EventMixinBase = {
|
|
|
119
119
|
dispatchDOMEvent ? (event: Event) : void,
|
|
120
120
|
}&object;
|
|
121
121
|
|
|
122
|
-
export
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
122
|
+
export type EventMixin<
|
|
123
|
+
Events,
|
|
124
|
+
Base extends Platform.Constructor.Constructor<EventMixinBase>,
|
|
125
|
+
> = Base & Platform.Constructor.Constructor<EventTarget<Events>>;
|
|
126
|
+
|
|
127
|
+
export function eventMixin<
|
|
128
|
+
Events,
|
|
129
|
+
Base extends Platform.Constructor.Constructor<EventMixinBase>,
|
|
130
|
+
>(base: Base): EventMixin<Events, Base> {
|
|
131
|
+
console.assert((base as unknown) !== HTMLElement);
|
|
126
132
|
return class EventHandling extends base implements EventTarget<Events> {
|
|
127
133
|
// Note that the weird name is due to TSC disallowing private/protected fields in
|
|
128
134
|
// anonmous exported classes. We use a `__` prefix to prevent clashes with `base`.
|
|
@@ -37,7 +37,7 @@ const yargsObject = yargs(hideBin(process.argv))
|
|
|
37
37
|
* @param locale
|
|
38
38
|
* @param strings
|
|
39
39
|
*/
|
|
40
|
-
function convertCtcToLhLAndSave(outputDirectory, locale, strings) {
|
|
40
|
+
async function convertCtcToLhLAndSave(outputDirectory, locale, strings) {
|
|
41
41
|
const outputPath = path.join(outputDirectory, `${locale}.json`);
|
|
42
42
|
|
|
43
43
|
/** @type {Record<string, CtcMessage>} */
|
|
@@ -50,7 +50,7 @@ function convertCtcToLhLAndSave(outputDirectory, locale, strings) {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
const convertedStrings = bakePlaceholders(sortedCtcStrings);
|
|
53
|
-
writeIfChanged(outputPath, JSON.stringify(convertedStrings, null, 2) + '\n');
|
|
53
|
+
await writeIfChanged(outputPath, JSON.stringify(convertedStrings, null, 2) + '\n');
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
const inputDirectories = yargsObject['input-directories'];
|
|
@@ -76,9 +76,9 @@ for (const directory of inputDirectories) {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
const outputDirectory = yargsObject['output-directory'];
|
|
79
|
-
convertCtcToLhLAndSave(outputDirectory, 'en-US', collectedStrings);
|
|
79
|
+
await convertCtcToLhLAndSave(outputDirectory, 'en-US', collectedStrings);
|
|
80
80
|
if (yargsObject['include-en-xl']) {
|
|
81
|
-
convertCtcToLhLAndSave(
|
|
81
|
+
await convertCtcToLhLAndSave(
|
|
82
82
|
outputDirectory,
|
|
83
83
|
'en-XL',
|
|
84
84
|
createPsuedoLocaleStrings(collectedStrings),
|
|
@@ -92,4 +92,4 @@ const depfile = `
|
|
|
92
92
|
${path.join(outputDirectory, 'en-US.json')}: ${files.join(' ')}
|
|
93
93
|
`;
|
|
94
94
|
|
|
95
|
-
writeIfChanged(path.join(outputDirectory, 'collected-ui-strings.d'), depfile);
|
|
95
|
+
await writeIfChanged(path.join(outputDirectory, 'collected-ui-strings.d'), depfile);
|
|
@@ -53,4 +53,4 @@ export const REMOTE_FETCH_PATTERN = '${yargsObject['remote-fetch-pattern']}';
|
|
|
53
53
|
export const LOCAL_FETCH_PATTERN = '${yargsObject['local-fetch-pattern']}';
|
|
54
54
|
`;
|
|
55
55
|
|
|
56
|
-
writeIfChanged(path.join(yargsObject['target-gen-dir'], 'locales.js'), content);
|
|
56
|
+
await writeIfChanged(path.join(yargsObject['target-gen-dir'], 'locales.js'), content);
|
|
@@ -2,12 +2,18 @@
|
|
|
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 type * as Platform from '../platform/platform.js';
|
|
6
|
+
|
|
5
7
|
import * as ByteUtilities from './ByteUtilities.js';
|
|
6
8
|
import * as DevToolsLocale from './DevToolsLocale.js';
|
|
7
9
|
import * as i18n from './i18nImpl.js';
|
|
10
|
+
import type * as i18nTypes from './i18nTypes.js';
|
|
8
11
|
import * as NumberFormatter from './NumberFormatter.js';
|
|
9
12
|
import * as TimeUtilities from './time-utilities.js';
|
|
10
13
|
|
|
14
|
+
export type LocalizeString = (id: string, values?: i18nTypes.Values) => Platform.UIString.LocalizedString;
|
|
15
|
+
export type LazyLocalizeString = () => Platform.UIString.LocalizedString;
|
|
16
|
+
|
|
11
17
|
export {
|
|
12
18
|
ByteUtilities,
|
|
13
19
|
DevToolsLocale,
|
|
@@ -521,10 +521,6 @@ interface DevToolsProtocolMonitor {
|
|
|
521
521
|
enabled: boolean;
|
|
522
522
|
}
|
|
523
523
|
|
|
524
|
-
interface DevToolsWebMCPSupport {
|
|
525
|
-
enabled: boolean;
|
|
526
|
-
}
|
|
527
|
-
|
|
528
524
|
interface DevToolsAdsPanel {
|
|
529
525
|
enabled: boolean;
|
|
530
526
|
}
|
|
@@ -599,7 +595,6 @@ export type HostConfig = Platform.TypeScriptUtilities.RecursivePartial<{
|
|
|
599
595
|
devToolsConsoleInsightsTeasers: ConsoleInsightsTeasers,
|
|
600
596
|
devToolsGeminiRebranding: HostConfigGeminiRebranding,
|
|
601
597
|
devToolsProtocolMonitor: DevToolsProtocolMonitor,
|
|
602
|
-
devToolsWebMCPSupport: DevToolsWebMCPSupport,
|
|
603
598
|
devToolsAdsPanel: DevToolsAdsPanel,
|
|
604
599
|
devToolsUseGcaApi: UseGcaApi,
|
|
605
600
|
devToolsPlusButton: DevToolsPlusButton,
|
|
@@ -440,13 +440,12 @@ export const PositionTryOrderKeywords: PositionTryOrderKeyword[] = [
|
|
|
440
440
|
PositionTryOrderKeyword.MOST_INLINE_SIZE,
|
|
441
441
|
];
|
|
442
442
|
|
|
443
|
-
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
444
443
|
export const VariableNameRegex: RegExp = /(\s*--.*?)/gs;
|
|
445
|
-
|
|
444
|
+
|
|
446
445
|
export const VariableRegex: RegExp = /(var\(\s*--.*?\))/gs;
|
|
447
|
-
|
|
446
|
+
|
|
448
447
|
export const CustomVariableRegex: RegExp = /(var\(*--[\w\d]+-([\w]+-[\w]+)\))/g;
|
|
449
|
-
|
|
448
|
+
|
|
450
449
|
export const URLRegex: RegExp = /url\(\s*('.+?'|".+?"|[^)]+)\s*\)/g;
|
|
451
450
|
|
|
452
451
|
/**
|
|
@@ -457,7 +456,6 @@ export const URLRegex: RegExp = /url\(\s*('.+?'|".+?"|[^)]+)\s*\)/g;
|
|
|
457
456
|
* 'grid', 'grid-template', e.g.
|
|
458
457
|
* [track-#name] "a a ." minmax(50px, auto) [track-#name]
|
|
459
458
|
*/
|
|
460
|
-
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
461
459
|
export const GridAreaRowRegex: RegExp = /((?:\[[\w\- ]+\]\s*)*(?:"[^"]+"|'[^']+'))[^'"\[]*\[?[^'"\[]*/;
|
|
462
460
|
|
|
463
461
|
let cssMetadataInstance: CSSMetadata|null = null;
|
|
@@ -48,6 +48,7 @@ import {RemoteObject} from './RemoteObject.js';
|
|
|
48
48
|
import {Events as ResourceTreeModelEvents, type ResourceTreeFrame, ResourceTreeModel} from './ResourceTreeModel.js';
|
|
49
49
|
import {RuntimeModel} from './RuntimeModel.js';
|
|
50
50
|
import {SDKModel} from './SDKModel.js';
|
|
51
|
+
import {SecurityOrigin} from './SecurityOrigin.js';
|
|
51
52
|
import {Capability, type Target} from './Target.js';
|
|
52
53
|
import type {TargetManager} from './TargetManager.js';
|
|
53
54
|
|
|
@@ -387,6 +388,14 @@ export class DOMNode extends Common.ObjectWrapper.ObjectWrapper<DOMNodeEventType
|
|
|
387
388
|
return this.#topLayerIndex;
|
|
388
389
|
}
|
|
389
390
|
|
|
391
|
+
/**
|
|
392
|
+
* Returns the security origin of the document owning this node, or `null` if
|
|
393
|
+
* this node is not attached to a document.
|
|
394
|
+
*/
|
|
395
|
+
securityOrigin(): SecurityOrigin|null {
|
|
396
|
+
return this.ownerDocument?.securityOrigin() ?? null;
|
|
397
|
+
}
|
|
398
|
+
|
|
390
399
|
adProvenance(): Protocol.Network.AdProvenance|undefined {
|
|
391
400
|
if (this.#adProvenance !== undefined) {
|
|
392
401
|
return this.#adProvenance;
|
|
@@ -1424,6 +1433,8 @@ export class DOMNode extends Common.ObjectWrapper.ObjectWrapper<DOMNodeEventType
|
|
|
1424
1433
|
nodeName: this.nodeName(),
|
|
1425
1434
|
localName: this.localName(),
|
|
1426
1435
|
nodeValue: this.nodeValueInternal,
|
|
1436
|
+
documentURL: this.documentURL,
|
|
1437
|
+
baseURL: this.baseURL,
|
|
1427
1438
|
} as Protocol.DOM.Node) :
|
|
1428
1439
|
new DOMNodeSnapshot(this.domModel());
|
|
1429
1440
|
snapshot.id = this.id;
|
|
@@ -1445,11 +1456,6 @@ export class DOMNode extends Common.ObjectWrapper.ObjectWrapper<DOMNodeEventType
|
|
|
1445
1456
|
snapshot.#isInShadowTree = this.#isInShadowTree;
|
|
1446
1457
|
snapshot.childNodeCountInternal = this.childNodeCountInternal;
|
|
1447
1458
|
|
|
1448
|
-
if (snapshot instanceof DOMDocument && this instanceof DOMDocument) {
|
|
1449
|
-
snapshot.documentURL = this.documentURL;
|
|
1450
|
-
snapshot.baseURL = this.baseURL;
|
|
1451
|
-
}
|
|
1452
|
-
|
|
1453
1459
|
if (!this.childrenInternal && this.childNodeCountInternal > 0) {
|
|
1454
1460
|
await this.getSubtree(1, false);
|
|
1455
1461
|
}
|
|
@@ -1600,15 +1606,45 @@ export class DOMNodeShortcut {
|
|
|
1600
1606
|
export class DOMDocument extends DOMNode {
|
|
1601
1607
|
body: DOMNode|null;
|
|
1602
1608
|
documentElement: DOMNode|null;
|
|
1603
|
-
documentURL: Platform.DevToolsPath.UrlString;
|
|
1604
|
-
baseURL: Platform.DevToolsPath.UrlString;
|
|
1609
|
+
#documentURL: Platform.DevToolsPath.UrlString;
|
|
1610
|
+
#baseURL: Platform.DevToolsPath.UrlString;
|
|
1611
|
+
#securityOrigin: SecurityOrigin;
|
|
1612
|
+
|
|
1605
1613
|
constructor(domModel: DOMModel, payload: Protocol.DOM.Node) {
|
|
1606
1614
|
super(domModel);
|
|
1607
1615
|
this.body = null;
|
|
1608
1616
|
this.documentElement = null;
|
|
1609
1617
|
this.init(this, false, payload);
|
|
1610
|
-
this
|
|
1611
|
-
this
|
|
1618
|
+
this.#documentURL = (payload.documentURL || '') as Platform.DevToolsPath.UrlString;
|
|
1619
|
+
this.#baseURL = (payload.baseURL || '') as Platform.DevToolsPath.UrlString;
|
|
1620
|
+
this.#securityOrigin = SecurityOrigin.create(this.#documentURL);
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1623
|
+
get documentURL(): Platform.DevToolsPath.UrlString {
|
|
1624
|
+
return this.#documentURL;
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
get baseURL(): Platform.DevToolsPath.UrlString {
|
|
1628
|
+
return this.#baseURL;
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
/**
|
|
1632
|
+
* Returns the security origin of this document.
|
|
1633
|
+
*
|
|
1634
|
+
* The security origin is derived from the document URL and is recomputed
|
|
1635
|
+
* when the document navigates to a new URL via `setDocumentURL`.
|
|
1636
|
+
*/
|
|
1637
|
+
override securityOrigin(): SecurityOrigin {
|
|
1638
|
+
return this.#securityOrigin;
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
/**
|
|
1642
|
+
* Updates the document and base URLs, and recomputes the document's security origin.
|
|
1643
|
+
*/
|
|
1644
|
+
setDocumentURL(url: Platform.DevToolsPath.UrlString): void {
|
|
1645
|
+
this.#documentURL = url;
|
|
1646
|
+
this.#baseURL = url;
|
|
1647
|
+
this.#securityOrigin = SecurityOrigin.create(url);
|
|
1612
1648
|
}
|
|
1613
1649
|
}
|
|
1614
1650
|
|
|
@@ -1694,8 +1730,7 @@ export class DOMModel extends SDKModel<EventTypes> {
|
|
|
1694
1730
|
if (node) {
|
|
1695
1731
|
const contentDocument = node.contentDocument();
|
|
1696
1732
|
if (contentDocument && contentDocument.documentURL !== frame.url) {
|
|
1697
|
-
contentDocument.
|
|
1698
|
-
contentDocument.baseURL = frame.url;
|
|
1733
|
+
contentDocument.setDocumentURL(frame.url);
|
|
1699
1734
|
this.dispatchEventToListeners(Events.DocumentURLChanged, contentDocument);
|
|
1700
1735
|
}
|
|
1701
1736
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import type * as ProtocolProxyApi from '../../generated/protocol-proxy-api.js';
|
|
6
6
|
import * as Protocol from '../../generated/protocol.js';
|
|
7
|
+
import type * as Common from '../common/common.js';
|
|
7
8
|
|
|
8
9
|
import {CSSModel} from './CSSModel.js';
|
|
9
10
|
import type {MultitargetNetworkManager} from './NetworkManager.js';
|
|
@@ -12,6 +13,7 @@ import {SDKModel} from './SDKModel.js';
|
|
|
12
13
|
import {
|
|
13
14
|
avifFormatDisabledSettingDescriptor,
|
|
14
15
|
cpuPressureSettingDescriptor,
|
|
16
|
+
dataSaverSettingDescriptor,
|
|
15
17
|
emulateAutoDarkModeSettingDescriptor,
|
|
16
18
|
emulatedCSSMediaFeatureColorGamutSettingDescriptor,
|
|
17
19
|
emulatedCSSMediaFeatureForcedColorsSettingDescriptor,
|
|
@@ -56,6 +58,8 @@ export class EmulationModel extends SDKModel<EmulationModelEventTypes> implement
|
|
|
56
58
|
};
|
|
57
59
|
#screenOrientationLocked: boolean;
|
|
58
60
|
#lockedOrientation: Protocol.Emulation.ScreenOrientation|null;
|
|
61
|
+
readonly #dataSaverSetting: Common.Settings.Setting<DataSaverOverride>;
|
|
62
|
+
readonly #dataSaverChangeListener: () => void;
|
|
59
63
|
|
|
60
64
|
constructor(target: Target) {
|
|
61
65
|
super(target);
|
|
@@ -239,6 +243,15 @@ export class EmulationModel extends SDKModel<EmulationModelEventTypes> implement
|
|
|
239
243
|
updateDisabledImageFormats();
|
|
240
244
|
}
|
|
241
245
|
|
|
246
|
+
this.#dataSaverSetting = settings.resolve(dataSaverSettingDescriptor);
|
|
247
|
+
this.#dataSaverChangeListener = () => {
|
|
248
|
+
void this.setDataSaverOverride(this.#dataSaverSetting.get());
|
|
249
|
+
};
|
|
250
|
+
this.#dataSaverSetting.addChangeListener(this.#dataSaverChangeListener, this);
|
|
251
|
+
if (this.#dataSaverSetting.get() !== DataSaverOverride.UNSET) {
|
|
252
|
+
void this.setDataSaverOverride(this.#dataSaverSetting.get());
|
|
253
|
+
}
|
|
254
|
+
|
|
242
255
|
this.#cpuPressureEnabled = false;
|
|
243
256
|
this.#touchEmulationAllowed = true;
|
|
244
257
|
this.#touchEnabled = false;
|
|
@@ -251,6 +264,11 @@ export class EmulationModel extends SDKModel<EmulationModelEventTypes> implement
|
|
|
251
264
|
target.registerEmulationDispatcher(this);
|
|
252
265
|
}
|
|
253
266
|
|
|
267
|
+
override dispose(): void {
|
|
268
|
+
super.dispose();
|
|
269
|
+
this.#dataSaverSetting.removeChangeListener(this.#dataSaverChangeListener, this);
|
|
270
|
+
}
|
|
271
|
+
|
|
254
272
|
setTouchEmulationAllowed(touchEmulationAllowed: boolean): void {
|
|
255
273
|
this.#touchEmulationAllowed = touchEmulationAllowed;
|
|
256
274
|
}
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
import type * as Protocol from '../../generated/protocol.js';
|
|
6
6
|
import * as Common from '../common/common.js';
|
|
7
7
|
|
|
8
|
+
import {DataSaverOverride} from './EmulationModel.js';
|
|
9
|
+
|
|
8
10
|
export const jsSourceMapsEnabledSettingDescriptor: Common.Settings.SettingDescriptor<boolean> = {
|
|
9
11
|
name: 'js-source-maps-enabled',
|
|
10
12
|
type: Common.Settings.SettingType.BOOLEAN,
|
|
@@ -221,6 +223,13 @@ export const emulatedCSSMediaFeaturePrefersReducedDataSettingDescriptor: Common.
|
|
|
221
223
|
storageType: Common.Settings.SettingStorageType.SESSION,
|
|
222
224
|
};
|
|
223
225
|
|
|
226
|
+
export const dataSaverSettingDescriptor: Common.Settings.SettingDescriptor<DataSaverOverride> = {
|
|
227
|
+
name: 'emulation.data-saver',
|
|
228
|
+
type: Common.Settings.SettingType.ENUM,
|
|
229
|
+
defaultValue: DataSaverOverride.UNSET,
|
|
230
|
+
storageType: Common.Settings.SettingStorageType.SESSION,
|
|
231
|
+
};
|
|
232
|
+
|
|
224
233
|
export const emulatedCSSMediaFeaturePrefersReducedTransparencySettingDescriptor:
|
|
225
234
|
Common.Settings.SettingDescriptor<string> = {
|
|
226
235
|
name: 'emulated-css-media-feature-prefers-reduced-transparency',
|
|
@@ -457,7 +457,6 @@ function frameIdForScript(script: Script): Protocol.Page.FrameId|null {
|
|
|
457
457
|
return resourceTreeModel.mainFrame.id;
|
|
458
458
|
}
|
|
459
459
|
|
|
460
|
-
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
461
460
|
export const sourceURLRegex: RegExp = /^[\x20\t]*\/\/[@#] sourceURL=\s*(\S*?)\s*$/;
|
|
462
461
|
|
|
463
462
|
export async function disassembleWasm(content: string): Promise<TextUtils.WasmDisassembly.WasmDisassembly> {
|
|
@@ -2,47 +2,157 @@
|
|
|
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 * as Common from '../common/common.js';
|
|
6
|
+
import type * as Platform from '../platform/platform.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Internal representation of a security origin:
|
|
10
|
+
* - `origin`: A comparable origin string (`<scheme>://<host>[:<port>]` or path-scoped `file://<host>/<path>`).
|
|
11
|
+
* - `opaque`: An isolated opaque origin uniquely identified by a UUID that never matches any other origin.
|
|
12
|
+
*/
|
|
13
|
+
type InternalOrigin =
|
|
14
|
+
|{readonly type: 'origin', readonly value: string}|{readonly type: 'opaque', readonly uuid: string};
|
|
15
|
+
|
|
16
|
+
/** Exact string matches that represent an invalid or opaque origin. */
|
|
17
|
+
const OPAQUE_EXACT_MATCHES = new Set([
|
|
18
|
+
'',
|
|
19
|
+
'null',
|
|
20
|
+
'undefined',
|
|
21
|
+
'data:',
|
|
22
|
+
'detached',
|
|
23
|
+
]);
|
|
24
|
+
|
|
25
|
+
/** String prefixes for origins that must be treated as opaque (e.g. `about:blank`, `blob:data`). */
|
|
26
|
+
const OPAQUE_PREFIXES = [
|
|
27
|
+
'about:',
|
|
28
|
+
'blob:about',
|
|
29
|
+
'blob:data',
|
|
30
|
+
'blob:null',
|
|
31
|
+
] as const;
|
|
32
|
+
|
|
33
|
+
function isOpaqueUrlString(url: string): boolean {
|
|
34
|
+
const lower = url.trim().toLowerCase();
|
|
35
|
+
if (OPAQUE_EXACT_MATCHES.has(lower)) {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
return OPAQUE_PREFIXES.some(prefix => lower.startsWith(prefix));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* An immutable security origin for an entity in DevTools (such as a document,
|
|
43
|
+
* network request, or storage key).
|
|
44
|
+
*
|
|
45
|
+
* DevTools features that handle user data or execute commands on behalf of the user
|
|
46
|
+
* (such as DevTools AI Assistance and Extensions) must enforce strict origin boundaries
|
|
47
|
+
* to prevent prompt injection and cross-origin data exfiltration.
|
|
48
|
+
*
|
|
49
|
+
* This class serves as the single source of truth for origin comparison and classification:
|
|
50
|
+
*
|
|
51
|
+
* 1. **Standard Origins**: Web URLs (HTTP, HTTPS, WSS) resolve to `<scheme>://<host>[:<port>]`.
|
|
52
|
+
* Two standard origins are same-origin if their scheme, host, and port match.
|
|
53
|
+
*
|
|
54
|
+
* 2. **File URLs (`file://`)**: In the WHATWG web security model, `file://` URLs are assigned
|
|
55
|
+
* opaque origins. In DevTools, however, users frequently debug local files (`file:///path/index.html`).
|
|
56
|
+
* Treating all `file://` URLs as opaque would block the user from inspecting elements or styles within
|
|
57
|
+
* the same file. Conversely, treating all `file://` URLs as a single shared origin would allow a malicious
|
|
58
|
+
* local file to traverse into other local files via iframes (b/524362513).
|
|
59
|
+
* Therefore, DevTools treats `file://` URLs as **path-scoped origins** (`file://<authority><path>`).
|
|
60
|
+
* `isOpaque()` returns `false` for `file://` URLs, and two `file://` URLs are considered same-origin
|
|
61
|
+
* only if their full file path and host match exactly.
|
|
62
|
+
*
|
|
63
|
+
* 3. **Opaque Origins**: Opaque contexts (`data:`, `about:blank`, invalid URLs, or synthetic
|
|
64
|
+
* opaque origins) are backed by unique UUIDs. An opaque origin never matches any other origin,
|
|
65
|
+
* even another opaque origin created from the same URL string.
|
|
66
|
+
*/
|
|
5
67
|
export class SecurityOrigin {
|
|
6
|
-
#
|
|
7
|
-
#opaqueUuid?: string;
|
|
68
|
+
readonly #origin: InternalOrigin;
|
|
8
69
|
|
|
9
|
-
private constructor(
|
|
10
|
-
this.#
|
|
11
|
-
this.#opaqueUuid = opaqueUuid;
|
|
70
|
+
private constructor(origin: InternalOrigin) {
|
|
71
|
+
this.#origin = origin;
|
|
12
72
|
}
|
|
13
73
|
|
|
14
|
-
|
|
15
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Creates a `SecurityOrigin` instance from a raw URL or origin string.
|
|
76
|
+
*
|
|
77
|
+
* - If the URL is determined to be opaque (e.g. `data:`, `about:blank`, empty, `null`),
|
|
78
|
+
* a new unique opaque origin is returned.
|
|
79
|
+
* - If the URL is a `file://` URL, a path-scoped origin (`file://<authority><path>`) is returned.
|
|
80
|
+
* - Otherwise, the standard origin (`<scheme>://<host>[:<port>]`) is extracted and returned.
|
|
81
|
+
*
|
|
82
|
+
* @param rawUrl The raw URL or origin string to evaluate.
|
|
83
|
+
*/
|
|
84
|
+
static create(rawUrl: string): SecurityOrigin {
|
|
85
|
+
if (isOpaqueUrlString(rawUrl)) {
|
|
86
|
+
return SecurityOrigin.createUniqueOpaque();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (rawUrl.toLowerCase().startsWith('file://')) {
|
|
90
|
+
const parsed = Common.ParsedURL.ParsedURL.fromString(rawUrl as Platform.DevToolsPath.UrlString);
|
|
91
|
+
if (!parsed) {
|
|
92
|
+
return SecurityOrigin.createUniqueOpaque();
|
|
93
|
+
}
|
|
94
|
+
const authority = parsed.host + (parsed.port ? ':' + parsed.port : '');
|
|
95
|
+
return new SecurityOrigin({type: 'origin', value: `file://${authority}${parsed.path}`});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const origin = Common.ParsedURL.ParsedURL.extractOrigin(rawUrl as Platform.DevToolsPath.UrlString);
|
|
99
|
+
if (!origin || isOpaqueUrlString(origin)) {
|
|
100
|
+
return SecurityOrigin.createUniqueOpaque();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return new SecurityOrigin({type: 'origin', value: origin});
|
|
16
104
|
}
|
|
17
105
|
|
|
106
|
+
/**
|
|
107
|
+
* Creates a synthetic, unique opaque origin.
|
|
108
|
+
*
|
|
109
|
+
* Useful when an entity (like a sandboxed iframe or detached DOM tree) needs an
|
|
110
|
+
* isolated origin that will never match any other origin in the session.
|
|
111
|
+
*/
|
|
18
112
|
static createUniqueOpaque(): SecurityOrigin {
|
|
19
|
-
return new SecurityOrigin(
|
|
113
|
+
return new SecurityOrigin({type: 'opaque', uuid: crypto.randomUUID()});
|
|
20
114
|
}
|
|
21
115
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
116
|
+
/**
|
|
117
|
+
* Checks whether this security origin is equivalent to another security origin.
|
|
118
|
+
*
|
|
119
|
+
* - Standard origins return `true` if their scheme, host, and port match.
|
|
120
|
+
* - File origins return `true` if their full file path and host match.
|
|
121
|
+
* - Opaque origins return `true` only if both instances have identical UUIDs.
|
|
122
|
+
* - Passing `null` always returns `false`.
|
|
123
|
+
*
|
|
124
|
+
* @param other The other `SecurityOrigin` to compare with.
|
|
125
|
+
*/
|
|
126
|
+
isSameOriginWith(other: SecurityOrigin|null): boolean {
|
|
127
|
+
if (!other) {
|
|
27
128
|
return false;
|
|
28
129
|
}
|
|
29
|
-
|
|
130
|
+
if (this.#origin.type === 'opaque' || other.#origin.type === 'opaque') {
|
|
131
|
+
return this.#origin.type === 'opaque' && other.#origin.type === 'opaque' &&
|
|
132
|
+
this.#origin.uuid === other.#origin.uuid;
|
|
133
|
+
}
|
|
134
|
+
return this.#origin.value === other.#origin.value;
|
|
30
135
|
}
|
|
31
136
|
|
|
137
|
+
/**
|
|
138
|
+
* Returns whether this origin is opaque.
|
|
139
|
+
*
|
|
140
|
+
* Opaque origins include `data:` URLs, `about:blank`, invalid URLs, and instances
|
|
141
|
+
* created via `createUniqueOpaque()`.
|
|
142
|
+
*/
|
|
32
143
|
isOpaque(): boolean {
|
|
33
|
-
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
if (this.#urlOrigin) {
|
|
37
|
-
const lower = this.#urlOrigin.toLowerCase();
|
|
38
|
-
return lower === '' || lower === 'null' || lower === 'data:' || lower.startsWith('about') ||
|
|
39
|
-
lower.startsWith('blob:about') || lower.startsWith('blob:data') || lower.startsWith('blob:null') ||
|
|
40
|
-
lower.startsWith('detached') || lower.startsWith('undefined');
|
|
41
|
-
}
|
|
42
|
-
return false;
|
|
144
|
+
return this.#origin.type === 'opaque';
|
|
43
145
|
}
|
|
44
146
|
|
|
147
|
+
/**
|
|
148
|
+
* Returns a stable string representation of this origin for identification, storage keys,
|
|
149
|
+
* or debugging logs.
|
|
150
|
+
*
|
|
151
|
+
* - For standard origins, returns the serialized origin string (e.g. `https://example.com:8080`).
|
|
152
|
+
* - For file origins, returns the path-scoped origin (e.g. `file:///path/to/file.html`).
|
|
153
|
+
* - For opaque origins, returns the unique UUID string.
|
|
154
|
+
*/
|
|
45
155
|
siteId(): string {
|
|
46
|
-
return this.#
|
|
156
|
+
return this.#origin.type === 'opaque' ? this.#origin.uuid : this.#origin.value;
|
|
47
157
|
}
|
|
48
158
|
}
|
|
@@ -6,7 +6,6 @@ import type * as Protocol from '../../generated/protocol.js';
|
|
|
6
6
|
import * as Common from '../common/common.js';
|
|
7
7
|
import * as Platform from '../platform/platform.js';
|
|
8
8
|
import * as ProtocolClient from '../protocol_client/protocol_client.js';
|
|
9
|
-
import * as Root from '../root/root.js';
|
|
10
9
|
|
|
11
10
|
import {SDKModel, type SDKModelConstructor} from './SDKModel.js';
|
|
12
11
|
import type {TargetManager} from './TargetManager.js';
|
|
@@ -50,10 +49,7 @@ export class Target extends ProtocolClient.InspectorBackend.TargetBase {
|
|
|
50
49
|
this.#capabilitiesMask = Capability.BROWSER | Capability.STORAGE | Capability.DOM | Capability.JS |
|
|
51
50
|
Capability.LOG | Capability.NETWORK | Capability.TARGET | Capability.TRACING | Capability.EMULATION |
|
|
52
51
|
Capability.INPUT | Capability.INSPECTOR | Capability.AUDITS | Capability.WEB_AUTHN | Capability.IO |
|
|
53
|
-
Capability.MEDIA | Capability.EVENT_BREAKPOINTS | Capability.DOM_STORAGE;
|
|
54
|
-
if (Root.Runtime.hostConfig.devToolsWebMCPSupport?.enabled) {
|
|
55
|
-
this.#capabilitiesMask |= Capability.WEB_MCP;
|
|
56
|
-
}
|
|
52
|
+
Capability.MEDIA | Capability.EVENT_BREAKPOINTS | Capability.DOM_STORAGE | Capability.WEB_MCP;
|
|
57
53
|
if (parentTarget?.type() !== Type.FRAME) {
|
|
58
54
|
// This matches backend exposing certain capabilities only for the main frame.
|
|
59
55
|
this.#capabilitiesMask |=
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import * as Common from '../../core/common/common.js';
|
|
6
6
|
import * as Host from '../../core/host/host.js';
|
|
7
7
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
8
|
-
import type * as Platform from '../../core/platform/platform.js';
|
|
9
8
|
import * as Root from '../../core/root/root.js';
|
|
10
9
|
|
|
11
10
|
import {debugLog} from './debug.js';
|
|
@@ -187,15 +186,6 @@ export function getIconName(): string {
|
|
|
187
186
|
return isGeminiBranding() ? 'spark' : 'smart-assistant';
|
|
188
187
|
}
|
|
189
188
|
|
|
190
|
-
export function isSameOrigin(url1: Platform.DevToolsPath.UrlString, url2: Platform.DevToolsPath.UrlString): boolean {
|
|
191
|
-
if (url1.startsWith('data:') || url2.startsWith('data:')) {
|
|
192
|
-
return url1 === url2;
|
|
193
|
-
}
|
|
194
|
-
const origin1 = Common.ParsedURL.ParsedURL.extractOrigin(url1);
|
|
195
|
-
const origin2 = Common.ParsedURL.ParsedURL.extractOrigin(url2);
|
|
196
|
-
return origin1 !== '' && origin1 === origin2;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
189
|
export interface OneShotPromptRequest {
|
|
200
190
|
aidaClient: Host.AidaClient.AidaClient;
|
|
201
191
|
preamble: string;
|
|
@@ -4,11 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Host from '../../../core/host/host.js';
|
|
6
6
|
import * as i18n from '../../../core/i18n/i18n.js';
|
|
7
|
-
import type * as Platform from '../../../core/platform/platform.js';
|
|
8
7
|
import * as Root from '../../../core/root/root.js';
|
|
9
8
|
import * as SDK from '../../../core/sdk/sdk.js';
|
|
10
9
|
import type * as LHModel from '../../lighthouse/lighthouse.js';
|
|
11
|
-
import {isSameOrigin} from '../AiUtils.js';
|
|
12
10
|
import {ChangeManager} from '../ChangeManager.js';
|
|
13
11
|
import {LighthouseFormatter} from '../data_formatters/LighthouseFormatter.js';
|
|
14
12
|
import {debugLog} from '../debug.js';
|
|
@@ -155,11 +153,15 @@ export class AccessibilityAgent extends AiAgent<LHModel.ReporterTypes.ReportJSON
|
|
|
155
153
|
return;
|
|
156
154
|
}
|
|
157
155
|
|
|
158
|
-
const details = await
|
|
156
|
+
const [details, widgets] = await Promise.all([
|
|
157
|
+
lhr.getUserFacingDetails(),
|
|
158
|
+
lhr.getWidgets(),
|
|
159
|
+
]);
|
|
159
160
|
if (details) {
|
|
160
161
|
yield {
|
|
161
162
|
type: ResponseType.CONTEXT,
|
|
162
163
|
details,
|
|
164
|
+
widgets,
|
|
163
165
|
};
|
|
164
166
|
}
|
|
165
167
|
}
|
|
@@ -183,13 +185,7 @@ export class AccessibilityAgent extends AiAgent<LHModel.ReporterTypes.ReportJSON
|
|
|
183
185
|
}
|
|
184
186
|
|
|
185
187
|
const mainDocument = domModel.existingDocument();
|
|
186
|
-
if (!mainDocument) {
|
|
187
|
-
return null;
|
|
188
|
-
}
|
|
189
|
-
const mainDocumentURL = mainDocument.documentURL;
|
|
190
|
-
const nodeDocumentURL = node.ownerDocument?.documentURL ?? '' as Platform.DevToolsPath.UrlString;
|
|
191
|
-
|
|
192
|
-
if (!isSameOrigin(mainDocumentURL, nodeDocumentURL)) {
|
|
188
|
+
if (!mainDocument || !mainDocument.securityOrigin().isSameOriginWith(node.securityOrigin())) {
|
|
193
189
|
return null;
|
|
194
190
|
}
|
|
195
191
|
|
|
@@ -94,7 +94,6 @@ const MULTIMODAL_ENHANCEMENT_PROMPTS: Record<MultimodalInputType, string> = {
|
|
|
94
94
|
[MultimodalInputType.UPLOADED_IMAGE]: promptForUploadedImage + considerationsForMultimodalInputEvaluation,
|
|
95
95
|
};
|
|
96
96
|
|
|
97
|
-
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
98
97
|
export const AI_ASSISTANCE_FILTER_REGEX: string = `\\.${AI_ASSISTANCE_CSS_CLASS_NAME}-.*&`;
|
|
99
98
|
|
|
100
99
|
/**
|
|
@@ -90,7 +90,6 @@ function freestylerBindingFunc(bindingName: string): void {
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
94
93
|
export const freestylerBinding: string = `(${String(freestylerBindingFunc)})('${FREESTYLER_BINDING_NAME}')`;
|
|
95
94
|
|
|
96
95
|
export const PAGE_EXPOSED_FUNCTIONS: string[] = ['setElementStyles'];
|
|
@@ -172,5 +171,4 @@ const setupSetElementStyles = `function setupSetElementStyles(prefix) {
|
|
|
172
171
|
global.setElementStyles = setElementStyles;
|
|
173
172
|
}`;
|
|
174
173
|
|
|
175
|
-
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
176
174
|
export const injectedFunctions: string = `(${setupSetElementStyles})('${AI_ASSISTANCE_CSS_CLASS_NAME}')`;
|
|
@@ -7282,7 +7282,7 @@ export const NativeFunctions: readonly NativeFunctionValue[] = [
|
|
|
7282
7282
|
},
|
|
7283
7283
|
{
|
|
7284
7284
|
name: "RTCDTMFToneChangeEvent",
|
|
7285
|
-
signatures: [["type","eventInitDict"]]
|
|
7285
|
+
signatures: [["type","?eventInitDict"]]
|
|
7286
7286
|
},
|
|
7287
7287
|
{
|
|
7288
7288
|
name: "RTCEncodedAudioFrame",
|
|
@@ -72,8 +72,7 @@ export const UIStrings = {
|
|
|
72
72
|
} as const;
|
|
73
73
|
|
|
74
74
|
const str_ = i18n.i18n.registerUIStrings('models/trace/insights/CLSCulprits.ts', UIStrings);
|
|
75
|
-
export const i18nString:
|
|
76
|
-
Platform.UIString.LocalizedString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
75
|
+
export const i18nString: i18n.LocalizeString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
77
76
|
|
|
78
77
|
export type CLSCulpritsInsightModel = InsightModel<typeof UIStrings, {
|
|
79
78
|
animationFailures: readonly NoncompositedAnimationFailure[],
|