chrome-devtools-frontend 1.0.1548980 → 1.0.1549484
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/docs/contributing/settings-experiments-features.md +35 -0
- package/docs/styleguide/ux/patterns.md +27 -0
- package/eslint.config.mjs +1 -0
- package/front_end/Tests.js +2 -0
- package/front_end/core/host/InspectorFrontendHost.ts +26 -558
- package/front_end/core/host/InspectorFrontendHostAPI.ts +6 -3
- package/front_end/core/host/InspectorFrontendHostStub.ts +558 -0
- package/front_end/core/host/ResourceLoader.ts +9 -23
- package/front_end/core/host/UserMetrics.ts +4 -4
- package/front_end/core/root/DevToolsContext.ts +4 -0
- package/front_end/core/root/Runtime.ts +10 -0
- package/front_end/core/sdk/CSSMatchedStyles.ts +2 -2
- package/front_end/core/sdk/CSSModel.ts +24 -24
- package/front_end/core/sdk/CSSPropertyParserMatchers.ts +11 -11
- package/front_end/core/sdk/CSSQuery.ts +1 -1
- package/front_end/core/sdk/CSSRule.ts +2 -2
- package/front_end/core/sdk/CSSStyleDeclaration.ts +1 -1
- package/front_end/core/sdk/CSSStyleSheetHeader.ts +1 -1
- package/front_end/core/sdk/DOMModel.ts +3 -0
- package/front_end/core/sdk/NetworkManager.ts +29 -31
- package/front_end/core/sdk/NetworkRequest.ts +4 -0
- package/front_end/core/sdk/OverlayModel.ts +2 -2
- package/front_end/core/sdk/PageResourceLoader.ts +63 -37
- package/front_end/core/sdk/SourceMap.ts +6 -0
- package/front_end/core/sdk/SourceMapCache.ts +21 -0
- package/front_end/core/sdk/SourceMapManager.ts +7 -6
- package/front_end/core/sdk/SourceMapScopesInfo.ts +6 -2
- package/front_end/core/sdk/TargetManager.ts +14 -2
- package/front_end/core/sdk/sdk-meta.ts +13 -0
- package/front_end/entrypoints/formatter_worker/FormatterActions.ts +1 -0
- package/front_end/entrypoints/formatter_worker/ScopeParser.ts +1 -1
- package/front_end/entrypoints/main/MainImpl.ts +13 -3
- package/front_end/foundation/Universe.ts +1 -1
- package/front_end/generated/Deprecation.ts +18 -4
- package/front_end/generated/InspectorBackendCommands.ts +33 -31
- package/front_end/generated/SupportedCSSProperties.js +41 -41
- package/front_end/generated/protocol-mapping.d.ts +12 -0
- package/front_end/generated/protocol-proxy-api.d.ts +11 -0
- package/front_end/generated/protocol.ts +70 -35
- package/front_end/models/ai_assistance/AiConversation.ts +5 -4
- package/front_end/models/ai_assistance/ChangeManager.ts +4 -4
- package/front_end/models/ai_assistance/ConversationHandler.ts +0 -15
- package/front_end/models/ai_assistance/agents/AiAgent.ts +9 -6
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +135 -3
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +24 -0
- package/front_end/models/bindings/CompilerScriptMapping.ts +43 -0
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +19 -0
- package/front_end/models/bindings/ResourceMapping.ts +73 -0
- package/front_end/models/bindings/ResourceScriptMapping.ts +50 -0
- package/front_end/models/issues_manager/GenericIssue.ts +17 -0
- package/front_end/models/issues_manager/descriptions/genericNavigationEntryMarkedSkippable.md +7 -0
- package/front_end/models/javascript_metadata/NativeFunctions.js +7 -3
- package/front_end/models/source_map_scopes/FunctionCodeResolver.snapshot.txt +98 -0
- package/front_end/models/source_map_scopes/FunctionCodeResolver.ts +270 -0
- package/front_end/models/source_map_scopes/source_map_scopes.ts +2 -0
- package/front_end/models/workspace/UISourceCode.ts +51 -44
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +76 -34
- package/front_end/panels/ai_assistance/aiAssistancePanel.css +1 -0
- package/front_end/panels/ai_assistance/components/ChatView.ts +23 -11
- package/front_end/panels/application/AppManifestView.ts +3 -2
- package/front_end/panels/application/FrameDetailsView.ts +5 -6
- package/front_end/panels/application/ServiceWorkersView.ts +2 -2
- package/front_end/panels/application/TrustTokensTreeElement.ts +2 -6
- package/front_end/panels/application/components/PermissionsPolicySection.ts +201 -157
- package/front_end/panels/application/components/ProtocolHandlersView.ts +117 -80
- package/front_end/panels/application/components/ServiceWorkerRouterView.ts +47 -41
- package/front_end/panels/application/components/StorageMetadataView.ts +31 -34
- package/front_end/panels/application/components/TrustTokensView.ts +76 -68
- package/front_end/panels/console/ConsoleView.ts +3 -2
- package/front_end/panels/console/ConsoleViewMessage.ts +6 -4
- package/front_end/panels/console/console-meta.ts +0 -13
- package/front_end/panels/developer_resources/DeveloperResourcesView.ts +3 -1
- package/front_end/panels/elements/CSSRuleValidator.ts +7 -7
- package/front_end/panels/elements/CSSRuleValidatorHelper.ts +2 -2
- package/front_end/panels/elements/ElementsTreeElement.ts +16 -13
- package/front_end/panels/elements/ElementsTreeOutline.ts +2 -1
- package/front_end/panels/elements/LayoutPane.ts +12 -10
- package/front_end/panels/elements/StylePropertyTreeElement.ts +12 -12
- package/front_end/panels/elements/components/AdornerManager.ts +3 -3
- package/front_end/panels/elements/components/StylePropertyEditor.ts +6 -6
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryHighlightChipList.ts +27 -49
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspector.ts +15 -11
- package/front_end/panels/media/PlayerListView.ts +100 -73
- package/front_end/panels/media/playerListView.css +5 -0
- package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +3 -3
- package/front_end/panels/network/RequestConditionsDrawer.ts +5 -5
- package/front_end/panels/network/components/DirectSocketConnectionView.ts +17 -0
- package/front_end/panels/network/resourceChunkView.css +4 -0
- package/front_end/panels/security/CookieControlsView.ts +1 -1
- package/front_end/panels/sensors/LocationsSettingsTab.ts +1 -1
- package/front_end/panels/settings/FrameworkIgnoreListSettingsTab.ts +1 -1
- package/front_end/panels/settings/KeybindsSettingsTab.ts +1 -1
- package/front_end/panels/settings/SettingsScreen.ts +6 -6
- package/front_end/panels/settings/WorkspaceSettingsTab.ts +1 -1
- package/front_end/panels/settings/emulation/DevicesSettingsTab.ts +1 -1
- package/front_end/panels/snippets/SnippetsQuickOpen.ts +4 -2
- package/front_end/panels/sources/CSSPlugin.ts +1 -1
- package/front_end/panels/sources/FilteredUISourceCodeListProvider.ts +13 -5
- package/front_end/panels/sources/GoToLineQuickOpen.ts +4 -2
- package/front_end/panels/sources/NavigatorView.ts +2 -2
- package/front_end/panels/sources/OpenFileQuickOpen.ts +7 -8
- package/front_end/panels/sources/OutlineQuickOpen.ts +6 -3
- package/front_end/panels/sources/ProfilePlugin.ts +21 -12
- package/front_end/panels/sources/UISourceCodeFrame.ts +0 -1
- package/front_end/panels/sources/filteredUISourceCodeListProvider.css +41 -0
- package/front_end/panels/timeline/TimelinePanel.ts +17 -18
- package/front_end/panels/timeline/TimelineSelectorStatsView.ts +3 -3
- package/front_end/panels/timeline/components/insights/SlowCSSSelector.ts +2 -2
- package/front_end/panels/timeline/docs/flame_chart_migration.md +11 -16
- package/front_end/panels/utils/utils.ts +17 -3
- package/front_end/panels/whats_new/ReleaseNoteText.ts +10 -20
- package/front_end/panels/whats_new/resources/WNDT.md +8 -8
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/puppeteer/third_party/mitt/README.chromium +1 -0
- package/front_end/third_party/puppeteer/third_party/parsel/README.chromium +1 -0
- package/front_end/third_party/puppeteer/third_party/rxjs/README.chromium +1 -0
- package/front_end/ui/components/adorners/Adorner.ts +1 -1
- package/front_end/ui/components/annotations/AnnotationRepository.ts +98 -0
- package/front_end/ui/components/annotations/AnnotationType.ts +10 -0
- package/front_end/ui/components/annotations/annotations.ts +6 -0
- package/front_end/ui/components/buttons/Button.ts +1 -1
- package/front_end/ui/components/buttons/FloatingButton.ts +1 -1
- package/front_end/ui/components/chrome_link/ChromeLink.ts +1 -1
- package/front_end/ui/components/dialogs/ButtonDialog.ts +1 -1
- package/front_end/ui/components/dialogs/Dialog.ts +1 -1
- package/front_end/ui/components/dialogs/ShortcutDialog.ts +1 -0
- package/front_end/ui/components/diff_view/DiffView.ts +1 -1
- package/front_end/ui/components/expandable_list/ExpandableList.ts +1 -1
- package/front_end/ui/components/highlighting/HighlightElement.ts +1 -0
- package/front_end/ui/components/highlighting/MarkupHighlight.ts +162 -0
- package/front_end/ui/components/highlighting/highlighting.ts +7 -0
- package/front_end/ui/components/icon_button/FileSourceIcon.ts +1 -1
- package/front_end/ui/components/icon_button/Icon.ts +4 -2
- package/front_end/ui/components/icon_button/IconButton.ts +1 -1
- package/front_end/ui/components/issue_counter/IssueCounter.ts +1 -1
- package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +1 -1
- package/front_end/ui/components/legacy_wrapper/LegacyWrapper.ts +1 -1
- package/front_end/ui/components/linkifier/LinkifierImpl.ts +1 -1
- package/front_end/ui/components/list/List.ts +184 -0
- package/front_end/ui/components/list/list.css +90 -0
- package/front_end/ui/components/{cards/cards.ts → list/lists.ts} +3 -3
- package/front_end/ui/components/markdown_view/CodeBlock.ts +1 -1
- package/front_end/ui/components/markdown_view/MarkdownImage.ts +1 -1
- package/front_end/ui/components/markdown_view/MarkdownLink.ts +1 -1
- package/front_end/ui/components/markdown_view/MarkdownView.ts +1 -1
- package/front_end/ui/components/menus/Menu.ts +1 -1
- package/front_end/ui/components/menus/SelectMenu.ts +1 -1
- package/front_end/ui/components/node_text/NodeText.ts +1 -1
- package/front_end/ui/components/panel_feedback/FeedbackButton.ts +1 -1
- package/front_end/ui/components/panel_feedback/PanelFeedback.ts +1 -1
- package/front_end/ui/components/panel_feedback/PreviewToggle.ts +1 -1
- package/front_end/ui/components/panel_introduction_steps/PanelIntroductionSteps.ts +1 -1
- package/front_end/ui/components/report_view/ReportView.ts +1 -1
- package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +1 -1
- package/front_end/ui/components/settings/SettingCheckbox.ts +1 -1
- package/front_end/ui/components/settings/SettingDeprecationWarning.ts +1 -1
- package/front_end/ui/components/snackbars/Snackbar.ts +1 -1
- package/front_end/ui/components/spinners/Spinner.ts +1 -1
- package/front_end/ui/components/srgb_overlay/SrgbOverlay.ts +1 -1
- package/front_end/ui/components/suggestion_input/SuggestionInput.ts +1 -0
- package/front_end/ui/components/survey_link/SurveyLink.ts +1 -1
- package/front_end/ui/components/switch/SwitchImpl.ts +1 -1
- package/front_end/ui/components/text_editor/TextEditor.ts +1 -0
- package/front_end/ui/components/text_prompt/TextPrompt.ts +1 -1
- package/front_end/ui/components/tooltips/Tooltip.ts +1 -1
- package/front_end/ui/components/tree_outline/TreeOutline.ts +1 -1
- package/front_end/ui/kit/kit.ts +5 -0
- package/front_end/ui/legacy/TabbedPane.ts +98 -0
- package/front_end/ui/legacy/UIUtils.ts +0 -184
- package/front_end/ui/legacy/ViewManager.ts +23 -8
- package/front_end/ui/legacy/ViewRegistration.ts +21 -22
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +5 -4
- package/front_end/ui/legacy/components/perf_ui/LineLevelProfile.ts +73 -35
- package/front_end/ui/legacy/components/perf_ui/LiveHeapProfile.ts +11 -2
- package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +12 -13
- package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +7 -16
- package/front_end/ui/legacy/components/quick_open/HelpQuickOpen.ts +5 -6
- package/front_end/ui/legacy/components/quick_open/filteredListWidget.css +18 -65
- package/front_end/ui/legacy/components/source_frame/JSONView.ts +2 -1
- package/front_end/ui/legacy/tabbedPane.css +10 -0
- package/front_end/ui/visual_logging/KnownContextValues.ts +3 -0
- package/inspector_overlay/README.md +3 -3
- package/mcp/HostBindings.ts +310 -0
- package/mcp/mcp.ts +17 -0
- package/mcp/tsconfig.json +6 -1
- package/package.json +26 -24
- /package/front_end/ui/{components → kit}/cards/Card.ts +0 -0
- /package/front_end/ui/{components → kit}/cards/card.css +0 -0
|
@@ -3,565 +3,25 @@
|
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
5
|
import * as Common from '../common/common.js';
|
|
6
|
-
import * as i18n from '../i18n/i18n.js';
|
|
7
|
-
import * as Platform from '../platform/platform.js';
|
|
8
6
|
import * as Root from '../root/root.js';
|
|
9
7
|
|
|
10
8
|
import {
|
|
11
|
-
type AidaClientResult,
|
|
12
|
-
type AidaCodeCompleteResult,
|
|
13
|
-
type CanShowSurveyResult,
|
|
14
|
-
type ChangeEvent,
|
|
15
|
-
type ClickEvent,
|
|
16
|
-
type ContextMenuDescriptor,
|
|
17
|
-
type DispatchHttpRequestRequest,
|
|
18
|
-
type DispatchHttpRequestResult,
|
|
19
|
-
type DoAidaConversationResult,
|
|
20
|
-
type DragEvent,
|
|
21
|
-
type EnumeratedHistogram,
|
|
22
9
|
EventDescriptors,
|
|
23
|
-
Events,
|
|
24
|
-
type EventTypes,
|
|
25
|
-
type ExtensionDescriptor,
|
|
26
|
-
type FunctionCallEvent,
|
|
27
|
-
type HoverEvent,
|
|
28
|
-
type ImpressionEvent,
|
|
10
|
+
type Events,
|
|
29
11
|
type InspectorFrontendHostAPI,
|
|
30
|
-
type KeyDownEvent,
|
|
31
|
-
type LoadNetworkResourceResult,
|
|
32
|
-
type ResizeEvent,
|
|
33
|
-
type SettingAccessEvent,
|
|
34
|
-
type ShowSurveyResult,
|
|
35
|
-
type SyncInformation,
|
|
36
12
|
} from './InspectorFrontendHostAPI.js';
|
|
13
|
+
import {InspectorFrontendHostStub} from './InspectorFrontendHostStub.js';
|
|
37
14
|
import {streamWrite as resourceLoaderStreamWrite} from './ResourceLoader.js';
|
|
38
15
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
* @description Document title in Inspector Frontend Host of the DevTools window
|
|
42
|
-
* @example {example.com} PH1
|
|
43
|
-
*/
|
|
44
|
-
devtoolsS: 'DevTools - {PH1}',
|
|
45
|
-
} as const;
|
|
46
|
-
const str_ = i18n.i18n.registerUIStrings('core/host/InspectorFrontendHost.ts', UIStrings);
|
|
47
|
-
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
48
|
-
|
|
49
|
-
const MAX_RECORDED_HISTOGRAMS_SIZE = 100;
|
|
50
|
-
const OVERRIDES_FILE_SYSTEM_PATH = '/overrides' as Platform.DevToolsPath.RawPathString;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* The `InspectorFrontendHostStub` is a stub interface used the frontend is loaded like a webpage. Examples:
|
|
54
|
-
* - devtools://devtools/bundled/devtools_app.html
|
|
55
|
-
* - https://chrome-devtools-frontend.appspot.com/serve_rev/@030cc140435b0152645522b9864b75cac6c0a854/worker_app.html
|
|
56
|
-
* - http://localhost:9222/devtools/inspector.html?ws=localhost:9222/devtools/page/xTARGET_IDx
|
|
57
|
-
*
|
|
58
|
-
* When the frontend runs within the native embedder, then the InspectorFrontendHostAPI methods are provided
|
|
59
|
-
* by devtools_compatibility.js. Those leverage `DevToolsAPI.sendMessageToEmbedder()` which match up with
|
|
60
|
-
* the embedder API defined here: https://source.chromium.org/search?q=f:devtools%20f:dispatcher%20f:cc%20symbol:CreateForDevToolsFrontend&sq=&ss=chromium%2Fchromium%2Fsrc
|
|
61
|
-
* The native implementations live in devtools_ui_bindings.cc: https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/devtools/devtools_ui_bindings.cc
|
|
62
|
-
*/
|
|
63
|
-
export class InspectorFrontendHostStub implements InspectorFrontendHostAPI {
|
|
64
|
-
readonly #urlsBeingSaved = new Map<
|
|
65
|
-
Platform.DevToolsPath.RawPathString|Platform.DevToolsPath.UrlString, {isBase64: boolean, buffer: string[]}>();
|
|
66
|
-
#fileSystem: FileSystem|null = null;
|
|
67
|
-
/**
|
|
68
|
-
* Injected bellow in both stub and normal runs via:
|
|
69
|
-
* ```ts
|
|
70
|
-
* InspectorFrontendHostInstance.events = new Common.ObjectWrapper.ObjectWrapper();
|
|
71
|
-
* ```
|
|
72
|
-
*/
|
|
73
|
-
declare events: Common.EventTarget.EventTarget<EventTypes>;
|
|
74
|
-
|
|
75
|
-
recordedCountHistograms:
|
|
76
|
-
Array<{histogramName: string, sample: number, min: number, exclusiveMax: number, bucketSize: number}> = [];
|
|
77
|
-
recordedEnumeratedHistograms: Array<{actionName: EnumeratedHistogram, actionCode: number}> = [];
|
|
78
|
-
recordedPerformanceHistograms: Array<{histogramName: string, duration: number}> = [];
|
|
79
|
-
|
|
80
|
-
constructor() {
|
|
81
|
-
// Guard against errors should this file ever be imported at the top level
|
|
82
|
-
// within a worker - in which case this constructor is run. If there's no
|
|
83
|
-
// document, we can early exit.
|
|
84
|
-
if (typeof document === 'undefined') {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function stopEventPropagation(this: InspectorFrontendHostAPI, event: KeyboardEvent): void {
|
|
89
|
-
// Let browser handle Ctrl+/Ctrl- shortcuts in hosted mode.
|
|
90
|
-
const zoomModifier = this.platform() === 'mac' ? event.metaKey : event.ctrlKey;
|
|
91
|
-
if (zoomModifier && (event.key === '+' || event.key === '-')) {
|
|
92
|
-
event.stopPropagation();
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
document.addEventListener('keydown', event => {
|
|
97
|
-
stopEventPropagation.call(this, (event));
|
|
98
|
-
}, true);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
platform(): string {
|
|
102
|
-
const userAgent = navigator.userAgent;
|
|
103
|
-
if (userAgent.includes('Windows NT')) {
|
|
104
|
-
return 'windows';
|
|
105
|
-
}
|
|
106
|
-
if (userAgent.includes('Mac OS X')) {
|
|
107
|
-
return 'mac';
|
|
108
|
-
}
|
|
109
|
-
return 'linux';
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
loadCompleted(): void {
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
bringToFront(): void {
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
closeWindow(): void {
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
setIsDocked(_isDocked: boolean, callback: () => void): void {
|
|
122
|
-
window.setTimeout(callback, 0);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
showSurvey(_trigger: string, callback: (arg0: ShowSurveyResult) => void): void {
|
|
126
|
-
window.setTimeout(() => callback({surveyShown: false}), 0);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
canShowSurvey(_trigger: string, callback: (arg0: CanShowSurveyResult) => void): void {
|
|
130
|
-
window.setTimeout(() => callback({canShowSurvey: false}), 0);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Requests inspected page to be placed atop of the inspector frontend with specified bounds.
|
|
135
|
-
*/
|
|
136
|
-
setInspectedPageBounds(_bounds: {
|
|
137
|
-
x: number,
|
|
138
|
-
y: number,
|
|
139
|
-
width: number,
|
|
140
|
-
height: number,
|
|
141
|
-
}): void {
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
inspectElementCompleted(): void {
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
setInjectedScriptForOrigin(_origin: string, _script: string): void {
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
inspectedURLChanged(url: Platform.DevToolsPath.UrlString): void {
|
|
151
|
-
document.title = i18nString(UIStrings.devtoolsS, {PH1: url.replace(/^https?:\/\//, '')});
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
copyText(text: string|null|undefined): void {
|
|
155
|
-
if (text === undefined || text === null) {
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
void navigator.clipboard.writeText(text);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
openInNewTab(url: Platform.DevToolsPath.UrlString): void {
|
|
162
|
-
if (Common.ParsedURL.schemeIs(url, 'javascript:')) {
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
window.open(url, '_blank');
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
openSearchResultsInNewTab(_query: string): void {
|
|
169
|
-
Common.Console.Console.instance().error(
|
|
170
|
-
'Search is not enabled in hosted mode. Please inspect using chrome://inspect');
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
showItemInFolder(_fileSystemPath: Platform.DevToolsPath.RawPathString): void {
|
|
174
|
-
Common.Console.Console.instance().error(
|
|
175
|
-
'Show item in folder is not enabled in hosted mode. Please inspect using chrome://inspect');
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
// Reminder: the methods in this class belong to InspectorFrontendHostStub and are typically not executed.
|
|
179
|
-
// InspectorFrontendHostStub is ONLY used in the uncommon case of devtools not being embedded. For example: trace.cafe or http://localhost:9222/devtools/inspector.html?ws=localhost:9222/devtools/page/xTARGET_IDx
|
|
180
|
-
save(
|
|
181
|
-
url: Platform.DevToolsPath.RawPathString|Platform.DevToolsPath.UrlString, content: string, _forceSaveAs: boolean,
|
|
182
|
-
isBase64: boolean): void {
|
|
183
|
-
let buffer = this.#urlsBeingSaved.get(url)?.buffer;
|
|
184
|
-
if (!buffer) {
|
|
185
|
-
buffer = [];
|
|
186
|
-
this.#urlsBeingSaved.set(url, {isBase64, buffer});
|
|
187
|
-
}
|
|
188
|
-
buffer.push(content);
|
|
189
|
-
this.events.dispatchEventToListeners(Events.SavedURL, {url, fileSystemPath: url});
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
append(url: Platform.DevToolsPath.RawPathString|Platform.DevToolsPath.UrlString, content: string): void {
|
|
193
|
-
const buffer = this.#urlsBeingSaved.get(url)?.buffer;
|
|
194
|
-
if (buffer) {
|
|
195
|
-
buffer.push(content);
|
|
196
|
-
this.events.dispatchEventToListeners(Events.AppendedToURL, url);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
close(url: Platform.DevToolsPath.RawPathString|Platform.DevToolsPath.UrlString): void {
|
|
201
|
-
const {isBase64, buffer} = this.#urlsBeingSaved.get(url) || {isBase64: false, buffer: []};
|
|
202
|
-
this.#urlsBeingSaved.delete(url);
|
|
203
|
-
let fileName = '';
|
|
204
|
-
|
|
205
|
-
if (url) {
|
|
206
|
-
try {
|
|
207
|
-
const trimmed = Platform.StringUtilities.trimURL(url);
|
|
208
|
-
fileName = Platform.StringUtilities.removeURLFragment(trimmed);
|
|
209
|
-
} catch {
|
|
210
|
-
// If url is not a valid URL, it is probably a filename.
|
|
211
|
-
fileName = url;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/* eslint-disable-next-line @devtools/no-imperative-dom-api */
|
|
216
|
-
const link = document.createElement('a');
|
|
217
|
-
link.download = fileName;
|
|
218
|
-
let blob;
|
|
219
|
-
if (isBase64) {
|
|
220
|
-
const bytes = Common.Base64.decode(buffer.join(''));
|
|
221
|
-
blob = new Blob([bytes], {type: 'application/gzip'});
|
|
222
|
-
} else {
|
|
223
|
-
blob = new Blob(buffer, {type: 'text/plain'});
|
|
224
|
-
}
|
|
225
|
-
const blobUrl = URL.createObjectURL(blob);
|
|
226
|
-
link.href = blobUrl;
|
|
227
|
-
link.click();
|
|
228
|
-
URL.revokeObjectURL(blobUrl);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
sendMessageToBackend(_message: string): void {
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
recordCountHistogram(histogramName: string, sample: number, min: number, exclusiveMax: number, bucketSize: number):
|
|
235
|
-
void {
|
|
236
|
-
if (this.recordedCountHistograms.length >= MAX_RECORDED_HISTOGRAMS_SIZE) {
|
|
237
|
-
this.recordedCountHistograms.shift();
|
|
238
|
-
}
|
|
239
|
-
this.recordedCountHistograms.push({histogramName, sample, min, exclusiveMax, bucketSize});
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
recordEnumeratedHistogram(actionName: EnumeratedHistogram, actionCode: number, _bucketSize: number): void {
|
|
243
|
-
if (this.recordedEnumeratedHistograms.length >= MAX_RECORDED_HISTOGRAMS_SIZE) {
|
|
244
|
-
this.recordedEnumeratedHistograms.shift();
|
|
245
|
-
}
|
|
246
|
-
this.recordedEnumeratedHistograms.push({actionName, actionCode});
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
recordPerformanceHistogram(histogramName: string, duration: number): void {
|
|
250
|
-
if (this.recordedPerformanceHistograms.length >= MAX_RECORDED_HISTOGRAMS_SIZE) {
|
|
251
|
-
this.recordedPerformanceHistograms.shift();
|
|
252
|
-
}
|
|
253
|
-
this.recordedPerformanceHistograms.push({histogramName, duration});
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
recordUserMetricsAction(_umaName: string): void {
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
recordNewBadgeUsage(_featureName: string): void {
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
connectAutomaticFileSystem(
|
|
263
|
-
_fileSystemPath: Platform.DevToolsPath.RawPathString,
|
|
264
|
-
_fileSystemUUID: string,
|
|
265
|
-
_addIfMissing: boolean,
|
|
266
|
-
callback: (result: {success: boolean}) => void,
|
|
267
|
-
): void {
|
|
268
|
-
queueMicrotask(() => callback({success: false}));
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
disconnectAutomaticFileSystem(_fileSystemPath: Platform.DevToolsPath.RawPathString): void {
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
requestFileSystems(): void {
|
|
275
|
-
this.events.dispatchEventToListeners(Events.FileSystemsLoaded, []);
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
addFileSystem(_type?: string): void {
|
|
279
|
-
const onFileSystem = (fs: FileSystem): void => {
|
|
280
|
-
this.#fileSystem = fs;
|
|
281
|
-
const fileSystem = {
|
|
282
|
-
fileSystemName: 'sandboxedRequestedFileSystem',
|
|
283
|
-
fileSystemPath: OVERRIDES_FILE_SYSTEM_PATH,
|
|
284
|
-
rootURL: 'filesystem:devtools://devtools/isolated/',
|
|
285
|
-
type: 'overrides' as const,
|
|
286
|
-
};
|
|
287
|
-
this.events.dispatchEventToListeners(Events.FileSystemAdded, {fileSystem});
|
|
288
|
-
};
|
|
289
|
-
window.webkitRequestFileSystem(window.TEMPORARY, 1024 * 1024, onFileSystem);
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
removeFileSystem(_fileSystemPath: Platform.DevToolsPath.RawPathString): void {
|
|
293
|
-
const removalCallback = (entries: Entry[]): void => {
|
|
294
|
-
entries.forEach(entry => {
|
|
295
|
-
if (entry.isDirectory) {
|
|
296
|
-
(entry as DirectoryEntry).removeRecursively(() => {});
|
|
297
|
-
} else if (entry.isFile) {
|
|
298
|
-
entry.remove(() => {});
|
|
299
|
-
}
|
|
300
|
-
});
|
|
301
|
-
};
|
|
302
|
-
|
|
303
|
-
if (this.#fileSystem) {
|
|
304
|
-
this.#fileSystem.root.createReader().readEntries(removalCallback);
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
this.#fileSystem = null;
|
|
308
|
-
this.events.dispatchEventToListeners(Events.FileSystemRemoved, OVERRIDES_FILE_SYSTEM_PATH);
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
isolatedFileSystem(_fileSystemId: string, _registeredName: string): FileSystem|null {
|
|
312
|
-
return this.#fileSystem;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
loadNetworkResource(
|
|
316
|
-
url: string, _headers: string, streamId: number, callback: (arg0: LoadNetworkResourceResult) => void): void {
|
|
317
|
-
fetch(url)
|
|
318
|
-
.then(async result => {
|
|
319
|
-
const respBuffer = await result.arrayBuffer();
|
|
320
|
-
const text = await Common.Gzip.arrayBufferToString(respBuffer);
|
|
321
|
-
return text;
|
|
322
|
-
})
|
|
323
|
-
.then(function(text) {
|
|
324
|
-
resourceLoaderStreamWrite(streamId, text);
|
|
325
|
-
callback({
|
|
326
|
-
statusCode: 200,
|
|
327
|
-
headers: undefined,
|
|
328
|
-
messageOverride: undefined,
|
|
329
|
-
netError: undefined,
|
|
330
|
-
netErrorName: undefined,
|
|
331
|
-
urlValid: undefined,
|
|
332
|
-
});
|
|
333
|
-
})
|
|
334
|
-
.catch(function() {
|
|
335
|
-
callback({
|
|
336
|
-
statusCode: 404,
|
|
337
|
-
headers: undefined,
|
|
338
|
-
messageOverride: undefined,
|
|
339
|
-
netError: undefined,
|
|
340
|
-
netErrorName: undefined,
|
|
341
|
-
urlValid: undefined,
|
|
342
|
-
});
|
|
343
|
-
});
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
registerPreference(_name: string, _options: {synced?: boolean}): void {
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
getPreferences(callback: (arg0: Record<string, string>) => void): void {
|
|
350
|
-
const prefs: Record<string, string> = {};
|
|
351
|
-
for (const name in window.localStorage) {
|
|
352
|
-
prefs[name] = window.localStorage[name];
|
|
353
|
-
}
|
|
354
|
-
callback(prefs);
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
getPreference(name: string, callback: (arg0: string) => void): void {
|
|
358
|
-
callback(window.localStorage[name]);
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
setPreference(name: string, value: string): void {
|
|
362
|
-
window.localStorage[name] = value;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
removePreference(name: string): void {
|
|
366
|
-
delete window.localStorage[name];
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
clearPreferences(): void {
|
|
370
|
-
window.localStorage.clear();
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
getSyncInformation(callback: (arg0: SyncInformation) => void): void {
|
|
374
|
-
if ('getSyncInformationForTesting' in globalThis) {
|
|
375
|
-
// @ts-expect-error for testing
|
|
376
|
-
return callback(globalThis.getSyncInformationForTesting());
|
|
377
|
-
}
|
|
378
|
-
callback({
|
|
379
|
-
isSyncActive: false,
|
|
380
|
-
arePreferencesSynced: false,
|
|
381
|
-
});
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
getHostConfig(callback: (hostConfig: Root.Runtime.HostConfig) => void): void {
|
|
385
|
-
// This HostConfig config is used in the hosted mode (see the
|
|
386
|
-
// comment on top of this class). Only add non-default config params
|
|
387
|
-
// here that you want to also apply in the hosted mode. For tests
|
|
388
|
-
// use the hostConfigForTesting override.
|
|
389
|
-
const hostConfigForHostedMode: Root.Runtime.HostConfig = {
|
|
390
|
-
devToolsVeLogging: {
|
|
391
|
-
enabled: true,
|
|
392
|
-
},
|
|
393
|
-
thirdPartyCookieControls: {
|
|
394
|
-
thirdPartyCookieMetadataEnabled: true,
|
|
395
|
-
thirdPartyCookieHeuristicsEnabled: true,
|
|
396
|
-
managedBlockThirdPartyCookies: 'Unset',
|
|
397
|
-
},
|
|
398
|
-
devToolsFlexibleLayout: {
|
|
399
|
-
verticalDrawerEnabled: true,
|
|
400
|
-
},
|
|
401
|
-
devToolsStartingStyleDebugging: {
|
|
402
|
-
enabled: false,
|
|
403
|
-
},
|
|
404
|
-
};
|
|
405
|
-
if ('hostConfigForTesting' in globalThis) {
|
|
406
|
-
const {hostConfigForTesting} = (globalThis as unknown as {hostConfigForTesting: Root.Runtime.HostConfig});
|
|
407
|
-
for (const key of Object.keys(hostConfigForTesting)) {
|
|
408
|
-
const mergeEntry = <K extends keyof Root.Runtime.HostConfig>(key: K): void => {
|
|
409
|
-
if (typeof hostConfigForHostedMode[key] === 'object' && typeof hostConfigForTesting[key] === 'object') {
|
|
410
|
-
// If the config is an object, merge the settings, but preferring
|
|
411
|
-
// the hostConfigForTesting values over the result values.
|
|
412
|
-
hostConfigForHostedMode[key] = {...hostConfigForHostedMode[key], ...hostConfigForTesting[key]};
|
|
413
|
-
} else {
|
|
414
|
-
// Override with the testing config if the value is present + not null/undefined.
|
|
415
|
-
hostConfigForHostedMode[key] = hostConfigForTesting[key] ?? hostConfigForHostedMode[key];
|
|
416
|
-
}
|
|
417
|
-
};
|
|
418
|
-
mergeEntry(key as keyof Root.Runtime.HostConfig);
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
callback(hostConfigForHostedMode);
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
upgradeDraggedFileSystemPermissions(_fileSystem: FileSystem): void {
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
indexPath(_requestId: number, _fileSystemPath: Platform.DevToolsPath.RawPathString, _excludedFolders: string): void {
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
stopIndexing(_requestId: number): void {
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
searchInPath(_requestId: number, _fileSystemPath: Platform.DevToolsPath.RawPathString, _query: string): void {
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
zoomFactor(): number {
|
|
437
|
-
return 1;
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
zoomIn(): void {
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
zoomOut(): void {
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
resetZoom(): void {
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
setWhitelistedShortcuts(_shortcuts: string): void {
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
setEyeDropperActive(_active: boolean): void {
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
showCertificateViewer(_certChain: string[]): void {
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
reattach(_callback: () => void): void {
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
readyForTest(): void {
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
connectionReady(): void {
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
setOpenNewWindowForPopups(_value: boolean): void {
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
setDevicesDiscoveryConfig(_config: Adb.Config): void {
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
setDevicesUpdatesEnabled(_enabled: boolean): void {
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
openRemotePage(_browserId: string, _url: string): void {
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
openNodeFrontend(): void {
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
showContextMenuAtPoint(_x: number, _y: number, _items: ContextMenuDescriptor[], _document: Document): void {
|
|
483
|
-
throw new Error('Soft context menu should be used');
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
/**
|
|
487
|
-
* Think of **Hosted mode** as "non-embedded" mode; you can see a devtools frontend URL as the tab's URL. It's an atypical way that DevTools is run.
|
|
488
|
-
* Whereas in **Non-hosted** (aka "embedded"), DevTools is embedded and fully dockable. It's the common way DevTools is run.
|
|
489
|
-
*
|
|
490
|
-
* **Hosted mode** == we're using the `InspectorFrontendHostStub`. impl. (@see `InspectorFrontendHostStub` class comment)
|
|
491
|
-
* Whereas with **non-hosted** mode, native `DevToolsEmbedderMessageDispatcher` is used for CDP and more. `globalThis.DevToolsAPI` is present.
|
|
492
|
-
*
|
|
493
|
-
* Relationships to other signals:
|
|
494
|
-
* - _Connection_: Hosted-ness does not indicate whether the frontend is _connected to a valid CDP target_.
|
|
495
|
-
* - _Dockability_: Being _"dockable"_ (aka `canDock`) is typically aligned but technically orthogonal.
|
|
496
|
-
* - _URL scheme_: If the main frame's URL scheme is `devtools://`, it's non-hosted.
|
|
497
|
-
*
|
|
498
|
-
* | Example case | Mode | Example devtools |
|
|
499
|
-
* | :------------------------------------------ | :------------- | :---------------------------------------------------------------------------- |
|
|
500
|
-
* | tab URL: `devtools://…` | **NOT Hosted** | `devtools://devtools/bundled/devtools_app.html?targetType=tab&...` |
|
|
501
|
-
* | tab URL: `devtools://…?ws=…` | **NOT Hosted** | `devtools://devtools/bundled/devtools_app.html?ws=localhost:9228/...` |
|
|
502
|
-
* | tab URL: `devtools://…` but no connection | **NOT Hosted** | `devtools://devtools/bundled/trace_app.html` |
|
|
503
|
-
* | tab URL: `https://…` but no connection | **Hosted** | `https://chrome-devtools-frontend.appspot.com/serve_rev/@.../trace_app.html` |
|
|
504
|
-
* | tab URL: `http://…?ws=` (connected) | **Hosted** | `http://localhost:9222/devtools/inspector.html?ws=localhost:9222/...` |
|
|
505
|
-
*/
|
|
506
|
-
isHostedMode(): boolean {
|
|
507
|
-
return true;
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
setAddExtensionCallback(_callback: (arg0: ExtensionDescriptor) => void): void {
|
|
511
|
-
// Extensions are not supported in hosted mode.
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
async initialTargetId(): Promise<string|null> {
|
|
515
|
-
return null;
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
doAidaConversation(_request: string, _streamId: number, callback: (result: DoAidaConversationResult) => void): void {
|
|
519
|
-
callback({
|
|
520
|
-
error: 'Not implemented',
|
|
521
|
-
});
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
registerAidaClientEvent(_request: string, callback: (result: AidaClientResult) => void): void {
|
|
525
|
-
callback({
|
|
526
|
-
error: 'Not implemented',
|
|
527
|
-
});
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
aidaCodeComplete(_request: string, callback: (result: AidaCodeCompleteResult) => void): void {
|
|
531
|
-
callback({
|
|
532
|
-
error: 'Not implemented',
|
|
533
|
-
});
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
dispatchHttpRequest(_request: DispatchHttpRequestRequest, callback: (result: DispatchHttpRequestResult) => void):
|
|
537
|
-
void {
|
|
538
|
-
callback({error: 'Not implemented'});
|
|
539
|
-
}
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
17
|
+
export let InspectorFrontendHostInstance: InspectorFrontendHostAPI;
|
|
540
18
|
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
recordClick(_event: ClickEvent): void {
|
|
546
|
-
}
|
|
547
|
-
recordHover(_event: HoverEvent): void {
|
|
548
|
-
}
|
|
549
|
-
recordDrag(_event: DragEvent): void {
|
|
550
|
-
}
|
|
551
|
-
recordChange(_event: ChangeEvent): void {
|
|
552
|
-
}
|
|
553
|
-
recordKeyDown(_event: KeyDownEvent): void {
|
|
554
|
-
}
|
|
555
|
-
recordSettingAccess(_event: SettingAccessEvent): void {
|
|
556
|
-
}
|
|
557
|
-
recordFunctionCall(_event: FunctionCallEvent): void {
|
|
558
|
-
}
|
|
19
|
+
declare global {
|
|
20
|
+
// Installed by `devtools_compatibility.js` in non-hosted mode, or set to the stub/custom implementation.
|
|
21
|
+
var InspectorFrontendHost: InspectorFrontendHostAPI; // eslint-disable-line @typescript-eslint/naming-convention
|
|
22
|
+
var InspectorFrontendAPI: InspectorFrontendAPIImpl; // eslint-disable-line @typescript-eslint/naming-convention
|
|
559
23
|
}
|
|
560
24
|
|
|
561
|
-
// @ts-expect-error Global injected by devtools_compatibility.js
|
|
562
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
563
|
-
export let InspectorFrontendHostInstance: InspectorFrontendHostStub = globalThis.InspectorFrontendHost;
|
|
564
|
-
|
|
565
25
|
class InspectorFrontendAPIImpl {
|
|
566
26
|
constructor() {
|
|
567
27
|
for (const descriptor of EventDescriptors) {
|
|
@@ -604,15 +64,20 @@ class InspectorFrontendAPIImpl {
|
|
|
604
64
|
*/
|
|
605
65
|
export type InspectorFrontendAPIImplMethods = keyof InspectorFrontendAPIImpl;
|
|
606
66
|
|
|
607
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Installs the provided host bindings implementation as the globally used one by DevTools.
|
|
69
|
+
*
|
|
70
|
+
* - In non-hosted mode this is provided by `devtools_compatibility.js`.
|
|
71
|
+
* - In hosted mode this tends to be the {@link InspectorFrontendHostStub}.
|
|
72
|
+
* - For the MCP server this is a custom node.js specific implementation.
|
|
73
|
+
*
|
|
74
|
+
* Note that missing methods will be copied over from the stub.
|
|
75
|
+
*/
|
|
76
|
+
export function installInspectorFrontendHost(instance: InspectorFrontendHostAPI): void {
|
|
77
|
+
globalThis.InspectorFrontendHost = InspectorFrontendHostInstance = instance;
|
|
608
78
|
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
// Instantiate stub for web-hosted mode if necessary.
|
|
612
|
-
// @ts-expect-error Global injected by devtools_compatibility.js
|
|
613
|
-
globalThis.InspectorFrontendHost = InspectorFrontendHostInstance = new InspectorFrontendHostStub();
|
|
614
|
-
} else {
|
|
615
|
-
// Otherwise add stubs for missing methods that are declared in the interface.
|
|
79
|
+
if (!(instance instanceof InspectorFrontendHostStub)) {
|
|
80
|
+
// Add stubs for missing methods.
|
|
616
81
|
const proto = InspectorFrontendHostStub.prototype;
|
|
617
82
|
for (const name of (Object.getOwnPropertyNames(proto) as Array<keyof InspectorFrontendHostAPI>)) {
|
|
618
83
|
const stub = proto[name];
|
|
@@ -630,10 +95,10 @@ function initializeInspectorFrontendHost(): void {
|
|
|
630
95
|
InspectorFrontendHostInstance.events = new Common.ObjectWrapper.ObjectWrapper();
|
|
631
96
|
}
|
|
632
97
|
|
|
98
|
+
(function(): void {
|
|
633
99
|
// FIXME: This file is included into both apps, since the devtools_app needs the InspectorFrontendHostAPI only,
|
|
634
100
|
// so the host instance should not be initialized there.
|
|
635
|
-
|
|
636
|
-
// @ts-expect-error Global injected by devtools_compatibility.js
|
|
101
|
+
installInspectorFrontendHost(globalThis.InspectorFrontendHost ?? new InspectorFrontendHostStub());
|
|
637
102
|
globalThis.InspectorFrontendAPI = new InspectorFrontendAPIImpl();
|
|
638
103
|
})();
|
|
639
104
|
|
|
@@ -649,3 +114,6 @@ export function isUnderTest(prefs?: Record<string, string>): boolean {
|
|
|
649
114
|
return Common.Settings.Settings.hasInstance() &&
|
|
650
115
|
Common.Settings.Settings.instance().createSetting('isUnderTest', false).get();
|
|
651
116
|
}
|
|
117
|
+
|
|
118
|
+
// The stub class used to be declared here so for backwards compatibility we re-export it from here.
|
|
119
|
+
export {InspectorFrontendHostStub};
|
|
@@ -334,11 +334,13 @@ export interface InspectorFrontendHostAPI {
|
|
|
334
334
|
|
|
335
335
|
requestFileSystems(): void;
|
|
336
336
|
|
|
337
|
-
save(
|
|
337
|
+
save(
|
|
338
|
+
url: Platform.DevToolsPath.RawPathString|Platform.DevToolsPath.UrlString, content: string, forceSaveAs: boolean,
|
|
339
|
+
isBase64: boolean): void;
|
|
338
340
|
|
|
339
|
-
append(url: Platform.DevToolsPath.UrlString, content: string): void;
|
|
341
|
+
append(url: Platform.DevToolsPath.RawPathString|Platform.DevToolsPath.UrlString, content: string): void;
|
|
340
342
|
|
|
341
|
-
close(url: Platform.DevToolsPath.UrlString): void;
|
|
343
|
+
close(url: Platform.DevToolsPath.RawPathString|Platform.DevToolsPath.UrlString): void;
|
|
342
344
|
|
|
343
345
|
searchInPath(requestId: number, fileSystemPath: Platform.DevToolsPath.RawPathString, query: string): void;
|
|
344
346
|
|
|
@@ -439,6 +441,7 @@ export interface InspectorFrontendHostAPI {
|
|
|
439
441
|
dispatchHttpRequest: (request: DispatchHttpRequestRequest, cb: (result: DispatchHttpRequestResult) => void) => void;
|
|
440
442
|
|
|
441
443
|
recordImpression(event: ImpressionEvent): void;
|
|
444
|
+
recordResize(event: ResizeEvent): void;
|
|
442
445
|
recordClick(event: ClickEvent): void;
|
|
443
446
|
recordHover(event: HoverEvent): void;
|
|
444
447
|
recordDrag(event: DragEvent): void;
|