chrome-devtools-frontend 1.0.922849 → 1.0.922924
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/front_end/core/common/Console.ts +5 -1
- package/front_end/core/host/InspectorFrontendHost.ts +6 -5
- package/front_end/core/host/InspectorFrontendHostAPI.ts +102 -0
- package/front_end/core/sdk/CSSModel.ts +8 -4
- package/front_end/core/sdk/Connections.ts +5 -5
- package/front_end/core/sdk/DebuggerModel.ts +8 -5
- package/front_end/entrypoints/inspector_main/InspectorMain.ts +1 -2
- package/front_end/entrypoints/main/MainImpl.ts +4 -7
- package/front_end/entrypoints/node_main/NodeConnectionsPanel.ts +2 -2
- package/front_end/entrypoints/node_main/NodeMain.ts +1 -2
- package/front_end/models/bindings/BreakpointManager.ts +3 -2
- package/front_end/models/extensions/ExtensionServer.ts +2 -2
- package/front_end/models/issues_manager/DeprecationIssue.ts +1 -1
- package/front_end/models/issues_manager/descriptions/CoepCorpNotSameOriginAfterDefaultedToSameOriginByCoep.md +15 -5
- package/front_end/models/issues_manager/descriptions/CoepFrameResourceNeedsCoepHeader.md +7 -3
- package/front_end/models/issues_manager/descriptions/deprecationNavigatorUserAgent.md +1 -1
- package/front_end/models/persistence/IsolatedFileSystemManager.ts +26 -31
- package/front_end/models/persistence/NetworkPersistenceManager.ts +11 -1
- package/front_end/models/workspace/FileManager.ts +5 -7
- package/front_end/panels/console/ConsoleView.ts +3 -5
- package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +10 -10
- package/front_end/panels/css_overview/CSSOverviewController.ts +2 -2
- package/front_end/panels/css_overview/CSSOverviewModel.ts +5 -5
- package/front_end/panels/css_overview/CSSOverviewPanel.ts +21 -20
- package/front_end/panels/css_overview/CSSOverviewUnusedDeclarations.ts +12 -9
- package/front_end/panels/elements/ElementsPanel.ts +2 -3
- package/front_end/panels/layer_viewer/Layers3DView.ts +1 -1
- package/front_end/panels/profiler/CPUProfileFlameChart.ts +5 -3
- package/front_end/ui/legacy/ContextMenu.ts +4 -4
- package/front_end/ui/legacy/ForwardedInputEventHandler.ts +3 -7
- package/front_end/ui/legacy/InspectorView.ts +1 -2
- package/front_end/ui/legacy/Widget.ts +1 -3
- package/front_end/ui/legacy/components/color_picker/ContrastDetails.ts +5 -8
- package/front_end/ui/legacy/components/color_picker/Spectrum.ts +5 -8
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ import {reveal} from './Revealer.js';
|
|
|
7
7
|
|
|
8
8
|
let consoleInstance: Console;
|
|
9
9
|
|
|
10
|
-
export class Console extends ObjectWrapper {
|
|
10
|
+
export class Console extends ObjectWrapper<EventTypes> {
|
|
11
11
|
private readonly messagesInternal: Message[];
|
|
12
12
|
/**
|
|
13
13
|
* Instantiable via the instance() factory below.
|
|
@@ -64,6 +64,10 @@ export enum Events {
|
|
|
64
64
|
MessageAdded = 'messageAdded',
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
export type EventTypes = {
|
|
68
|
+
[Events.MessageAdded]: Message,
|
|
69
|
+
};
|
|
70
|
+
|
|
67
71
|
// TODO(crbug.com/1167717): Make this a const enum again
|
|
68
72
|
// eslint-disable-next-line rulesdir/const_enum
|
|
69
73
|
export enum MessageLevel {
|
|
@@ -36,7 +36,7 @@ import * as i18n from '../i18n/i18n.js';
|
|
|
36
36
|
import * as Platform from '../platform/platform.js';
|
|
37
37
|
import * as Root from '../root/root.js';
|
|
38
38
|
|
|
39
|
-
import type {CanShowSurveyResult, ContextMenuDescriptor, EnumeratedHistogram, ExtensionDescriptor, InspectorFrontendHostAPI, LoadNetworkResourceResult, ShowSurveyResult} from './InspectorFrontendHostAPI.js';
|
|
39
|
+
import type {CanShowSurveyResult, ContextMenuDescriptor, EnumeratedHistogram, EventTypes, ExtensionDescriptor, InspectorFrontendHostAPI, LoadNetworkResourceResult, ShowSurveyResult} from './InspectorFrontendHostAPI.js';
|
|
40
40
|
import {EventDescriptors, Events} from './InspectorFrontendHostAPI.js';
|
|
41
41
|
import {streamWrite as resourceLoaderStreamWrite} from './ResourceLoader.js';
|
|
42
42
|
|
|
@@ -54,8 +54,7 @@ const MAX_RECORDED_HISTOGRAMS_SIZE = 100;
|
|
|
54
54
|
|
|
55
55
|
export class InspectorFrontendHostStub implements InspectorFrontendHostAPI {
|
|
56
56
|
private readonly urlsBeingSaved: Map<string, string[]>;
|
|
57
|
-
|
|
58
|
-
events!: Common.EventTarget.EventTarget<any>;
|
|
57
|
+
events!: Common.EventTarget.EventTarget<EventTypes>;
|
|
59
58
|
private windowVisible?: boolean;
|
|
60
59
|
|
|
61
60
|
recordedEnumeratedHistograms: {actionName: EnumeratedHistogram, actionCode: number}[] = [];
|
|
@@ -379,7 +378,8 @@ class InspectorFrontendAPIImpl {
|
|
|
379
378
|
// Single argument methods get dispatched with the param.
|
|
380
379
|
if (signature.length < 2) {
|
|
381
380
|
try {
|
|
382
|
-
|
|
381
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
382
|
+
InspectorFrontendHostInstance.events.dispatchEventToListeners<any>(name, params[0]);
|
|
383
383
|
} catch (error) {
|
|
384
384
|
console.error(error + ' ' + error.stack);
|
|
385
385
|
}
|
|
@@ -392,7 +392,8 @@ class InspectorFrontendAPIImpl {
|
|
|
392
392
|
data[signature[i]] = params[i];
|
|
393
393
|
}
|
|
394
394
|
try {
|
|
395
|
-
|
|
395
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
396
|
+
InspectorFrontendHostInstance.events.dispatchEventToListeners<any>(name, data);
|
|
396
397
|
} catch (error) {
|
|
397
398
|
console.error(error + ' ' + error.stack);
|
|
398
399
|
}
|
|
@@ -68,6 +68,108 @@ export const EventDescriptors = [
|
|
|
68
68
|
[Events.ShowPanel, 'showPanel', ['panelName']],
|
|
69
69
|
];
|
|
70
70
|
|
|
71
|
+
export interface DispatchMessageChunkEvent {
|
|
72
|
+
messageChunk: string;
|
|
73
|
+
messageSize: number;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface EyeDropperPickedColorEvent {
|
|
77
|
+
r: number;
|
|
78
|
+
g: number;
|
|
79
|
+
b: number;
|
|
80
|
+
a: number;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface DevToolsFileSystem {
|
|
84
|
+
type: string;
|
|
85
|
+
fileSystemName: string;
|
|
86
|
+
rootURL: string;
|
|
87
|
+
fileSystemPath: string;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface FileSystemAddedEvent {
|
|
91
|
+
errorMessage?: string;
|
|
92
|
+
fileSystem: DevToolsFileSystem|null;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface FilesChangedEvent {
|
|
96
|
+
changed: string[];
|
|
97
|
+
added: string[];
|
|
98
|
+
removed: string[];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface IndexingEvent {
|
|
102
|
+
requestId: number;
|
|
103
|
+
fileSystemPath: string;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface IndexingTotalWorkCalculatedEvent extends IndexingEvent {
|
|
107
|
+
totalWork: number;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface IndexingWorkedEvent extends IndexingEvent {
|
|
111
|
+
worked: number;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface KeyEventUnhandledEvent {
|
|
115
|
+
type: string;
|
|
116
|
+
key: string;
|
|
117
|
+
keyCode: number;
|
|
118
|
+
modifiers: number;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface RevealSourceLineEvent {
|
|
122
|
+
url: string;
|
|
123
|
+
lineNumber: number;
|
|
124
|
+
columnNumber: number;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface SavedURLEvent {
|
|
128
|
+
url: string;
|
|
129
|
+
fileSystemPath: string;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface SearchCompletedEvent {
|
|
133
|
+
requestId: number;
|
|
134
|
+
files: string[];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// While `EventDescriptors` are used to dynamically dispatch host binding events,
|
|
138
|
+
// the `EventTypes` "type map" is used for type-checking said events by TypeScript.
|
|
139
|
+
// `EventTypes` is not used at runtime.
|
|
140
|
+
// Please note that the "dispatch" side can't be type-checked as the dispatch is
|
|
141
|
+
// done dynamically.
|
|
142
|
+
export type EventTypes = {
|
|
143
|
+
[Events.AppendedToURL]: string,
|
|
144
|
+
[Events.CanceledSaveURL]: string,
|
|
145
|
+
[Events.ContextMenuCleared]: void,
|
|
146
|
+
[Events.ContextMenuItemSelected]: number,
|
|
147
|
+
[Events.DeviceCountUpdated]: number,
|
|
148
|
+
[Events.DevicesDiscoveryConfigChanged]: Adb.Config,
|
|
149
|
+
[Events.DevicesPortForwardingStatusChanged]: void,
|
|
150
|
+
[Events.DevicesUpdated]: void,
|
|
151
|
+
[Events.DispatchMessage]: string,
|
|
152
|
+
[Events.DispatchMessageChunk]: DispatchMessageChunkEvent,
|
|
153
|
+
[Events.EnterInspectElementMode]: void,
|
|
154
|
+
[Events.EyeDropperPickedColor]: EyeDropperPickedColorEvent,
|
|
155
|
+
[Events.FileSystemsLoaded]: DevToolsFileSystem[],
|
|
156
|
+
[Events.FileSystemRemoved]: string,
|
|
157
|
+
[Events.FileSystemAdded]: FileSystemAddedEvent,
|
|
158
|
+
[Events.FileSystemFilesChangedAddedRemoved]: FilesChangedEvent,
|
|
159
|
+
[Events.IndexingTotalWorkCalculated]: IndexingTotalWorkCalculatedEvent,
|
|
160
|
+
[Events.IndexingWorked]: IndexingWorkedEvent,
|
|
161
|
+
[Events.IndexingDone]: IndexingEvent,
|
|
162
|
+
[Events.KeyEventUnhandled]: KeyEventUnhandledEvent,
|
|
163
|
+
[Events.ReattachMainTarget]: void,
|
|
164
|
+
[Events.ReloadInspectedPage]: boolean,
|
|
165
|
+
[Events.RevealSourceLine]: RevealSourceLineEvent,
|
|
166
|
+
[Events.SavedURL]: SavedURLEvent,
|
|
167
|
+
[Events.SearchCompleted]: SearchCompletedEvent,
|
|
168
|
+
[Events.SetInspectedTabId]: string,
|
|
169
|
+
[Events.SetUseSoftMenu]: boolean,
|
|
170
|
+
[Events.ShowPanel]: string,
|
|
171
|
+
};
|
|
172
|
+
|
|
71
173
|
export interface InspectorFrontendHostAPI {
|
|
72
174
|
addFileSystem(type?: string): void;
|
|
73
175
|
|
|
@@ -707,9 +707,9 @@ export class CSSModel extends SDKModel<EventTypes> {
|
|
|
707
707
|
}
|
|
708
708
|
|
|
709
709
|
if (this.cssPropertyTracker) {
|
|
710
|
-
this.cssPropertyTracker.dispatchEventToListeners(
|
|
711
|
-
|
|
712
|
-
|
|
710
|
+
this.cssPropertyTracker.dispatchEventToListeners(
|
|
711
|
+
CSSPropertyTrackerEvents.TrackedCSSPropertiesUpdated,
|
|
712
|
+
result.nodeIds.map(nodeId => this.domModelInternal.nodeForId(nodeId)));
|
|
713
713
|
}
|
|
714
714
|
}
|
|
715
715
|
|
|
@@ -867,7 +867,7 @@ export class InlineStyleResult {
|
|
|
867
867
|
}
|
|
868
868
|
}
|
|
869
869
|
|
|
870
|
-
export class CSSPropertyTracker extends Common.ObjectWrapper.ObjectWrapper {
|
|
870
|
+
export class CSSPropertyTracker extends Common.ObjectWrapper.ObjectWrapper<CSSPropertyTrackerEventTypes> {
|
|
871
871
|
private readonly cssModel: CSSModel;
|
|
872
872
|
private readonly properties: Protocol.CSS.CSSComputedStyleProperty[];
|
|
873
873
|
constructor(cssModel: CSSModel, propertiesToTrack: Protocol.CSS.CSSComputedStyleProperty[]) {
|
|
@@ -897,6 +897,10 @@ export enum CSSPropertyTrackerEvents {
|
|
|
897
897
|
TrackedCSSPropertiesUpdated = 'TrackedCSSPropertiesUpdated',
|
|
898
898
|
}
|
|
899
899
|
|
|
900
|
+
export type CSSPropertyTrackerEventTypes = {
|
|
901
|
+
[CSSPropertyTrackerEvents.TrackedCSSPropertiesUpdated]: (DOMNode|null)[],
|
|
902
|
+
};
|
|
903
|
+
|
|
900
904
|
SDKModel.register(CSSModel, {capabilities: Capability.DOM, autostart: true});
|
|
901
905
|
export interface ContrastInfo {
|
|
902
906
|
backgroundColors: string[]|null;
|
|
@@ -42,15 +42,15 @@ export class MainConnection implements ProtocolClient.InspectorBackend.Connectio
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
private dispatchMessage(event: Common.EventTarget.EventTargetEvent): void {
|
|
45
|
+
private dispatchMessage(event: Common.EventTarget.EventTargetEvent<string>): void {
|
|
46
46
|
if (this.onMessage) {
|
|
47
|
-
this.onMessage.call(null,
|
|
47
|
+
this.onMessage.call(null, event.data);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
private dispatchMessageChunk(
|
|
52
|
-
|
|
53
|
-
const messageSize =
|
|
51
|
+
private dispatchMessageChunk(
|
|
52
|
+
event: Common.EventTarget.EventTargetEvent<Host.InspectorFrontendHostAPI.DispatchMessageChunkEvent>): void {
|
|
53
|
+
const {messageChunk, messageSize} = event.data;
|
|
54
54
|
if (messageSize) {
|
|
55
55
|
this.messageBuffer = '';
|
|
56
56
|
this.messageSize = messageSize;
|
|
@@ -135,7 +135,10 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
135
135
|
}>>)|null;
|
|
136
136
|
private expandCallFramesCallback: ((arg0: Array<CallFrame>) => Promise<Array<CallFrame>>)|null;
|
|
137
137
|
evaluateOnCallFrameCallback: ((arg0: CallFrame, arg1: EvaluationOptions) => Promise<EvaluationResult|null>)|null;
|
|
138
|
-
|
|
138
|
+
// We need to be able to register listeners for individual breakpoints. As such, we dispatch
|
|
139
|
+
// on breakpoint ids, which are not statically known. The event payload will always be a `Location`.
|
|
140
|
+
private readonly breakpointResolvedEventTarget =
|
|
141
|
+
new Common.ObjectWrapper.ObjectWrapper<{[breakpointId: string]: Location}>();
|
|
139
142
|
private autoStepOver: boolean;
|
|
140
143
|
private isPausingInternal: boolean;
|
|
141
144
|
|
|
@@ -163,8 +166,6 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
163
166
|
this.expandCallFramesCallback = null;
|
|
164
167
|
this.evaluateOnCallFrameCallback = null;
|
|
165
168
|
|
|
166
|
-
this.breakpointResolvedEventTarget = new Common.ObjectWrapper.ObjectWrapper();
|
|
167
|
-
|
|
168
169
|
this.autoStepOver = false;
|
|
169
170
|
|
|
170
171
|
this.isPausingInternal = false;
|
|
@@ -901,12 +902,14 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
|
901
902
|
}
|
|
902
903
|
|
|
903
904
|
addBreakpointListener(
|
|
904
|
-
breakpointId: string, listener: (arg0: Common.EventTarget.EventTargetEvent) => void,
|
|
905
|
+
breakpointId: string, listener: (arg0: Common.EventTarget.EventTargetEvent<Location>) => void,
|
|
906
|
+
thisObject?: Object): void {
|
|
905
907
|
this.breakpointResolvedEventTarget.addEventListener(breakpointId, listener, thisObject);
|
|
906
908
|
}
|
|
907
909
|
|
|
908
910
|
removeBreakpointListener(
|
|
909
|
-
breakpointId: string, listener: (arg0: Common.EventTarget.EventTargetEvent) => void,
|
|
911
|
+
breakpointId: string, listener: (arg0: Common.EventTarget.EventTargetEvent<Location>) => void,
|
|
912
|
+
thisObject?: Object): void {
|
|
910
913
|
this.breakpointResolvedEventTarget.removeEventListener(breakpointId, listener, thisObject);
|
|
911
914
|
}
|
|
912
915
|
|
|
@@ -84,8 +84,7 @@ export class InspectorMainImpl implements Common.Runnable.Runnable {
|
|
|
84
84
|
new MobileThrottling.NetworkPanelIndicator.NetworkPanelIndicator();
|
|
85
85
|
|
|
86
86
|
Host.InspectorFrontendHost.InspectorFrontendHostInstance.events.addEventListener(
|
|
87
|
-
Host.InspectorFrontendHostAPI.Events.ReloadInspectedPage,
|
|
88
|
-
const hard = (event.data as boolean);
|
|
87
|
+
Host.InspectorFrontendHostAPI.Events.ReloadInspectedPage, ({data: hard}) => {
|
|
89
88
|
SDK.ResourceTreeModel.ResourceTreeModel.reloadAllPages(hard);
|
|
90
89
|
});
|
|
91
90
|
}
|
|
@@ -576,19 +576,16 @@ export class MainImpl {
|
|
|
576
576
|
private registerMessageSinkListener(): void {
|
|
577
577
|
Common.Console.Console.instance().addEventListener(Common.Console.Events.MessageAdded, messageAdded);
|
|
578
578
|
|
|
579
|
-
function messageAdded(
|
|
580
|
-
const message = (event.data as Common.Console.Message);
|
|
579
|
+
function messageAdded({data: message}: Common.EventTarget.EventTargetEvent<Common.Console.Message>): void {
|
|
581
580
|
if (message.show) {
|
|
582
581
|
Common.Console.Console.instance().show();
|
|
583
582
|
}
|
|
584
583
|
}
|
|
585
584
|
}
|
|
586
585
|
|
|
587
|
-
private revealSourceLine(
|
|
588
|
-
|
|
589
|
-
const lineNumber =
|
|
590
|
-
const columnNumber = (event.data['columnNumber'] as number);
|
|
591
|
-
|
|
586
|
+
private revealSourceLine(
|
|
587
|
+
event: Common.EventTarget.EventTargetEvent<Host.InspectorFrontendHostAPI.RevealSourceLineEvent>): void {
|
|
588
|
+
const {url, lineNumber, columnNumber} = event.data;
|
|
592
589
|
const uiSourceCode = Workspace.Workspace.WorkspaceImpl.instance().uiSourceCodeForURL(url);
|
|
593
590
|
if (uiSourceCode) {
|
|
594
591
|
Common.Revealer.reveal(uiSourceCode.uiLocation(lineNumber, columnNumber));
|
|
@@ -78,8 +78,8 @@ export class NodeConnectionsPanel extends UI.Panel.Panel {
|
|
|
78
78
|
return nodeConnectionsPanelInstance;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
private devicesDiscoveryConfigChanged(
|
|
82
|
-
this.config =
|
|
81
|
+
private devicesDiscoveryConfigChanged({data: config}: Common.EventTarget.EventTargetEvent<Adb.Config>): void {
|
|
82
|
+
this.config = config;
|
|
83
83
|
this.networkDiscoveryView.discoveryConfigChanged(this.config.networkDiscoveryConfig);
|
|
84
84
|
}
|
|
85
85
|
wasShown(): void {
|
|
@@ -70,8 +70,7 @@ export class NodeChildTargetManager extends SDK.SDKModel.SDKModel implements Pro
|
|
|
70
70
|
Host.InspectorFrontendHost.InspectorFrontendHostInstance.setDevicesUpdatesEnabled(true);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
private devicesDiscoveryConfigChanged(
|
|
74
|
-
const config = (event.data as Adb.Config);
|
|
73
|
+
private devicesDiscoveryConfigChanged({data: config}: Common.EventTarget.EventTargetEvent<Adb.Config>): void {
|
|
75
74
|
const locations = [];
|
|
76
75
|
for (const address of config.networkDiscoveryConfig) {
|
|
77
76
|
const parts = address.split(':');
|
|
@@ -734,8 +734,9 @@ export class ModelBreakpoint {
|
|
|
734
734
|
this.breakpointIds = [];
|
|
735
735
|
}
|
|
736
736
|
|
|
737
|
-
private async breakpointResolved(
|
|
738
|
-
|
|
737
|
+
private async breakpointResolved({data: location}: Common.EventTarget.EventTargetEvent<SDK.DebuggerModel.Location>):
|
|
738
|
+
Promise<void> {
|
|
739
|
+
await this.addResolvedLocation(location);
|
|
739
740
|
}
|
|
740
741
|
|
|
741
742
|
private async locationUpdated(liveLocation: LiveLocation): Promise<void> {
|
|
@@ -817,9 +817,9 @@ export class ExtensionServer extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
|
817
817
|
});
|
|
818
818
|
}
|
|
819
819
|
|
|
820
|
-
private setInspectedTabId(event: Common.EventTarget.EventTargetEvent): void {
|
|
820
|
+
private setInspectedTabId(event: Common.EventTarget.EventTargetEvent<string>): void {
|
|
821
821
|
const oldId = this.inspectedTabId;
|
|
822
|
-
this.inspectedTabId =
|
|
822
|
+
this.inspectedTabId = event.data;
|
|
823
823
|
if (oldId === null) {
|
|
824
824
|
// Run deferred init
|
|
825
825
|
this.initializeExtensions();
|
|
@@ -46,7 +46,7 @@ export class DeprecationIssue extends Issue<IssueCode> {
|
|
|
46
46
|
return {
|
|
47
47
|
file: 'deprecationNavigatorUserAgent.md',
|
|
48
48
|
links: [{
|
|
49
|
-
link: 'https://blog.chromium.org/2021/
|
|
49
|
+
link: 'https://blog.chromium.org/2021/09/user-agent-reduction-origin-trial-and-dates.html',
|
|
50
50
|
linkTitle: i18nString(UIStrings.userAgentReduction),
|
|
51
51
|
}],
|
|
52
52
|
};
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
# Specify a Cross-Origin Resource Policy to prevent a resource from being blocked
|
|
2
2
|
|
|
3
|
-
Because your site has the Cross-Origin Embedder Policy (COEP) enabled, each
|
|
4
|
-
|
|
3
|
+
Because your site has the Cross-Origin Embedder Policy (COEP) enabled, each
|
|
4
|
+
resource must specify a suitable Cross-Origin Resource Policy (CORP). This
|
|
5
|
+
behavior prevents a document from loading cross-origin resources which don’t
|
|
6
|
+
explicitly grant permission to be loaded.
|
|
5
7
|
|
|
6
|
-
To solve this, add the following to the resource’
|
|
7
|
-
* `Cross-Origin-Resource-Policy: same-site` if the resource and your site are
|
|
8
|
-
|
|
8
|
+
To solve this, add the following to the resource’ response header:
|
|
9
|
+
* `Cross-Origin-Resource-Policy: same-site` if the resource and your site are
|
|
10
|
+
served from the same site.
|
|
11
|
+
* `Cross-Origin-Resource-Policy: cross-origin` if the resource is served from
|
|
12
|
+
another location than your website. ⚠️If you set this header, any website can
|
|
13
|
+
embed this resource.
|
|
14
|
+
|
|
15
|
+
Alternatively, the document can use the variant: `Cross-Origin-Embedder-Policy:
|
|
16
|
+
credentialless` instead of `require-corp`. It allows loading the resource,
|
|
17
|
+
despite the missing CORP header, at the cost of requesting it without
|
|
18
|
+
credentials like Cookies.
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# Specify a Cross-Origin Embedder Policy to prevent this frame from being blocked
|
|
2
2
|
|
|
3
|
-
Because your site has the Cross-Origin Embedder Policy (COEP) enabled, each
|
|
4
|
-
|
|
3
|
+
Because your site has the Cross-Origin Embedder Policy (COEP) enabled, each
|
|
4
|
+
embedded iframe must also specify this policy. This behavior protects private
|
|
5
|
+
data from being exposed to untrusted third party sites.
|
|
5
6
|
|
|
6
|
-
To solve this, add
|
|
7
|
+
To solve this, add one of following to the embedded frame’s HTML response
|
|
8
|
+
header:
|
|
9
|
+
* `Cross-Origin-Embedder-Policy: require-corp`
|
|
10
|
+
* `Cross-Origin-Embedder-Policy: credentialless` (Chrome > 96)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Audit usage of navigator.userAgent, navigator.appVersion, and navigator.platform
|
|
2
2
|
|
|
3
3
|
A page or script is accessing at least one of `navigator.userAgent`, `navigator.appVersion`, and `navigator.platform`.
|
|
4
|
-
|
|
4
|
+
Starting in Chrome 101, the amount of information available in the User Agent string will be reduced.
|
|
5
5
|
|
|
6
6
|
To fix this issue, replace the usage of `navigator.userAgent`, `navigator.appVersion`, and `navigator.platform` with feature detection, progressive enhancement, or migrate to `navigator.userAgentData`.
|
|
7
7
|
|
|
@@ -139,8 +139,10 @@ export class IsolatedFileSystemManager extends Common.ObjectWrapper.ObjectWrappe
|
|
|
139
139
|
Host.InspectorFrontendHost.InspectorFrontendHostInstance.requestFileSystems();
|
|
140
140
|
return promise;
|
|
141
141
|
|
|
142
|
-
function onFileSystemsLoaded(
|
|
143
|
-
|
|
142
|
+
function onFileSystemsLoaded(
|
|
143
|
+
this: IsolatedFileSystemManager,
|
|
144
|
+
event: Common.EventTarget.EventTargetEvent<Host.InspectorFrontendHostAPI.DevToolsFileSystem[]>): void {
|
|
145
|
+
const fileSystems = event.data;
|
|
144
146
|
const promises = [];
|
|
145
147
|
for (let i = 0; i < fileSystems.length; ++i) {
|
|
146
148
|
promises.push(this.innerAddFileSystem(fileSystems[i], false));
|
|
@@ -168,7 +170,8 @@ export class IsolatedFileSystemManager extends Common.ObjectWrapper.ObjectWrappe
|
|
|
168
170
|
return this.fileSystemsLoadedPromise;
|
|
169
171
|
}
|
|
170
172
|
|
|
171
|
-
private innerAddFileSystem(fileSystem:
|
|
173
|
+
private innerAddFileSystem(fileSystem: Host.InspectorFrontendHostAPI.DevToolsFileSystem, dispatchEvent: boolean):
|
|
174
|
+
Promise<IsolatedFileSystem|null> {
|
|
172
175
|
const embedderPath = fileSystem.fileSystemPath;
|
|
173
176
|
const fileSystemURL = Common.ParsedURL.ParsedURL.platformPathToURL(fileSystem.fileSystemPath);
|
|
174
177
|
const promise = IsolatedFileSystem.create(
|
|
@@ -193,9 +196,9 @@ export class IsolatedFileSystemManager extends Common.ObjectWrapper.ObjectWrappe
|
|
|
193
196
|
this.dispatchEventToListeners(Events.FileSystemAdded, fileSystem);
|
|
194
197
|
}
|
|
195
198
|
|
|
196
|
-
private onFileSystemAdded(
|
|
197
|
-
|
|
198
|
-
const fileSystem = event.data
|
|
199
|
+
private onFileSystemAdded(
|
|
200
|
+
event: Common.EventTarget.EventTargetEvent<Host.InspectorFrontendHostAPI.FileSystemAddedEvent>): void {
|
|
201
|
+
const {errorMessage, fileSystem} = event.data;
|
|
199
202
|
if (errorMessage) {
|
|
200
203
|
if (errorMessage !== '<selection cancelled>') {
|
|
201
204
|
Common.Console.Console.instance().error(i18nString(UIStrings.unableToAddFilesystemS, {PH1: errorMessage}));
|
|
@@ -215,8 +218,8 @@ export class IsolatedFileSystemManager extends Common.ObjectWrapper.ObjectWrappe
|
|
|
215
218
|
}
|
|
216
219
|
}
|
|
217
220
|
|
|
218
|
-
private onFileSystemRemoved(event: Common.EventTarget.EventTargetEvent): void {
|
|
219
|
-
const embedderPath = event.data
|
|
221
|
+
private onFileSystemRemoved(event: Common.EventTarget.EventTargetEvent<string>): void {
|
|
222
|
+
const embedderPath = event.data;
|
|
220
223
|
const fileSystemPath = Common.ParsedURL.ParsedURL.platformPathToURL(embedderPath);
|
|
221
224
|
const isolatedFileSystem = this.fileSystemsInternal.get(fileSystemPath);
|
|
222
225
|
if (!isolatedFileSystem) {
|
|
@@ -227,7 +230,8 @@ export class IsolatedFileSystemManager extends Common.ObjectWrapper.ObjectWrappe
|
|
|
227
230
|
this.dispatchEventToListeners(Events.FileSystemRemoved, isolatedFileSystem);
|
|
228
231
|
}
|
|
229
232
|
|
|
230
|
-
private onFileSystemFilesChanged(
|
|
233
|
+
private onFileSystemFilesChanged(
|
|
234
|
+
event: Common.EventTarget.EventTargetEvent<Host.InspectorFrontendHostAPI.FilesChangedEvent>): void {
|
|
231
235
|
const urlPaths = {
|
|
232
236
|
changed: groupFilePathsIntoFileSystemPaths.call(this, event.data.changed),
|
|
233
237
|
added: groupFilePathsIntoFileSystemPaths.call(this, event.data.added),
|
|
@@ -281,10 +285,10 @@ export class IsolatedFileSystemManager extends Common.ObjectWrapper.ObjectWrappe
|
|
|
281
285
|
return requestId;
|
|
282
286
|
}
|
|
283
287
|
|
|
284
|
-
private onIndexingTotalWorkCalculated(
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
+
private onIndexingTotalWorkCalculated(
|
|
289
|
+
event: Common.EventTarget.EventTargetEvent<Host.InspectorFrontendHostAPI.IndexingTotalWorkCalculatedEvent>):
|
|
290
|
+
void {
|
|
291
|
+
const {requestId, totalWork} = event.data;
|
|
288
292
|
const progress = this.progresses.get(requestId);
|
|
289
293
|
if (!progress) {
|
|
290
294
|
return;
|
|
@@ -292,10 +296,9 @@ export class IsolatedFileSystemManager extends Common.ObjectWrapper.ObjectWrappe
|
|
|
292
296
|
progress.setTotalWork(totalWork);
|
|
293
297
|
}
|
|
294
298
|
|
|
295
|
-
private onIndexingWorked(
|
|
296
|
-
|
|
297
|
-
const worked = event.data
|
|
298
|
-
|
|
299
|
+
private onIndexingWorked(
|
|
300
|
+
event: Common.EventTarget.EventTargetEvent<Host.InspectorFrontendHostAPI.IndexingWorkedEvent>): void {
|
|
301
|
+
const {requestId, worked} = event.data;
|
|
299
302
|
const progress = this.progresses.get(requestId);
|
|
300
303
|
if (!progress) {
|
|
301
304
|
return;
|
|
@@ -307,9 +310,9 @@ export class IsolatedFileSystemManager extends Common.ObjectWrapper.ObjectWrappe
|
|
|
307
310
|
}
|
|
308
311
|
}
|
|
309
312
|
|
|
310
|
-
private onIndexingDone(event: Common.EventTarget.EventTargetEvent):
|
|
311
|
-
|
|
312
|
-
|
|
313
|
+
private onIndexingDone(event: Common.EventTarget.EventTargetEvent<Host.InspectorFrontendHostAPI.IndexingEvent>):
|
|
314
|
+
void {
|
|
315
|
+
const {requestId} = event.data;
|
|
313
316
|
const progress = this.progresses.get(requestId);
|
|
314
317
|
if (!progress) {
|
|
315
318
|
return;
|
|
@@ -318,10 +321,9 @@ export class IsolatedFileSystemManager extends Common.ObjectWrapper.ObjectWrappe
|
|
|
318
321
|
this.progresses.delete(requestId);
|
|
319
322
|
}
|
|
320
323
|
|
|
321
|
-
private onSearchCompleted(
|
|
322
|
-
|
|
323
|
-
const files = event.data
|
|
324
|
-
|
|
324
|
+
private onSearchCompleted(
|
|
325
|
+
event: Common.EventTarget.EventTargetEvent<Host.InspectorFrontendHostAPI.SearchCompletedEvent>): void {
|
|
326
|
+
const {requestId, files} = event.data;
|
|
325
327
|
const callback = this.callbacks.get(requestId);
|
|
326
328
|
if (!callback) {
|
|
327
329
|
return;
|
|
@@ -350,10 +352,3 @@ export type EventTypes = {
|
|
|
350
352
|
};
|
|
351
353
|
|
|
352
354
|
let lastRequestId = 0;
|
|
353
|
-
|
|
354
|
-
export interface FileSystem {
|
|
355
|
-
type: string;
|
|
356
|
-
fileSystemName: string;
|
|
357
|
-
rootURL: string;
|
|
358
|
-
fileSystemPath: string;
|
|
359
|
-
}
|
|
@@ -14,7 +14,8 @@ import {PersistenceBinding, PersistenceImpl} from './PersistenceImpl.js';
|
|
|
14
14
|
|
|
15
15
|
let networkPersistenceManagerInstance: NetworkPersistenceManager|null;
|
|
16
16
|
|
|
17
|
-
export class NetworkPersistenceManager extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
17
|
+
export class NetworkPersistenceManager extends Common.ObjectWrapper.ObjectWrapper<EventTypes> implements
|
|
18
|
+
SDK.TargetManager.Observer {
|
|
18
19
|
private bindings: WeakMap<Workspace.UISourceCode.UISourceCode, PersistenceBinding>;
|
|
19
20
|
private readonly originalResponseContentPromises: WeakMap<Workspace.UISourceCode.UISourceCode, Promise<string|null>>;
|
|
20
21
|
private savingForOverrides: WeakSet<Workspace.UISourceCode.UISourceCode>;
|
|
@@ -64,6 +65,15 @@ export class NetworkPersistenceManager extends Common.ObjectWrapper.ObjectWrappe
|
|
|
64
65
|
|
|
65
66
|
this.eventDescriptors = [];
|
|
66
67
|
this.enabledChanged();
|
|
68
|
+
|
|
69
|
+
SDK.TargetManager.TargetManager.instance().observeTargets(this);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
targetAdded(): void {
|
|
73
|
+
this.updateActiveProject();
|
|
74
|
+
}
|
|
75
|
+
targetRemoved(): void {
|
|
76
|
+
this.updateActiveProject();
|
|
67
77
|
}
|
|
68
78
|
|
|
69
79
|
static instance(opts: {
|
|
@@ -66,17 +66,16 @@ export class FileManager extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
|
66
66
|
return result;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
private savedURL(event: Common.EventTarget.EventTargetEvent): void {
|
|
70
|
-
const url = event.data
|
|
69
|
+
private savedURL(event: Common.EventTarget.EventTargetEvent<Host.InspectorFrontendHostAPI.SavedURLEvent>): void {
|
|
70
|
+
const {url, fileSystemPath} = event.data;
|
|
71
71
|
const callback = this.saveCallbacks.get(url);
|
|
72
72
|
this.saveCallbacks.delete(url);
|
|
73
73
|
if (callback) {
|
|
74
|
-
callback({fileSystemPath
|
|
74
|
+
callback({fileSystemPath});
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
private canceledSavedURL(
|
|
79
|
-
const url = event.data as string;
|
|
78
|
+
private canceledSavedURL({data: url}: Common.EventTarget.EventTargetEvent<string>): void {
|
|
80
79
|
const callback = this.saveCallbacks.get(url);
|
|
81
80
|
this.saveCallbacks.delete(url);
|
|
82
81
|
if (callback) {
|
|
@@ -92,8 +91,7 @@ export class FileManager extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
|
92
91
|
Host.InspectorFrontendHost.InspectorFrontendHostInstance.close(url);
|
|
93
92
|
}
|
|
94
93
|
|
|
95
|
-
private appendedToURL(
|
|
96
|
-
const url = event.data as string;
|
|
94
|
+
private appendedToURL({data: url}: Common.EventTarget.EventTargetEvent<string>): void {
|
|
97
95
|
this.dispatchEventToListeners(Events.AppendedToURL, url);
|
|
98
96
|
}
|
|
99
97
|
}
|
|
@@ -620,11 +620,9 @@ export class ConsoleView extends UI.Widget.VBox implements UI.SearchableView.Sea
|
|
|
620
620
|
|
|
621
621
|
private registerWithMessageSink(): void {
|
|
622
622
|
Common.Console.Console.instance().messages().forEach(this.addSinkMessage, this);
|
|
623
|
-
Common.Console.Console.instance().addEventListener(Common.Console.Events.MessageAdded,
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
this.addSinkMessage((event.data as Common.Console.Message));
|
|
627
|
-
}
|
|
623
|
+
Common.Console.Console.instance().addEventListener(Common.Console.Events.MessageAdded, ({data: message}) => {
|
|
624
|
+
this.addSinkMessage(message);
|
|
625
|
+
}, this);
|
|
628
626
|
}
|
|
629
627
|
|
|
630
628
|
private addSinkMessage(message: Common.Console.Message): void {
|
|
@@ -178,7 +178,7 @@ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
|
178
178
|
export type NodeStyleStats = Map<string, Set<number>>;
|
|
179
179
|
|
|
180
180
|
export interface ContrastIssue {
|
|
181
|
-
nodeId:
|
|
181
|
+
nodeId: Protocol.DOM.BackendNodeId;
|
|
182
182
|
contrastRatio: number;
|
|
183
183
|
textColor: Common.Color.Color;
|
|
184
184
|
backgroundColor: Common.Color.Color;
|
|
@@ -189,18 +189,18 @@ export interface ContrastIssue {
|
|
|
189
189
|
};
|
|
190
190
|
}
|
|
191
191
|
export interface OverviewData {
|
|
192
|
-
backgroundColors: Map<string, Set<
|
|
193
|
-
textColors: Map<string, Set<
|
|
192
|
+
backgroundColors: Map<string, Set<Protocol.DOM.BackendNodeId>>;
|
|
193
|
+
textColors: Map<string, Set<Protocol.DOM.BackendNodeId>>;
|
|
194
194
|
textColorContrastIssues: Map<string, ContrastIssue[]>;
|
|
195
|
-
fillColors: Map<string, Set<
|
|
196
|
-
borderColors: Map<string, Set<
|
|
195
|
+
fillColors: Map<string, Set<Protocol.DOM.BackendNodeId>>;
|
|
196
|
+
borderColors: Map<string, Set<Protocol.DOM.BackendNodeId>>;
|
|
197
197
|
globalStyleStats: {
|
|
198
198
|
styleRules: number,
|
|
199
199
|
inlineStyles: number,
|
|
200
200
|
externalSheets: number,
|
|
201
201
|
stats: {type: number, class: number, id: number, universal: number, attribute: number, nonSimple: number},
|
|
202
202
|
};
|
|
203
|
-
fontInfo: Map<string, Map<string, Map<string,
|
|
203
|
+
fontInfo: Map<string, Map<string, Map<string, Protocol.DOM.BackendNodeId[]>>>;
|
|
204
204
|
elementCount: number;
|
|
205
205
|
mediaQueries: Map<string, Protocol.CSS.CSSMedia[]>;
|
|
206
206
|
unusedDeclarations: Map<string, UnusedDeclaration[]>;
|
|
@@ -435,7 +435,7 @@ export class CSSOverviewCompletedView extends UI.Panel.PanelWithSidebar {
|
|
|
435
435
|
return;
|
|
436
436
|
}
|
|
437
437
|
|
|
438
|
-
const nodesIds =
|
|
438
|
+
const nodesIds = fontMetricInfo.get(value);
|
|
439
439
|
if (!nodesIds) {
|
|
440
440
|
return;
|
|
441
441
|
}
|
|
@@ -1013,8 +1013,8 @@ export class ElementDetailsView extends UI.Widget.Widget {
|
|
|
1013
1013
|
if ('nodeId' in firstItem && visibility.has('nodeId')) {
|
|
1014
1014
|
// Grab the nodes from the frontend, but only those that have not been
|
|
1015
1015
|
// retrieved already.
|
|
1016
|
-
const nodeIds = (data as {nodeId:
|
|
1017
|
-
const nodeId = curr.nodeId
|
|
1016
|
+
const nodeIds = (data as {nodeId: Protocol.DOM.BackendNodeId}[]).reduce((prev, curr) => {
|
|
1017
|
+
const nodeId = curr.nodeId;
|
|
1018
1018
|
if (CSSOverviewCompletedView.pushedNodes.has(nodeId)) {
|
|
1019
1019
|
return prev;
|
|
1020
1020
|
}
|
|
@@ -1030,7 +1030,7 @@ export class ElementDetailsView extends UI.Widget.Widget {
|
|
|
1030
1030
|
if (!relatedNodesMap) {
|
|
1031
1031
|
continue;
|
|
1032
1032
|
}
|
|
1033
|
-
frontendNode = relatedNodesMap.get(item.nodeId
|
|
1033
|
+
frontendNode = relatedNodesMap.get(item.nodeId);
|
|
1034
1034
|
if (!frontendNode) {
|
|
1035
1035
|
continue;
|
|
1036
1036
|
}
|
|
@@ -38,7 +38,7 @@ export type PopulateNodesEvent = {
|
|
|
38
38
|
type: 'color',
|
|
39
39
|
color: string,
|
|
40
40
|
section: string | undefined,
|
|
41
|
-
nodes: {nodeId:
|
|
41
|
+
nodes: {nodeId: Protocol.DOM.BackendNodeId}[],
|
|
42
42
|
}|{
|
|
43
43
|
type: 'unused-declarations',
|
|
44
44
|
declaration: string,
|
|
@@ -50,7 +50,7 @@ export type PopulateNodesEvent = {
|
|
|
50
50
|
}|{
|
|
51
51
|
type: 'font-info',
|
|
52
52
|
name: string,
|
|
53
|
-
nodes: {nodeId:
|
|
53
|
+
nodes: {nodeId: Protocol.DOM.BackendNodeId}[],
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
export type PopulateNodesEventNodes = PopulateNodesEvent['nodes'];
|
|
@@ -15,12 +15,12 @@ import {CSSOverviewUnusedDeclarations} from './CSSOverviewUnusedDeclarations.js'
|
|
|
15
15
|
|
|
16
16
|
interface NodeStyleStats {
|
|
17
17
|
elementCount: number;
|
|
18
|
-
backgroundColors: Map<string, Set<
|
|
19
|
-
textColors: Map<string, Set<
|
|
18
|
+
backgroundColors: Map<string, Set<Protocol.DOM.BackendNodeId>>;
|
|
19
|
+
textColors: Map<string, Set<Protocol.DOM.BackendNodeId>>;
|
|
20
20
|
textColorContrastIssues: Map<string, ContrastIssue[]>;
|
|
21
|
-
fillColors: Map<string, Set<
|
|
22
|
-
borderColors: Map<string, Set<
|
|
23
|
-
fontInfo: Map<string, Map<string, Map<string,
|
|
21
|
+
fillColors: Map<string, Set<Protocol.DOM.BackendNodeId>>;
|
|
22
|
+
borderColors: Map<string, Set<Protocol.DOM.BackendNodeId>>;
|
|
23
|
+
fontInfo: Map<string, Map<string, Map<string, Protocol.DOM.BackendNodeId[]>>>;
|
|
24
24
|
unusedDeclarations: Map<string, UnusedDeclaration[]>;
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -27,17 +27,17 @@ export class CSSOverviewPanel extends UI.Panel.Panel {
|
|
|
27
27
|
private readonly startView: CSSOverviewStartView;
|
|
28
28
|
private readonly processingView: CSSOverviewProcessingView;
|
|
29
29
|
private readonly completedView: CSSOverviewCompletedView;
|
|
30
|
-
private backgroundColors
|
|
31
|
-
private textColors
|
|
32
|
-
private fillColors
|
|
33
|
-
private borderColors
|
|
34
|
-
private fontInfo
|
|
35
|
-
private mediaQueries
|
|
36
|
-
private unusedDeclarations
|
|
37
|
-
private elementCount
|
|
30
|
+
private backgroundColors!: Map<string, Set<Protocol.DOM.BackendNodeId>>;
|
|
31
|
+
private textColors!: Map<string, Set<Protocol.DOM.BackendNodeId>>;
|
|
32
|
+
private fillColors!: Map<string, Set<Protocol.DOM.BackendNodeId>>;
|
|
33
|
+
private borderColors!: Map<string, Set<Protocol.DOM.BackendNodeId>>;
|
|
34
|
+
private fontInfo!: Map<string, Map<string, Map<string, Protocol.DOM.BackendNodeId[]>>>;
|
|
35
|
+
private mediaQueries!: Map<string, Protocol.CSS.CSSMedia[]>;
|
|
36
|
+
private unusedDeclarations!: Map<string, UnusedDeclaration[]>;
|
|
37
|
+
private elementCount!: number;
|
|
38
38
|
private cancelled?: boolean;
|
|
39
|
-
private globalStyleStats
|
|
40
|
-
private textColorContrastIssues
|
|
39
|
+
private globalStyleStats!: GlobalStyleStats;
|
|
40
|
+
private textColorContrastIssues!: Map<string, ContrastIssue[]>;
|
|
41
41
|
|
|
42
42
|
private constructor() {
|
|
43
43
|
super('css_overview');
|
|
@@ -97,6 +97,7 @@ export class CSSOverviewPanel extends UI.Panel.Panel {
|
|
|
97
97
|
nonSimple: 0,
|
|
98
98
|
},
|
|
99
99
|
};
|
|
100
|
+
this.textColorContrastIssues = new Map();
|
|
100
101
|
this.renderInitialView();
|
|
101
102
|
}
|
|
102
103
|
|
|
@@ -124,16 +125,16 @@ export class CSSOverviewPanel extends UI.Panel.Panel {
|
|
|
124
125
|
|
|
125
126
|
this.completedView.show(this.contentElement);
|
|
126
127
|
this.completedView.setOverviewData({
|
|
127
|
-
backgroundColors:
|
|
128
|
-
textColors:
|
|
129
|
-
textColorContrastIssues:
|
|
130
|
-
fillColors:
|
|
131
|
-
borderColors:
|
|
132
|
-
globalStyleStats: this.globalStyleStats
|
|
133
|
-
fontInfo:
|
|
134
|
-
elementCount:
|
|
135
|
-
mediaQueries:
|
|
136
|
-
unusedDeclarations:
|
|
128
|
+
backgroundColors: this.backgroundColors,
|
|
129
|
+
textColors: this.textColors,
|
|
130
|
+
textColorContrastIssues: this.textColorContrastIssues,
|
|
131
|
+
fillColors: this.fillColors,
|
|
132
|
+
borderColors: this.borderColors,
|
|
133
|
+
globalStyleStats: this.globalStyleStats,
|
|
134
|
+
fontInfo: this.fontInfo,
|
|
135
|
+
elementCount: this.elementCount,
|
|
136
|
+
mediaQueries: this.mediaQueries,
|
|
137
|
+
unusedDeclarations: this.unusedDeclarations,
|
|
137
138
|
});
|
|
138
139
|
}
|
|
139
140
|
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
5
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
6
|
+
import type * as Protocol from '../../generated/protocol.js';
|
|
6
7
|
|
|
7
8
|
const UIStrings = {
|
|
8
9
|
/**
|
|
@@ -38,20 +39,22 @@ const str_ = i18n.i18n.registerUIStrings('panels/css_overview/CSSOverviewUnusedD
|
|
|
38
39
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
39
40
|
export interface UnusedDeclaration {
|
|
40
41
|
declaration: string;
|
|
41
|
-
nodeId:
|
|
42
|
+
nodeId: Protocol.DOM.BackendNodeId;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
export class CSSOverviewUnusedDeclarations {
|
|
45
|
-
private static add(
|
|
46
|
-
|
|
46
|
+
private static add(target: Map<string, UnusedDeclaration[]>, key: string, item: {
|
|
47
|
+
declaration: string,
|
|
48
|
+
nodeId: Protocol.DOM.BackendNodeId,
|
|
49
|
+
}): void {
|
|
47
50
|
const values = target.get(key) || [];
|
|
48
51
|
values.push(item);
|
|
49
52
|
target.set(key, values);
|
|
50
53
|
}
|
|
51
54
|
|
|
52
55
|
static checkForUnusedPositionValues(
|
|
53
|
-
unusedDeclarations: Map<string, UnusedDeclaration[]>, nodeId:
|
|
54
|
-
topIdx: number, leftIdx: number, rightIdx: number, bottomIdx: number): void {
|
|
56
|
+
unusedDeclarations: Map<string, UnusedDeclaration[]>, nodeId: Protocol.DOM.BackendNodeId, strings: string[],
|
|
57
|
+
positionIdx: number, topIdx: number, leftIdx: number, rightIdx: number, bottomIdx: number): void {
|
|
55
58
|
if (strings[positionIdx] !== 'static') {
|
|
56
59
|
return;
|
|
57
60
|
}
|
|
@@ -90,8 +93,8 @@ export class CSSOverviewUnusedDeclarations {
|
|
|
90
93
|
}
|
|
91
94
|
|
|
92
95
|
static checkForUnusedWidthAndHeightValues(
|
|
93
|
-
unusedDeclarations: Map<string, UnusedDeclaration[]>, nodeId:
|
|
94
|
-
widthIdx: number, heightIdx: number): void {
|
|
96
|
+
unusedDeclarations: Map<string, UnusedDeclaration[]>, nodeId: Protocol.DOM.BackendNodeId, strings: string[],
|
|
97
|
+
displayIdx: number, widthIdx: number, heightIdx: number): void {
|
|
95
98
|
if (strings[displayIdx] !== 'inline') {
|
|
96
99
|
return;
|
|
97
100
|
}
|
|
@@ -114,8 +117,8 @@ export class CSSOverviewUnusedDeclarations {
|
|
|
114
117
|
}
|
|
115
118
|
|
|
116
119
|
static checkForInvalidVerticalAlignment(
|
|
117
|
-
unusedDeclarations: Map<string, UnusedDeclaration[]>, nodeId:
|
|
118
|
-
verticalAlignIdx: number): void {
|
|
120
|
+
unusedDeclarations: Map<string, UnusedDeclaration[]>, nodeId: Protocol.DOM.BackendNodeId, strings: string[],
|
|
121
|
+
displayIdx: number, verticalAlignIdx: number): void {
|
|
119
122
|
if (!strings[displayIdx] || strings[displayIdx] === 'inline' || strings[displayIdx].startsWith('table')) {
|
|
120
123
|
return;
|
|
121
124
|
}
|
|
@@ -1099,9 +1099,8 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
|
|
|
1099
1099
|
SDK.CSSModel.CSSPropertyTrackerEvents.TrackedCSSPropertiesUpdated, this.trackedCSSPropertiesUpdated, this);
|
|
1100
1100
|
}
|
|
1101
1101
|
|
|
1102
|
-
private trackedCSSPropertiesUpdated(
|
|
1103
|
-
|
|
1104
|
-
|
|
1102
|
+
private trackedCSSPropertiesUpdated({data: domNodes}:
|
|
1103
|
+
Common.EventTarget.EventTargetEvent<(SDK.DOMModel.DOMNode | null)[]>): void {
|
|
1105
1104
|
for (const domNode of domNodes) {
|
|
1106
1105
|
if (!domNode) {
|
|
1107
1106
|
continue;
|
|
@@ -145,7 +145,9 @@ export class ProfileFlameChartDataProvider implements PerfUI.FlameChart.FlameCha
|
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
export class CPUProfileFlameChart extends
|
|
148
|
+
export class CPUProfileFlameChart extends
|
|
149
|
+
Common.ObjectWrapper.eventMixin<PerfUI.FlameChart.EventTypes, typeof UI.Widget.VBox>(UI.Widget.VBox)
|
|
150
|
+
implements UI.SearchableView.Searchable {
|
|
149
151
|
readonly searchableView: UI.SearchableView.SearchableView;
|
|
150
152
|
readonly overviewPane: OverviewPane;
|
|
151
153
|
readonly mainPane: PerfUI.FlameChart.FlameChart;
|
|
@@ -307,7 +309,7 @@ export class OverviewCalculator implements PerfUI.TimelineGrid.Calculator {
|
|
|
307
309
|
}
|
|
308
310
|
}
|
|
309
311
|
|
|
310
|
-
export class OverviewPane extends Common.ObjectWrapper.eventMixin<
|
|
312
|
+
export class OverviewPane extends Common.ObjectWrapper.eventMixin<OverviewPaneEventTypes, typeof UI.Widget.VBox>(
|
|
311
313
|
UI.Widget.VBox) implements PerfUI.FlameChart.FlameChartDelegate {
|
|
312
314
|
overviewContainer: HTMLElement;
|
|
313
315
|
readonly overviewCalculator: OverviewCalculator;
|
|
@@ -457,6 +459,6 @@ export interface OverviewPaneWindowChangedEvent {
|
|
|
457
459
|
windowTimeRight: number;
|
|
458
460
|
}
|
|
459
461
|
|
|
460
|
-
export type
|
|
462
|
+
export type OverviewPaneEventTypes = {
|
|
461
463
|
[OverviewPaneEvents.WindowChanged]: OverviewPaneWindowChangedEvent,
|
|
462
464
|
};
|
|
@@ -372,8 +372,8 @@ export class ContextMenu extends SubMenu {
|
|
|
372
372
|
static initialize(): void {
|
|
373
373
|
Host.InspectorFrontendHost.InspectorFrontendHostInstance.events.addEventListener(
|
|
374
374
|
Host.InspectorFrontendHostAPI.Events.SetUseSoftMenu, setUseSoftMenu);
|
|
375
|
-
function setUseSoftMenu(event: Common.EventTarget.EventTargetEvent): void {
|
|
376
|
-
ContextMenu.useSoftMenu =
|
|
375
|
+
function setUseSoftMenu(event: Common.EventTarget.EventTargetEvent<boolean>): void {
|
|
376
|
+
ContextMenu.useSoftMenu = event.data;
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
379
|
|
|
@@ -470,8 +470,8 @@ export class ContextMenu extends SubMenu {
|
|
|
470
470
|
.subItems as (SoftContextMenuDescriptor | Host.InspectorFrontendHostAPI.ContextMenuDescriptor)[];
|
|
471
471
|
}
|
|
472
472
|
|
|
473
|
-
private onItemSelected(event: Common.EventTarget.EventTargetEvent): void {
|
|
474
|
-
this.itemSelected(
|
|
473
|
+
private onItemSelected(event: Common.EventTarget.EventTargetEvent<number>): void {
|
|
474
|
+
this.itemSelected(event.data);
|
|
475
475
|
}
|
|
476
476
|
|
|
477
477
|
private itemSelected(id: number): void {
|
|
@@ -15,13 +15,9 @@ export class ForwardedInputEventHandler {
|
|
|
15
15
|
Host.InspectorFrontendHostAPI.Events.KeyEventUnhandled, this.onKeyEventUnhandled, this);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
private onKeyEventUnhandled(
|
|
19
|
-
|
|
20
|
-
const type =
|
|
21
|
-
const key = (data.key as string);
|
|
22
|
-
const keyCode = (data.keyCode as number);
|
|
23
|
-
const modifiers = (data.modifiers as number);
|
|
24
|
-
|
|
18
|
+
private onKeyEventUnhandled(
|
|
19
|
+
event: Common.EventTarget.EventTargetEvent<Host.InspectorFrontendHostAPI.KeyEventUnhandledEvent>): void {
|
|
20
|
+
const {type, key, keyCode, modifiers} = event.data;
|
|
25
21
|
if (type !== 'keydown') {
|
|
26
22
|
return;
|
|
27
23
|
}
|
|
@@ -188,8 +188,7 @@ export class InspectorView extends VBox implements ViewLocationResolver {
|
|
|
188
188
|
Host.InspectorFrontendHost.InspectorFrontendHostInstance.events.addEventListener(
|
|
189
189
|
Host.InspectorFrontendHostAPI.Events.ShowPanel, showPanel.bind(this));
|
|
190
190
|
|
|
191
|
-
function showPanel(this: InspectorView,
|
|
192
|
-
const panelName = (event.data as string);
|
|
191
|
+
function showPanel(this: InspectorView, {data: panelName}: Common.EventTarget.EventTargetEvent<string>): void {
|
|
193
192
|
this.showPanel(panelName);
|
|
194
193
|
}
|
|
195
194
|
|
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
import * as Common from '../../core/common/common.js';
|
|
32
31
|
import * as DOMExtension from '../../core/dom_extension/dom_extension.js';
|
|
33
32
|
import * as Helpers from '../components/helpers/helpers.js';
|
|
34
33
|
|
|
@@ -48,7 +47,7 @@ export class WidgetElement extends HTMLDivElement {
|
|
|
48
47
|
}
|
|
49
48
|
}
|
|
50
49
|
|
|
51
|
-
export class Widget
|
|
50
|
+
export class Widget {
|
|
52
51
|
element!: WidgetElement;
|
|
53
52
|
contentElement: HTMLDivElement;
|
|
54
53
|
private shadowRoot: ShadowRoot|undefined;
|
|
@@ -69,7 +68,6 @@ export class Widget extends Common.ObjectWrapper.ObjectWrapper {
|
|
|
69
68
|
private invalidationsRequested?: boolean;
|
|
70
69
|
private externallyManaged?: boolean;
|
|
71
70
|
constructor(isWebComponent?: boolean, delegatesFocus?: boolean) {
|
|
72
|
-
super();
|
|
73
71
|
this.contentElement = document.createElement('div');
|
|
74
72
|
this.contentElement.classList.add('widget');
|
|
75
73
|
if (isWebComponent) {
|
|
@@ -88,7 +88,8 @@ export class ContrastDetails extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
|
88
88
|
private contrastPassFailAPCA: HTMLElement;
|
|
89
89
|
private readonly chooseBgColor: HTMLElement;
|
|
90
90
|
private bgColorPickerButton: UI.Toolbar.ToolbarToggle;
|
|
91
|
-
private readonly bgColorPickedBound:
|
|
91
|
+
private readonly bgColorPickedBound:
|
|
92
|
+
(event: Common.EventTarget.EventTargetEvent<Host.InspectorFrontendHostAPI.EyeDropperPickedColorEvent>) => void;
|
|
92
93
|
private readonly bgColorSwatch: Swatch;
|
|
93
94
|
constructor(
|
|
94
95
|
contrastInfo: ContrastInfo, contentElement: Element,
|
|
@@ -449,13 +450,9 @@ export class ContrastDetails extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
|
449
450
|
}
|
|
450
451
|
}
|
|
451
452
|
|
|
452
|
-
private bgColorPicked(
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
g: number,
|
|
456
|
-
b: number,
|
|
457
|
-
a: number,
|
|
458
|
-
};
|
|
453
|
+
private bgColorPicked({
|
|
454
|
+
data: rgbColor,
|
|
455
|
+
}: Common.EventTarget.EventTargetEvent<Host.InspectorFrontendHostAPI.EyeDropperPickedColorEvent>): void {
|
|
459
456
|
const rgba = [rgbColor.r, rgbColor.g, rgbColor.b, (rgbColor.a / 2.55 | 0) / 100];
|
|
460
457
|
const color = Common.Color.Color.fromRGBA(rgba);
|
|
461
458
|
this.contrastInfo.setBgColor(color);
|
|
@@ -156,7 +156,8 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
|
|
|
156
156
|
private readonly deleteIconToolbar: UI.Toolbar.Toolbar;
|
|
157
157
|
private readonly deleteButton: UI.Toolbar.ToolbarButton;
|
|
158
158
|
private readonly addColorToolbar: UI.Toolbar.Toolbar;
|
|
159
|
-
private readonly colorPickedBound:
|
|
159
|
+
private readonly colorPickedBound:
|
|
160
|
+
(event: Common.EventTarget.EventTargetEvent<Host.InspectorFrontendHostAPI.EyeDropperPickedColorEvent>) => void;
|
|
160
161
|
private hsv!: number[];
|
|
161
162
|
private hueAlphaWidth!: number;
|
|
162
163
|
dragWidth!: number;
|
|
@@ -1185,13 +1186,9 @@ export class Spectrum extends Common.ObjectWrapper.eventMixin<EventTypes, typeof
|
|
|
1185
1186
|
}
|
|
1186
1187
|
}
|
|
1187
1188
|
|
|
1188
|
-
private colorPicked(
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
g: number,
|
|
1192
|
-
b: number,
|
|
1193
|
-
a: number,
|
|
1194
|
-
};
|
|
1189
|
+
private colorPicked({
|
|
1190
|
+
data: rgbColor,
|
|
1191
|
+
}: Common.EventTarget.EventTargetEvent<Host.InspectorFrontendHostAPI.EyeDropperPickedColorEvent>): void {
|
|
1195
1192
|
const rgba = [rgbColor.r, rgbColor.g, rgbColor.b, (rgbColor.a / 2.55 | 0) / 100];
|
|
1196
1193
|
const color = Common.Color.Color.fromRGBA(rgba);
|
|
1197
1194
|
this.innerSetColor(color.hsva(), '', undefined /* colorName */, undefined, ChangeSource.Other);
|
package/package.json
CHANGED