chrome-devtools-frontend 1.0.1660788 → 1.0.1661063
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/.agents/skills/evaluate-ai-css-completion/SKILL.md +133 -0
- package/.agents/skills/evaluate-ai-css-completion/scripts/evaluate.js +76 -0
- package/eslint.config.mjs +7 -0
- package/extension-api/ExtensionAPI.d.ts +88 -0
- package/front_end/core/host/InspectorFrontendHost.ts +1 -0
- package/front_end/core/host/InspectorFrontendHostStub.ts +2 -0
- package/front_end/core/platform/StringUtilities.ts +20 -4
- package/front_end/core/sdk/CPUThrottlingManager.ts +2 -0
- package/front_end/core/sdk/DOMDebuggerModel.ts +2 -0
- package/front_end/core/sdk/DOMModel.ts +1 -0
- package/front_end/core/sdk/DebuggerModel.ts +4 -4
- package/front_end/core/sdk/EventBreakpointsModel.ts +2 -0
- package/front_end/core/sdk/FrameManager.ts +1 -0
- package/front_end/core/sdk/IsolateManager.ts +1 -0
- package/front_end/core/sdk/NetworkManager.ts +2 -0
- package/front_end/core/sdk/NetworkRequest.ts +1 -0
- package/front_end/core/sdk/PageResourceLoader.ts +2 -0
- package/front_end/core/sdk/SourceMap.ts +5 -5
- package/front_end/core/sdk/SourceMapManager.ts +3 -2
- package/front_end/core/sdk/TargetManager.ts +4 -0
- package/front_end/entrypoints/main/MainImpl.ts +2 -1
- package/front_end/models/bindings/CompilerScriptMapping.ts +5 -6
- package/front_end/models/bindings/ContentProviderBasedProject.ts +4 -4
- package/front_end/models/bindings/DebuggerLanguagePlugins.ts +3 -4
- package/front_end/models/bindings/DefaultScriptMapping.ts +3 -3
- package/front_end/models/bindings/NetworkProject.ts +1 -10
- package/front_end/models/bindings/ResourceMapping.ts +3 -4
- package/front_end/models/bindings/ResourceScriptMapping.ts +2 -3
- package/front_end/models/bindings/SASSSourceMapping.ts +3 -4
- package/front_end/models/bindings/StylesSourceMapping.ts +3 -3
- package/front_end/models/bindings/TempFile.ts +8 -3
- package/front_end/models/extensions/ExtensionAPI.ts +110 -46
- package/front_end/models/formatter/ScriptFormatter.ts +8 -11
- package/front_end/models/issues_manager/CookieIssue.ts +21 -9
- package/front_end/models/issues_manager/Issue.ts +3 -4
- package/front_end/models/issues_manager/IssueAggregator.ts +0 -9
- package/front_end/models/issues_manager/IssueResolver.ts +2 -2
- package/front_end/models/issues_manager/IssuesManager.ts +136 -137
- package/front_end/models/issues_manager/issues_manager.ts +0 -2
- package/front_end/models/persistence/AutomaticFileSystemWorkspaceBinding.ts +5 -0
- package/front_end/models/source_map_scopes/FunctionCodeResolver.ts +13 -10
- package/front_end/models/workspace/WorkspaceImpl.ts +10 -1
- package/front_end/models/workspace_diff/WorkspaceDiff.ts +10 -4
- package/front_end/panels/ai_assistance/components/ChatMessage.ts +2 -1
- package/front_end/panels/application/FrameDetailsView.ts +1 -1
- package/front_end/panels/application/WebMCPView.ts +38 -43
- package/front_end/panels/application/components/AdsView.ts +201 -30
- package/front_end/panels/application/components/adsView.css +25 -0
- package/front_end/panels/application/preloading/components/RuleSetDetailsView.ts +2 -2
- package/front_end/panels/console/ConsoleView.ts +2 -1
- package/front_end/panels/console/PromptBuilder.ts +2 -1
- package/front_end/panels/emulation/DeviceModeView.ts +52 -70
- package/front_end/panels/issues/IssueView.ts +0 -2
- package/front_end/panels/issues/IssuesPane.ts +1 -8
- package/front_end/panels/js_timeline/js_timeline-meta.ts +3 -2
- package/front_end/panels/linear_memory_inspector/LinearMemoryInspectorController.ts +3 -3
- package/front_end/panels/linear_memory_inspector/LinearMemoryInspectorPane.ts +5 -5
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryHighlightChipList.ts +4 -4
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspector.ts +2 -2
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryNavigator.ts +6 -6
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryValueInterpreter.ts +3 -3
- package/front_end/panels/linear_memory_inspector/components/ValueInterpreterDisplay.ts +8 -9
- package/front_end/panels/linear_memory_inspector/components/ValueInterpreterDisplayUtils.ts +2 -2
- package/front_end/panels/linear_memory_inspector/components/ValueInterpreterSettings.ts +1 -1
- package/front_end/panels/linear_memory_inspector/linear_memory_inspector-meta.ts +2 -2
- package/front_end/panels/network/RequestPayloadView.ts +15 -13
- package/front_end/panels/network/RequestTimingView.ts +95 -127
- package/front_end/panels/profiler/HeapSnapshotView.ts +1 -1
- package/front_end/panels/profiler/WritableProfileHeader.ts +2 -2
- package/front_end/panels/recorder/{components/ControlButton.ts → ControlButton.ts} +9 -10
- package/front_end/panels/recorder/{components/CreateRecordingView.ts → CreateRecordingView.ts} +48 -47
- package/front_end/panels/recorder/{components/ExtensionView.ts → ExtensionView.ts} +8 -8
- package/front_end/panels/recorder/RecorderController.ts +88 -77
- package/front_end/panels/recorder/{components/RecordingListView.ts → RecordingListView.ts} +19 -20
- package/front_end/panels/recorder/{components/RecordingView.ts → RecordingView.ts} +88 -88
- package/front_end/panels/recorder/{components/ReplaySection.ts → ReplaySection.ts} +11 -11
- package/front_end/panels/recorder/{components/SelectorPicker.ts → SelectorPicker.ts} +13 -13
- package/front_end/panels/recorder/{components/StepEditor.ts → StepEditor.ts} +15 -15
- package/front_end/panels/recorder/{components/StepView.ts → StepView.ts} +10 -10
- package/front_end/panels/recorder/{components/TimelineSection.ts → TimelineSection.ts} +2 -2
- package/front_end/panels/recorder/recorder.ts +23 -1
- package/front_end/panels/recorder/util/util.ts +113 -0
- package/front_end/panels/sources/InplaceFormatterEditorAction.ts +2 -2
- package/front_end/panels/sources/SourcesNavigator.ts +2 -3
- package/front_end/panels/sources/TabbedEditorContainer.ts +1 -1
- package/front_end/panels/timeline/IsolateSelector.ts +10 -8
- package/front_end/panels/timeline/TimelinePanel.ts +18 -7
- package/front_end/panels/timeline/TimelineUIUtils.ts +144 -129
- package/front_end/panels/timeline/timeline-meta.ts +3 -2
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/ui/legacy/Treeoutline.ts +3 -0
- package/front_end/ui/legacy/Widget.ts +14 -15
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +11 -7
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +2 -1
- package/front_end/ui/legacy/components/utils/JSPresentationUtils.ts +10 -1
- package/package.json +1 -1
- package/front_end/models/issues_manager/AttributionReportingIssue.ts +0 -247
- package/front_end/models/issues_manager/descriptions/arInsecureContext.md +0 -7
- package/front_end/models/issues_manager/descriptions/arInvalidInfoHeader.md +0 -5
- package/front_end/models/issues_manager/descriptions/arInvalidRegisterOsSourceHeader.md +0 -5
- package/front_end/models/issues_manager/descriptions/arInvalidRegisterOsTriggerHeader.md +0 -5
- package/front_end/models/issues_manager/descriptions/arInvalidRegisterSourceHeader.md +0 -5
- package/front_end/models/issues_manager/descriptions/arInvalidRegisterTriggerHeader.md +0 -5
- package/front_end/models/issues_manager/descriptions/arNavigationRegistrationUniqueScopeAlreadySet.md +0 -5
- package/front_end/models/issues_manager/descriptions/arNavigationRegistrationWithoutTransientUserActivation.md +0 -6
- package/front_end/models/issues_manager/descriptions/arNoRegisterOsSourceHeader.md +0 -5
- package/front_end/models/issues_manager/descriptions/arNoRegisterOsTriggerHeader.md +0 -5
- package/front_end/models/issues_manager/descriptions/arNoRegisterSourceHeader.md +0 -5
- package/front_end/models/issues_manager/descriptions/arNoRegisterTriggerHeader.md +0 -5
- package/front_end/models/issues_manager/descriptions/arNoWebOrOsSupport.md +0 -4
- package/front_end/models/issues_manager/descriptions/arOsSourceIgnored.md +0 -18
- package/front_end/models/issues_manager/descriptions/arOsTriggerIgnored.md +0 -19
- package/front_end/models/issues_manager/descriptions/arPermissionPolicyDisabled.md +0 -8
- package/front_end/models/issues_manager/descriptions/arSourceAndTriggerHeaders.md +0 -9
- package/front_end/models/issues_manager/descriptions/arSourceIgnored.md +0 -13
- package/front_end/models/issues_manager/descriptions/arTriggerIgnored.md +0 -12
- package/front_end/models/issues_manager/descriptions/arUntrustworthyReportingOrigin.md +0 -10
- package/front_end/models/issues_manager/descriptions/arWebAndOsHeaders.md +0 -11
- package/front_end/panels/issues/AttributionReportingIssueDetailsView.ts +0 -182
- package/front_end/panels/recorder/components/components.ts +0 -25
- package/front_end/panels/recorder/components/util.ts +0 -116
- /package/front_end/panels/recorder/{components/controlButton.css → controlButton.css} +0 -0
- /package/front_end/panels/recorder/{components/createRecordingView.css → createRecordingView.css} +0 -0
- /package/front_end/panels/recorder/{components/extensionView.css → extensionView.css} +0 -0
- /package/front_end/panels/recorder/{components/recordingListView.css → recordingListView.css} +0 -0
- /package/front_end/panels/recorder/{components/recordingView.css → recordingView.css} +0 -0
- /package/front_end/panels/recorder/{components/replaySection.css → replaySection.css} +0 -0
- /package/front_end/panels/recorder/{components/selectorPicker.css → selectorPicker.css} +0 -0
- /package/front_end/panels/recorder/{components/startView.css → startView.css} +0 -0
- /package/front_end/panels/recorder/{components/stepEditor.css → stepEditor.css} +0 -0
- /package/front_end/panels/recorder/{components/stepView.css → stepView.css} +0 -0
- /package/front_end/panels/recorder/{components/timelineSection.css → timelineSection.css} +0 -0
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import type * as Common from '../../core/common/common.js';
|
|
6
6
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
7
7
|
import * as Platform from '../../core/platform/platform.js';
|
|
8
|
+
import type * as SDK from '../../core/sdk/sdk.js';
|
|
8
9
|
import * as TextUtils from '../text_utils/text_utils.js';
|
|
9
10
|
import * as Workspace from '../workspace/workspace.js';
|
|
10
11
|
|
|
@@ -26,10 +27,9 @@ interface UISourceCodeData {
|
|
|
26
27
|
export class ContentProviderBasedProject extends Workspace.Workspace.ProjectStore {
|
|
27
28
|
readonly #isServiceProject: boolean;
|
|
28
29
|
readonly #uiSourceCodeToData = new WeakMap<Workspace.UISourceCode.UISourceCode, UISourceCodeData>();
|
|
29
|
-
constructor(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
super(workspace, id, type, displayName);
|
|
30
|
+
constructor(workspace: Workspace.Workspace.WorkspaceImpl, id: string, type: Workspace.Workspace.projectTypes,
|
|
31
|
+
displayName: string, isServiceProject: boolean, target: SDK.Target.Target|null = null) {
|
|
32
|
+
super(workspace, id, type, displayName, target);
|
|
33
33
|
this.#isServiceProject = isServiceProject;
|
|
34
34
|
workspace.addProject(this);
|
|
35
35
|
}
|
|
@@ -1100,10 +1100,9 @@ class ModelData {
|
|
|
1100
1100
|
project: ContentProviderBasedProject;
|
|
1101
1101
|
readonly uiSourceCodeToScripts: Map<Workspace.UISourceCode.UISourceCode, SDK.Script.Script[]>;
|
|
1102
1102
|
constructor(debuggerModel: SDK.DebuggerModel.DebuggerModel, workspace: Workspace.Workspace.WorkspaceImpl) {
|
|
1103
|
-
this.project = new ContentProviderBasedProject(
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
NetworkProject.setTargetForProject(this.project, debuggerModel.target());
|
|
1103
|
+
this.project = new ContentProviderBasedProject(workspace, 'language_plugins::' + debuggerModel.target().id(),
|
|
1104
|
+
Workspace.Workspace.projectTypes.Network, '',
|
|
1105
|
+
false /* isServiceProject */, debuggerModel.target());
|
|
1107
1106
|
|
|
1108
1107
|
this.uiSourceCodeToScripts = new Map();
|
|
1109
1108
|
}
|
|
@@ -23,9 +23,9 @@ export class DefaultScriptMapping implements DebuggerSourceMapping {
|
|
|
23
23
|
debuggerWorkspaceBinding: DebuggerWorkspaceBinding) {
|
|
24
24
|
defaultScriptMappings.add(this);
|
|
25
25
|
this.#debuggerWorkspaceBinding = debuggerWorkspaceBinding;
|
|
26
|
-
this.#project = new ContentProviderBasedProject(
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
this.#project = new ContentProviderBasedProject(workspace, 'debugger:' + debuggerModel.target().id(),
|
|
27
|
+
Workspace.Workspace.projectTypes.Debugger, '',
|
|
28
|
+
true /* isServiceProject */, debuggerModel.target());
|
|
29
29
|
this.#eventListeners = [
|
|
30
30
|
debuggerModel.addEventListener(SDK.DebuggerModel.Events.GlobalObjectCleared, this.globalObjectCleared, this),
|
|
31
31
|
debuggerModel.addEventListener(SDK.DebuggerModel.Events.ParsedScriptSource, this.parsedScriptSource, this),
|
|
@@ -12,7 +12,6 @@ const uiSourceCodeToAttributionMap = new WeakMap<Workspace.UISourceCode.UISource
|
|
|
12
12
|
frame: SDK.ResourceTreeModel.ResourceTreeFrame,
|
|
13
13
|
count: number,
|
|
14
14
|
}>>();
|
|
15
|
-
const projectToTargetMap = new WeakMap<Workspace.Workspace.Project, SDK.Target.Target>();
|
|
16
15
|
|
|
17
16
|
export class NetworkProjectManager extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
|
|
18
17
|
|
|
@@ -132,15 +131,7 @@ export class NetworkProject {
|
|
|
132
131
|
}
|
|
133
132
|
|
|
134
133
|
static targetForUISourceCode(uiSourceCode: Workspace.UISourceCode.UISourceCode): SDK.Target.Target|null {
|
|
135
|
-
return
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
static setTargetForProject(project: Workspace.Workspace.Project, target: SDK.Target.Target): void {
|
|
139
|
-
projectToTargetMap.set(project, target);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
static getTargetForProject(project: Workspace.Workspace.Project): SDK.Target.Target|null {
|
|
143
|
-
return projectToTargetMap.get(project) || null;
|
|
134
|
+
return uiSourceCode.project().target();
|
|
144
135
|
}
|
|
145
136
|
|
|
146
137
|
static framesForUISourceCode(uiSourceCode: Workspace.UISourceCode.UISourceCode):
|
|
@@ -361,10 +361,9 @@ class ModelInfo {
|
|
|
361
361
|
constructor(resourceMapping: ResourceMapping, resourceTreeModel: SDK.ResourceTreeModel.ResourceTreeModel) {
|
|
362
362
|
const target = resourceTreeModel.target();
|
|
363
363
|
this.resourceMapping = resourceMapping;
|
|
364
|
-
this.project = new ContentProviderBasedProject(
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
NetworkProject.setTargetForProject(this.project, target);
|
|
364
|
+
this.project = new ContentProviderBasedProject(resourceMapping.workspace, 'resources:' + target.id(),
|
|
365
|
+
Workspace.Workspace.projectTypes.Network, '',
|
|
366
|
+
false /* isServiceProject */, target);
|
|
368
367
|
|
|
369
368
|
const cssModel = target.model(SDK.CSSModel.CSSModel);
|
|
370
369
|
console.assert(Boolean(cssModel));
|
|
@@ -73,9 +73,8 @@ export class ResourceScriptMapping implements DebuggerSourceMapping {
|
|
|
73
73
|
if (!project) {
|
|
74
74
|
const projectType = script.isContentScript() ? Workspace.Workspace.projectTypes.ContentScripts :
|
|
75
75
|
Workspace.Workspace.projectTypes.Network;
|
|
76
|
-
project = new ContentProviderBasedProject(
|
|
77
|
-
|
|
78
|
-
NetworkProject.setTargetForProject(project, this.debuggerModel.target());
|
|
76
|
+
project = new ContentProviderBasedProject(this.#workspace, projectId, projectType, '' /* displayName */,
|
|
77
|
+
false /* isServiceProject */, this.debuggerModel.target());
|
|
79
78
|
this.#projects.set(projectId, project);
|
|
80
79
|
}
|
|
81
80
|
return project;
|
|
@@ -26,10 +26,9 @@ export class SASSSourceMapping implements SourceMapping {
|
|
|
26
26
|
workspace: Workspace.Workspace.WorkspaceImpl, cssWorkspaceBinding: CSSWorkspaceBinding) {
|
|
27
27
|
this.#sourceMapManager = sourceMapManager;
|
|
28
28
|
this.#cssWorkspaceBinding = cssWorkspaceBinding;
|
|
29
|
-
this.#project = new ContentProviderBasedProject(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
NetworkProject.setTargetForProject(this.#project, target);
|
|
29
|
+
this.#project = new ContentProviderBasedProject(workspace, 'cssSourceMaps:' + target.id(),
|
|
30
|
+
Workspace.Workspace.projectTypes.Network, '',
|
|
31
|
+
false /* isServiceProject */, target);
|
|
33
32
|
|
|
34
33
|
this.#bindings = new Map();
|
|
35
34
|
|
|
@@ -24,9 +24,9 @@ export class StylesSourceMapping implements SourceMapping {
|
|
|
24
24
|
constructor(cssModel: SDK.CSSModel.CSSModel, workspace: Workspace.Workspace.WorkspaceImpl) {
|
|
25
25
|
this.#cssModel = cssModel;
|
|
26
26
|
const target = this.#cssModel.target();
|
|
27
|
-
this.#project =
|
|
28
|
-
workspace, 'css:' + target.id(), Workspace.Workspace.projectTypes.Network, '',
|
|
29
|
-
|
|
27
|
+
this.#project =
|
|
28
|
+
new ContentProviderBasedProject(workspace, 'css:' + target.id(), Workspace.Workspace.projectTypes.Network, '',
|
|
29
|
+
false /* isServiceProject */, target);
|
|
30
30
|
|
|
31
31
|
this.#eventListeners = [
|
|
32
32
|
this.#cssModel.addEventListener(SDK.CSSModel.Events.StyleSheetAdded, this.styleSheetAdded, this),
|
|
@@ -2,12 +2,17 @@
|
|
|
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 '../../core/common/common.js';
|
|
5
|
+
import type * as Common from '../../core/common/common.js';
|
|
6
6
|
|
|
7
7
|
import {ChunkedFileReader, type ChunkedReader} from './FileUtils.js';
|
|
8
8
|
|
|
9
9
|
export class TempFile {
|
|
10
10
|
#lastBlob: Blob|null = null;
|
|
11
|
+
readonly #console: Common.Console.Console;
|
|
12
|
+
|
|
13
|
+
constructor(console: Common.Console.Console) {
|
|
14
|
+
this.#console = console;
|
|
15
|
+
}
|
|
11
16
|
|
|
12
17
|
write(pieces: Array<string|Blob>): void {
|
|
13
18
|
if (this.#lastBlob) {
|
|
@@ -26,7 +31,7 @@ export class TempFile {
|
|
|
26
31
|
|
|
27
32
|
async readRange(startOffset?: number, endOffset?: number): Promise<string|null> {
|
|
28
33
|
if (!this.#lastBlob) {
|
|
29
|
-
|
|
34
|
+
this.#console.error('Attempt to read a temp file that was never written');
|
|
30
35
|
return '';
|
|
31
36
|
}
|
|
32
37
|
const blob = typeof startOffset === 'number' || typeof endOffset === 'number' ?
|
|
@@ -41,7 +46,7 @@ export class TempFile {
|
|
|
41
46
|
reader.readAsText(blob);
|
|
42
47
|
});
|
|
43
48
|
} catch (error) {
|
|
44
|
-
|
|
49
|
+
this.#console.error('Failed to read from temp file: ' + error.message);
|
|
45
50
|
}
|
|
46
51
|
|
|
47
52
|
return reader.result as string | null;
|
|
@@ -459,9 +459,9 @@ namespace APIImpl {
|
|
|
459
459
|
}
|
|
460
460
|
|
|
461
461
|
export interface ExtensionSidebarPane extends ExtensionView, PublicAPI.Chrome.DevTools.ExtensionSidebarPane {
|
|
462
|
-
setExpression(
|
|
463
|
-
|
|
464
|
-
|
|
462
|
+
setExpression(expression: string, rootTitle?: string, evaluateOptions?: PrivateAPI.EvaluateOptions): Promise<void>;
|
|
463
|
+
setExpression(expression: string, rootTitle?: string, evaluateOptions?: PrivateAPI.EvaluateOptions,
|
|
464
|
+
callback?: () => unknown): void;
|
|
465
465
|
}
|
|
466
466
|
|
|
467
467
|
export interface PanelWithSidebar extends ExtensionView, PublicAPI.Chrome.DevTools.PanelWithSidebar {
|
|
@@ -685,14 +685,29 @@ self.injectedExtensionAPI = function(
|
|
|
685
685
|
|
|
686
686
|
(Panels.prototype as
|
|
687
687
|
Pick<APIImpl.Panels, 'create'|'setOpenResourceHandler'|'openResource'|'SearchAction'|'setThemeChangeHandler'>) = {
|
|
688
|
-
create: function(
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
688
|
+
create: function(this: APIImpl.Panels, title: string, _iconPath: string, pagePath: string,
|
|
689
|
+
_callback?: (panel: PublicAPI.Chrome.DevTools.ExtensionPanel) => unknown):
|
|
690
|
+
Promise<PublicAPI.Chrome.DevTools.ExtensionPanel>|
|
|
691
|
+
void {
|
|
692
|
+
const {callback: callbackArg, promise, resolve, reject} =
|
|
693
|
+
callbackOrPromise<PublicAPI.Chrome.DevTools.ExtensionPanel>(arguments);
|
|
694
|
+
|
|
695
|
+
const id = 'extension-panel-' + extensionServer.nextObjectId();
|
|
696
|
+
|
|
697
|
+
const callbackWrapper = (response: unknown): void => {
|
|
698
|
+
if (checkErrorAndReject(response, reject)) {
|
|
699
|
+
return;
|
|
700
|
+
}
|
|
701
|
+
const panel = new (Constructor(ExtensionPanel))(id);
|
|
702
|
+
resolve?.(panel);
|
|
703
|
+
callbackArg?.call(this, panel);
|
|
704
|
+
};
|
|
705
|
+
|
|
706
|
+
extensionServer.sendRequest({command: PrivateAPI.Commands.CreatePanel, id, title, page: pagePath},
|
|
707
|
+
callbackWrapper);
|
|
708
|
+
|
|
709
|
+
return promise;
|
|
710
|
+
} as PublicAPI.Chrome.DevTools.Panels['create'],
|
|
696
711
|
|
|
697
712
|
setOpenResourceHandler: function(
|
|
698
713
|
callback: (resource: PublicAPI.Chrome.DevTools.Resource, lineNumber: number, columnNumber: number) => unknown,
|
|
@@ -746,15 +761,29 @@ self.injectedExtensionAPI = function(
|
|
|
746
761
|
}
|
|
747
762
|
},
|
|
748
763
|
|
|
749
|
-
openResource: function(
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
764
|
+
openResource: function(this: APIImpl.Panels, url: Platform.DevToolsPath.UrlString, lineNumber: number,
|
|
765
|
+
columnNumber?: number|(() => unknown), _callback?: () => unknown): Promise<void>|
|
|
766
|
+
void {
|
|
767
|
+
const {callback: callbackArg, promise, resolve, reject} = callbackOrPromise<unknown>(arguments);
|
|
768
|
+
// Handle older API:
|
|
769
|
+
const columnNumberArg = typeof columnNumber === 'number' ? columnNumber : 0;
|
|
770
|
+
|
|
771
|
+
const callbackWrapper = (response: unknown): void => {
|
|
772
|
+
if (checkErrorAndReject(response, reject)) {
|
|
773
|
+
return;
|
|
774
|
+
}
|
|
775
|
+
// `openResource` isn't supposed to send the response from the backend, but some JavaScript callers
|
|
776
|
+
// might be relying on it so we send it for now.
|
|
777
|
+
resolve?.(response);
|
|
778
|
+
callbackArg?.call(this, response);
|
|
779
|
+
};
|
|
780
|
+
|
|
781
|
+
extensionServer.sendRequest(
|
|
782
|
+
{command: PrivateAPI.Commands.OpenResource, url, lineNumber, columnNumber: columnNumberArg},
|
|
783
|
+
callbackWrapper);
|
|
784
|
+
|
|
785
|
+
return promise as Promise<void>| undefined;
|
|
786
|
+
} as PublicAPI.Chrome.DevTools.Panels['openResource'],
|
|
758
787
|
|
|
759
788
|
get SearchAction(): Record<string, string> {
|
|
760
789
|
return {
|
|
@@ -795,17 +824,28 @@ self.injectedExtensionAPI = function(
|
|
|
795
824
|
|
|
796
825
|
(PanelWithSidebarImpl.prototype as Pick<APIImpl.PanelWithSidebar, 'createSidebarPane'>&
|
|
797
826
|
{__proto__: APIImpl.ExtensionView}) = {
|
|
798
|
-
createSidebarPane: function(
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
827
|
+
createSidebarPane: function(this: APIImpl.PanelWithSidebar, title: string,
|
|
828
|
+
_callback?: (pane: PublicAPI.Chrome.DevTools.ExtensionSidebarPane) => unknown):
|
|
829
|
+
Promise<PublicAPI.Chrome.DevTools.ExtensionSidebarPane>|
|
|
830
|
+
void {
|
|
831
|
+
const {callback: callbackArg, promise, resolve, reject} =
|
|
832
|
+
callbackOrPromise<PublicAPI.Chrome.DevTools.ExtensionSidebarPane>(arguments);
|
|
833
|
+
const id = 'extension-sidebar-' + extensionServer.nextObjectId();
|
|
834
|
+
|
|
835
|
+
const callbackWrapper = (response: unknown): void => {
|
|
836
|
+
if (checkErrorAndReject(response, reject)) {
|
|
837
|
+
return;
|
|
838
|
+
}
|
|
839
|
+
const pane = new (Constructor(ExtensionSidebarPane))(id);
|
|
840
|
+
resolve?.(pane);
|
|
841
|
+
callbackArg?.call(this, pane);
|
|
842
|
+
};
|
|
843
|
+
|
|
844
|
+
extensionServer.sendRequest(
|
|
845
|
+
{command: PrivateAPI.Commands.CreateSidebarPane, panel: this._hostPanelName, id, title}, callbackWrapper);
|
|
846
|
+
|
|
847
|
+
return promise;
|
|
848
|
+
} as PublicAPI.Chrome.DevTools.PanelWithSidebar['createSidebarPane'],
|
|
809
849
|
|
|
810
850
|
__proto__: ExtensionViewImpl.prototype,
|
|
811
851
|
};
|
|
@@ -1125,8 +1165,9 @@ self.injectedExtensionAPI = function(
|
|
|
1125
1165
|
* otherwise.
|
|
1126
1166
|
*/
|
|
1127
1167
|
function checkErrorAndReject(response: unknown, reject?: (error: Error) => void): boolean {
|
|
1128
|
-
const res = response as {isError?: boolean, description?: string, details?: unknown[]};
|
|
1129
|
-
|
|
1168
|
+
const res = response as {isError?: boolean, description?: string, details?: unknown[]} | undefined;
|
|
1169
|
+
// Sometimes the success response from the backend is `undefined`.
|
|
1170
|
+
if (res?.isError && reject) {
|
|
1130
1171
|
reject(new Error('DevTools API encountered an error'));
|
|
1131
1172
|
return true;
|
|
1132
1173
|
}
|
|
@@ -1220,11 +1261,20 @@ self.injectedExtensionAPI = function(
|
|
|
1220
1261
|
extensionServer.sendRequest({command: PrivateAPI.Commands.SetSidebarHeight, id: this._id as string, height});
|
|
1221
1262
|
},
|
|
1222
1263
|
|
|
1223
|
-
setExpression: function(
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1264
|
+
setExpression: function(this: APIImpl.ExtensionSidebarPane, expression: string, rootTitle?: string,
|
|
1265
|
+
evaluateOptions?: PrivateAPI.EvaluateOptions, _callback?: () => unknown): Promise<void>|
|
|
1266
|
+
void {
|
|
1267
|
+
const {callback: callbackArg, promise, resolve, reject} = callbackOrPromise<void>(arguments);
|
|
1268
|
+
|
|
1269
|
+
const callbackWrapper = (response: unknown): void => {
|
|
1270
|
+
if (checkErrorAndReject(response, reject)) {
|
|
1271
|
+
return;
|
|
1272
|
+
}
|
|
1273
|
+
resolve?.();
|
|
1274
|
+
callbackArg?.call(this);
|
|
1275
|
+
};
|
|
1276
|
+
|
|
1277
|
+
extensionServer.sendRequest({
|
|
1228
1278
|
command: PrivateAPI.Commands.SetSidebarContent,
|
|
1229
1279
|
id: this._id as string,
|
|
1230
1280
|
expression,
|
|
@@ -1232,20 +1282,34 @@ self.injectedExtensionAPI = function(
|
|
|
1232
1282
|
evaluateOnPage: true,
|
|
1233
1283
|
evaluateOptions: (typeof evaluateOptions === 'object' ? evaluateOptions : {}),
|
|
1234
1284
|
},
|
|
1235
|
-
|
|
1236
|
-
},
|
|
1285
|
+
callbackWrapper);
|
|
1237
1286
|
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1287
|
+
return promise;
|
|
1288
|
+
} as PublicAPI.Chrome.DevTools.ExtensionSidebarPane['setExpression'],
|
|
1289
|
+
|
|
1290
|
+
setObject: function(this: APIImpl.ExtensionSidebarPane, jsonObject: string, rootTitle?: string,
|
|
1291
|
+
_callback?: () => unknown): Promise<void>|
|
|
1292
|
+
void {
|
|
1293
|
+
const {callback: callbackArg, promise, resolve, reject} = callbackOrPromise<void>(arguments);
|
|
1294
|
+
|
|
1295
|
+
const callbackWrapper = (response: unknown): void => {
|
|
1296
|
+
if (checkErrorAndReject(response, reject)) {
|
|
1297
|
+
return;
|
|
1298
|
+
}
|
|
1299
|
+
resolve?.();
|
|
1300
|
+
callbackArg?.call(this);
|
|
1301
|
+
};
|
|
1302
|
+
|
|
1303
|
+
extensionServer.sendRequest({
|
|
1242
1304
|
command: PrivateAPI.Commands.SetSidebarContent,
|
|
1243
1305
|
id: this._id as string,
|
|
1244
1306
|
expression: jsonObject,
|
|
1245
1307
|
rootTitle,
|
|
1246
1308
|
},
|
|
1247
|
-
|
|
1248
|
-
|
|
1309
|
+
callbackWrapper);
|
|
1310
|
+
|
|
1311
|
+
return promise;
|
|
1312
|
+
} as PublicAPI.Chrome.DevTools.ExtensionSidebarPane['setObject'],
|
|
1249
1313
|
|
|
1250
1314
|
setPage: function(this: APIImpl.ExtensionSidebarPane, page: string): void {
|
|
1251
1315
|
extensionServer.sendRequest({command: PrivateAPI.Commands.SetSidebarPage, id: this._id as string, page});
|
|
@@ -2,7 +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
|
-
import * as Common from '../../core/common/common.js';
|
|
5
|
+
import type * as Common from '../../core/common/common.js';
|
|
6
6
|
import * as Platform from '../../core/platform/platform.js';
|
|
7
7
|
import type * as FormatterActions from '../../entrypoints/formatter_worker/FormatterActions.js';
|
|
8
8
|
|
|
@@ -30,28 +30,25 @@ export interface FormattedContent {
|
|
|
30
30
|
formattedMapping: FormatterSourceMapping;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
export async function format(
|
|
34
|
-
|
|
35
|
-
indent: string =
|
|
36
|
-
Common.Settings.Settings.instance().moduleSetting('text-editor-indent').get()): Promise<FormattedContent> {
|
|
33
|
+
export async function format(settings: Common.Settings.Settings, contentType: Common.ResourceType.ResourceType,
|
|
34
|
+
mimeType: string, content: string, indent?: string): Promise<FormattedContent> {
|
|
37
35
|
if (contentType.isDocumentOrScriptOrStyleSheet()) {
|
|
38
|
-
return await formatScriptContent(mimeType, content, indent);
|
|
36
|
+
return await formatScriptContent(settings, mimeType, content, indent);
|
|
39
37
|
}
|
|
40
38
|
|
|
41
39
|
return {formattedContent: content, formattedMapping: new IdentityFormatterSourceMapping()};
|
|
42
40
|
}
|
|
43
41
|
|
|
44
|
-
export async function formatScriptContent(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
Common.Settings.Settings.instance().moduleSetting('text-editor-indent').get()): Promise<FormattedContent> {
|
|
42
|
+
export async function formatScriptContent(settings: Common.Settings.Settings, mimeType: string, content: string,
|
|
43
|
+
indent?: string): Promise<FormattedContent> {
|
|
44
|
+
const indentString = indent ?? settings.moduleSetting('text-editor-indent').get();
|
|
48
45
|
const originalContent = content.replace(/\r\n?|[\n\u2028\u2029]/g, '\n').replace(/^\uFEFF/, '');
|
|
49
46
|
|
|
50
47
|
const pool = formatterWorkerPool();
|
|
51
48
|
|
|
52
49
|
let formatResult: FormatterActions.FormatResult = {content: originalContent, mapping: {original: [], formatted: []}};
|
|
53
50
|
try {
|
|
54
|
-
formatResult = await pool.format(mimeType, originalContent,
|
|
51
|
+
formatResult = await pool.format(mimeType, originalContent, indentString);
|
|
55
52
|
} catch {
|
|
56
53
|
}
|
|
57
54
|
const originalContentLineEndings = Platform.StringUtilities.findLineEndingIndexes(originalContent);
|
|
@@ -53,6 +53,15 @@ export const enum CookieStatus {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
export class CookieIssue extends Issue<Protocol.Audits.CookieIssueDetails> {
|
|
56
|
+
readonly #frameManager: SDK.FrameManager.FrameManager;
|
|
57
|
+
|
|
58
|
+
constructor(code: string, issueDetails: Protocol.Audits.CookieIssueDetails,
|
|
59
|
+
issuesModel: SDK.IssuesModel.IssuesModel|null, issueId: Protocol.Audits.IssueId|undefined,
|
|
60
|
+
frameManager: SDK.FrameManager.FrameManager) {
|
|
61
|
+
super(code, issueDetails, issuesModel, issueId);
|
|
62
|
+
this.#frameManager = frameManager;
|
|
63
|
+
}
|
|
64
|
+
|
|
56
65
|
cookieId(): string {
|
|
57
66
|
const details = this.details();
|
|
58
67
|
if (details.cookie) {
|
|
@@ -72,9 +81,10 @@ export class CookieIssue extends Issue<Protocol.Audits.CookieIssueDetails> {
|
|
|
72
81
|
/**
|
|
73
82
|
* Returns an array of issues from a given CookieIssueDetails.
|
|
74
83
|
*/
|
|
75
|
-
static createIssuesFromCookieIssueDetails(
|
|
76
|
-
|
|
77
|
-
|
|
84
|
+
static createIssuesFromCookieIssueDetails(cookieIssueDetails: Protocol.Audits.CookieIssueDetails,
|
|
85
|
+
issuesModel: SDK.IssuesModel.IssuesModel|null,
|
|
86
|
+
issueId: Protocol.Audits.IssueId|undefined,
|
|
87
|
+
frameManager: SDK.FrameManager.FrameManager): CookieIssue[] {
|
|
78
88
|
const issues: CookieIssue[] = [];
|
|
79
89
|
|
|
80
90
|
// Exclusion reasons have priority. It means a cookie was blocked. Create an issue
|
|
@@ -86,7 +96,7 @@ export class CookieIssue extends Issue<Protocol.Audits.CookieIssueDetails> {
|
|
|
86
96
|
exclusionReason, cookieIssueDetails.cookieWarningReasons, cookieIssueDetails.operation,
|
|
87
97
|
cookieIssueDetails.cookieUrl as Platform.DevToolsPath.UrlString | undefined);
|
|
88
98
|
if (code) {
|
|
89
|
-
issues.push(new CookieIssue(code, cookieIssueDetails, issuesModel, issueId));
|
|
99
|
+
issues.push(new CookieIssue(code, cookieIssueDetails, issuesModel, issueId, frameManager));
|
|
90
100
|
}
|
|
91
101
|
}
|
|
92
102
|
return issues;
|
|
@@ -99,7 +109,7 @@ export class CookieIssue extends Issue<Protocol.Audits.CookieIssueDetails> {
|
|
|
99
109
|
warningReason, [], cookieIssueDetails.operation,
|
|
100
110
|
cookieIssueDetails.cookieUrl as Platform.DevToolsPath.UrlString | undefined);
|
|
101
111
|
if (code) {
|
|
102
|
-
issues.push(new CookieIssue(code, cookieIssueDetails, issuesModel, issueId));
|
|
112
|
+
issues.push(new CookieIssue(code, cookieIssueDetails, issuesModel, issueId, frameManager));
|
|
103
113
|
}
|
|
104
114
|
}
|
|
105
115
|
}
|
|
@@ -223,7 +233,7 @@ export class CookieIssue extends Issue<Protocol.Audits.CookieIssueDetails> {
|
|
|
223
233
|
}
|
|
224
234
|
|
|
225
235
|
override isCausedByThirdParty(): boolean {
|
|
226
|
-
const outermostFrame =
|
|
236
|
+
const outermostFrame = this.#frameManager.getOutermostFrame();
|
|
227
237
|
return isCausedByThirdParty(outermostFrame, this.details().cookieUrl, this.details().siteForCookies);
|
|
228
238
|
}
|
|
229
239
|
|
|
@@ -257,15 +267,17 @@ export class CookieIssue extends Issue<Protocol.Audits.CookieIssueDetails> {
|
|
|
257
267
|
return;
|
|
258
268
|
}
|
|
259
269
|
|
|
260
|
-
static fromInspectorIssue(
|
|
261
|
-
|
|
270
|
+
static fromInspectorIssue(issuesModel: SDK.IssuesModel.IssuesModel|null,
|
|
271
|
+
inspectorIssue: Protocol.Audits.InspectorIssue,
|
|
272
|
+
frameManager: SDK.FrameManager.FrameManager): CookieIssue[] {
|
|
262
273
|
const cookieIssueDetails = inspectorIssue.details.cookieIssueDetails;
|
|
263
274
|
if (!cookieIssueDetails) {
|
|
264
275
|
console.warn('Cookie issue without details received.');
|
|
265
276
|
return [];
|
|
266
277
|
}
|
|
267
278
|
|
|
268
|
-
return CookieIssue.createIssuesFromCookieIssueDetails(cookieIssueDetails, issuesModel, inspectorIssue.issueId
|
|
279
|
+
return CookieIssue.createIssuesFromCookieIssueDetails(cookieIssueDetails, issuesModel, inspectorIssue.issueId,
|
|
280
|
+
frameManager);
|
|
269
281
|
}
|
|
270
282
|
|
|
271
283
|
static getSubCategory(code: string): CookieIssueSubCategory {
|
|
@@ -2,7 +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
|
-
import * as Common from '../../core/common/common.js';
|
|
5
|
+
import type * 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
8
|
import type * as Platform from '../../core/platform/platform.js';
|
|
@@ -49,7 +49,6 @@ export const enum IssueCategory {
|
|
|
49
49
|
CONTENT_SECURITY_POLICY = 'ContentSecurityPolicy',
|
|
50
50
|
LOW_TEXT_CONTRAST = 'LowTextContrast',
|
|
51
51
|
CORS = 'Cors',
|
|
52
|
-
ATTRIBUTION_REPORTING = 'AttributionReporting',
|
|
53
52
|
QUIRKS_MODE = 'QuirksMode',
|
|
54
53
|
PERMISSION_ELEMENT = 'PermissionElement',
|
|
55
54
|
SELECTIVE_PERMISSIONS_INTERVENTION = 'SelectivePermissionsIntervention',
|
|
@@ -112,8 +111,8 @@ export function unionIssueKind(a: IssueKind, b: IssueKind): IssueKind {
|
|
|
112
111
|
return IssueKind.IMPROVEMENT;
|
|
113
112
|
}
|
|
114
113
|
|
|
115
|
-
export function getShowThirdPartyIssuesSetting(): Common.Settings.Setting<boolean> {
|
|
116
|
-
return
|
|
114
|
+
export function getShowThirdPartyIssuesSetting(settings: Common.Settings.Settings): Common.Settings.Setting<boolean> {
|
|
115
|
+
return settings.createSetting('show-third-party-issues', true);
|
|
117
116
|
}
|
|
118
117
|
|
|
119
118
|
export interface AffectedElement {
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
import * as Common from '../../core/common/common.js';
|
|
6
6
|
import type * as Protocol from '../../generated/protocol.js';
|
|
7
7
|
|
|
8
|
-
import {AttributionReportingIssue} from './AttributionReportingIssue.js';
|
|
9
8
|
import {ContentSecurityPolicyIssue} from './ContentSecurityPolicyIssue.js';
|
|
10
9
|
import {CookieDeprecationMetadataIssue} from './CookieDeprecationMetadataIssue.js';
|
|
11
10
|
import {CookieIssue} from './CookieIssue.js';
|
|
@@ -71,7 +70,6 @@ export class AggregatedIssue extends Issue {
|
|
|
71
70
|
#selectivePermissionsInterventionIssues = new Set<SelectivePermissionsInterventionIssue>();
|
|
72
71
|
#sharedArrayBufferIssues = new Set<SharedArrayBufferIssue>();
|
|
73
72
|
#quirksModeIssues = new Set<QuirksModeIssue>();
|
|
74
|
-
#attributionReportingIssues = new Set<AttributionReportingIssue>();
|
|
75
73
|
#genericIssues = new Set<GenericIssue>();
|
|
76
74
|
#elementAccessibilityIssues = new Set<ElementAccessibilityIssue>();
|
|
77
75
|
#representative?: Issue;
|
|
@@ -158,10 +156,6 @@ export class AggregatedIssue extends Issue {
|
|
|
158
156
|
return this.#quirksModeIssues;
|
|
159
157
|
}
|
|
160
158
|
|
|
161
|
-
getAttributionReportingIssues(): ReadonlySet<AttributionReportingIssue> {
|
|
162
|
-
return this.#attributionReportingIssues;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
159
|
getGenericIssues(): ReadonlySet<GenericIssue> {
|
|
166
160
|
return this.#genericIssues;
|
|
167
161
|
}
|
|
@@ -273,9 +267,6 @@ export class AggregatedIssue extends Issue {
|
|
|
273
267
|
if (issue instanceof QuirksModeIssue) {
|
|
274
268
|
this.#quirksModeIssues.add(issue);
|
|
275
269
|
}
|
|
276
|
-
if (issue instanceof AttributionReportingIssue) {
|
|
277
|
-
this.#attributionReportingIssues.add(issue);
|
|
278
|
-
}
|
|
279
270
|
if (issue instanceof GenericIssue) {
|
|
280
271
|
this.#genericIssues.add(issue);
|
|
281
272
|
}
|
|
@@ -6,7 +6,7 @@ import * as Common from '../../core/common/common.js';
|
|
|
6
6
|
import type * as Protocol from '../../generated/protocol.js';
|
|
7
7
|
|
|
8
8
|
import type {Issue} from './Issue.js';
|
|
9
|
-
import {Events as IssueManagerEvents, type IssueAddedEvent, IssuesManager} from './IssuesManager.js';
|
|
9
|
+
import {Events as IssueManagerEvents, type IssueAddedEvent, type IssuesManager} from './IssuesManager.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* A class that facilitates resolving an issueId to an issue. See `ResolverBase` for more info.
|
|
@@ -15,7 +15,7 @@ export class IssueResolver extends Common.ResolverBase.ResolverBase<Protocol.Aud
|
|
|
15
15
|
#issuesListener: Common.EventTarget.EventDescriptor|null = null;
|
|
16
16
|
#issuesManager: IssuesManager;
|
|
17
17
|
|
|
18
|
-
constructor(issuesManager: IssuesManager
|
|
18
|
+
constructor(issuesManager: IssuesManager) {
|
|
19
19
|
super();
|
|
20
20
|
this.#issuesManager = issuesManager;
|
|
21
21
|
}
|