chrome-devtools-frontend 1.0.1703574 → 1.0.1704172
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/AUTHORS +1 -0
- package/front_end/core/common/ParsedURL.ts +54 -0
- package/front_end/core/platform/StringUtilities.ts +65 -0
- package/front_end/core/sdk/CPUThrottlingManager.ts +3 -3
- package/front_end/core/sdk/SourceMap.ts +3 -3
- package/front_end/core/sdk/SourceMapScopeChainEntry.ts +4 -3
- package/front_end/core/sdk/SourceMapScopesInfo.ts +17 -5
- package/front_end/entrypoints/main/MainImpl.ts +3 -3
- package/front_end/models/bindings/CompilerScriptMapping.ts +1 -1
- package/front_end/models/har/HARFormat.ts +7 -2
- package/front_end/models/source_map_scopes/NamesResolver.ts +13 -5
- package/front_end/panels/accessibility/AccessibilityAnnouncementRecordingListView.ts +33 -1
- package/front_end/panels/accessibility/AccessibilityAnnouncementRecordingView.ts +4 -12
- package/front_end/panels/application/ApplicationPanelSidebar.ts +58 -60
- package/front_end/panels/application/BackForwardCacheTreeElement.ts +1 -1
- package/front_end/panels/application/FrameDetailsView.ts +64 -82
- package/front_end/panels/application/OpenedWindowDetailsView.ts +20 -21
- package/front_end/panels/application/PreloadingTreeElement.ts +3 -3
- package/front_end/panels/common/CommentsOverlayWidget.ts +145 -72
- package/front_end/panels/common/commentsOverlay.css +34 -23
- package/front_end/panels/elements/DOMTreeWidget.ts +29 -10
- package/front_end/panels/network/RequestPayloadView.ts +7 -2
- package/front_end/panels/network/ShowMoreDetailsWidget.ts +12 -9
- package/front_end/panels/sources/DebuggerPlugin.ts +49 -16
- package/front_end/panels/sources/SourcesPanel.ts +1 -1
- package/front_end/panels/sources/SourcesView.ts +3 -12
- package/front_end/panels/sources/TabbedEditorContainer.ts +0 -3
- package/front_end/panels/sources/components/HeadersView.ts +193 -123
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/puppeteer/README.chromium +2 -2
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +5 -0
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +24 -32
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/ElementHandle.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/ElementHandle.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/ElementHandle.js +15 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/ElementHandle.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Accessibility.js +8 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Accessibility.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Debug.d.ts +0 -8
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Debug.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Debug.js +0 -24
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Debug.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.d.ts +12 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.js +79 -17
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node-env-setup.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node-env-setup.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.d.ts +3 -3
- package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.js +3 -3
- package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/types.d.ts +5 -0
- package/front_end/third_party/puppeteer/package/package.json +4 -4
- package/front_end/third_party/puppeteer/package/src/api/ElementHandle.ts +15 -2
- package/front_end/third_party/puppeteer/package/src/cdp/Accessibility.ts +10 -1
- package/front_end/third_party/puppeteer/package/src/common/Debug.ts +0 -27
- package/front_end/third_party/puppeteer/package/src/node/BrowserLauncher.ts +96 -17
- package/front_end/third_party/puppeteer/package/src/node-env-setup.ts +1 -1
- package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
- package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
- package/front_end/ui/comments/CommentAnchorResolver.ts +60 -22
- package/front_end/ui/comments/CommentOverlayManager.ts +78 -25
- package/front_end/ui/legacy/components/data_grid/DataGridExporter.ts +7 -13
- package/front_end/ui/legacy/components/inline_editor/PositionAreaEditor.ts +51 -57
- package/front_end/ui/legacy/components/source_frame/ImageView.ts +101 -42
- package/front_end/ui/legacy/components/utils/Linkifier.ts +1 -2
- package/front_end/ui/visual_logging/KnownContextValues.ts +7 -0
- package/package.json +1 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Copyright 2021 The Chromium Authors
|
|
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
|
-
/* eslint-disable @devtools/no-imperative-dom-api */
|
|
5
4
|
|
|
6
5
|
/*
|
|
7
6
|
* Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
|
|
@@ -31,13 +30,15 @@
|
|
|
31
30
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
32
31
|
*/
|
|
33
32
|
|
|
33
|
+
import '../../../kit/kit.js';
|
|
34
|
+
|
|
34
35
|
import * as Common from '../../../../core/common/common.js';
|
|
35
36
|
import * as Host from '../../../../core/host/host.js';
|
|
36
37
|
import * as i18n from '../../../../core/i18n/i18n.js';
|
|
37
38
|
import * as Platform from '../../../../core/platform/platform.js';
|
|
38
39
|
import * as TextUtils from '../../../../core/text_utils/text_utils.js';
|
|
39
40
|
import * as Workspace from '../../../../models/workspace/workspace.js';
|
|
40
|
-
import {
|
|
41
|
+
import {html, render} from '../../../lit/lit.js';
|
|
41
42
|
import * as VisualLogging from '../../../visual_logging/visual_logging.js';
|
|
42
43
|
import * as UI from '../../legacy.js';
|
|
43
44
|
|
|
@@ -90,6 +91,54 @@ const UIStrings = {
|
|
|
90
91
|
} as const;
|
|
91
92
|
const str_ = i18n.i18n.registerUIStrings('ui/legacy/components/source_frame/ImageView.ts', UIStrings);
|
|
92
93
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
94
|
+
|
|
95
|
+
export interface ViewInput {
|
|
96
|
+
url: Platform.DevToolsPath.UrlString;
|
|
97
|
+
imageSrc: string|null;
|
|
98
|
+
isUnavailable: boolean;
|
|
99
|
+
onImageLoad: (event: Event) => void;
|
|
100
|
+
onContextMenu: (event: Event) => void;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export type View = (input: ViewInput, output: undefined, target: HTMLElement) => void;
|
|
104
|
+
|
|
105
|
+
// clang-format off
|
|
106
|
+
export const DEFAULT_VIEW: View = (input, _output, target) => {
|
|
107
|
+
render(html`
|
|
108
|
+
<style>${imageViewStyles}</style>
|
|
109
|
+
<div class="image">
|
|
110
|
+
${input.imageSrc ? html`
|
|
111
|
+
<img
|
|
112
|
+
class="resource-image-view"
|
|
113
|
+
src=${input.imageSrc}
|
|
114
|
+
alt=${i18nString(UIStrings.imageFromS, {PH1: input.url})}
|
|
115
|
+
@load=${input.onImageLoad}
|
|
116
|
+
@contextmenu=${{handleEvent: input.onContextMenu, capture: true}}
|
|
117
|
+
>` : html`
|
|
118
|
+
<img
|
|
119
|
+
class="resource-image-view"
|
|
120
|
+
alt=${i18nString(UIStrings.imageFromS, {PH1: input.url})}
|
|
121
|
+
hidden
|
|
122
|
+
>`}
|
|
123
|
+
<devtools-link
|
|
124
|
+
class="resource-image-unavailable ${input.isUnavailable ? '' : 'hidden'}"
|
|
125
|
+
href=${input.url}
|
|
126
|
+
>
|
|
127
|
+
<devtools-icon name="open-externally"></devtools-icon>
|
|
128
|
+
${i18nString(UIStrings.thisImageIsTooBig)}
|
|
129
|
+
</devtools-link>
|
|
130
|
+
</div>
|
|
131
|
+
`, target, {
|
|
132
|
+
container: {
|
|
133
|
+
classes: ['image-view'],
|
|
134
|
+
attributes: {
|
|
135
|
+
tabindex: '-1',
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
// clang-format on
|
|
141
|
+
|
|
93
142
|
export class ImageView extends UI.View.SimpleView {
|
|
94
143
|
private url: Platform.DevToolsPath.UrlString;
|
|
95
144
|
private parsedURL: Common.ParsedURL.ParsedURL;
|
|
@@ -100,47 +149,58 @@ export class ImageView extends UI.View.SimpleView {
|
|
|
100
149
|
private readonly dimensionsLabel: UI.Toolbar.ToolbarText;
|
|
101
150
|
private readonly aspectRatioLabel: UI.Toolbar.ToolbarText;
|
|
102
151
|
private readonly mimeTypeLabel: UI.Toolbar.ToolbarText;
|
|
103
|
-
private readonly container: HTMLElement;
|
|
104
|
-
private imagePreviewElement: HTMLImageElement;
|
|
105
|
-
private imageUnavailableElement: HTMLElement;
|
|
106
152
|
private cachedContent?: TextUtils.ContentData.ContentData;
|
|
107
|
-
|
|
153
|
+
readonly #view: View;
|
|
154
|
+
#imageSrc: string|null = null;
|
|
155
|
+
#isUnavailable = false;
|
|
156
|
+
#loadResolve?: () => void;
|
|
157
|
+
|
|
158
|
+
constructor(mimeType: string, contentProvider: TextUtils.ContentProvider.ContentProvider, view: View = DEFAULT_VIEW) {
|
|
108
159
|
super({
|
|
109
160
|
title: i18nString(UIStrings.image),
|
|
110
161
|
viewId: 'image',
|
|
111
162
|
jslog: `${VisualLogging.pane('image-view')}`,
|
|
112
163
|
});
|
|
113
|
-
this
|
|
114
|
-
this.element.tabIndex = -1;
|
|
115
|
-
this.element.classList.add('image-view');
|
|
164
|
+
this.#view = view;
|
|
116
165
|
this.url = contentProvider.contentURL();
|
|
117
166
|
this.parsedURL = new Common.ParsedURL.ParsedURL(this.url);
|
|
118
167
|
this.contentProvider = contentProvider;
|
|
119
168
|
this.uiSourceCode = contentProvider instanceof Workspace.UISourceCode.UISourceCode ? contentProvider : null;
|
|
120
169
|
if (this.uiSourceCode) {
|
|
121
|
-
this.uiSourceCode.addEventListener(
|
|
122
|
-
|
|
123
|
-
new UI.DropTarget.DropTarget(
|
|
124
|
-
|
|
125
|
-
this.handleDrop.bind(this));
|
|
170
|
+
this.uiSourceCode.addEventListener(Workspace.UISourceCode.Events.WorkingCopyCommitted, this.workingCopyCommitted,
|
|
171
|
+
this);
|
|
172
|
+
new UI.DropTarget.DropTarget(this.element, [UI.DropTarget.Type.ImageFile, UI.DropTarget.Type.URI],
|
|
173
|
+
i18nString(UIStrings.dropImageFileHere), this.handleDrop.bind(this));
|
|
126
174
|
}
|
|
127
175
|
this.sizeLabel = new UI.Toolbar.ToolbarText();
|
|
128
176
|
this.dimensionsLabel = new UI.Toolbar.ToolbarText();
|
|
129
177
|
this.aspectRatioLabel = new UI.Toolbar.ToolbarText();
|
|
130
178
|
this.mimeTypeLabel = new UI.Toolbar.ToolbarText(mimeType);
|
|
131
|
-
this.
|
|
132
|
-
|
|
133
|
-
this.imagePreviewElement.addEventListener('contextmenu', this.contextMenu.bind(this), true);
|
|
179
|
+
this.performUpdate();
|
|
180
|
+
}
|
|
134
181
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
182
|
+
override performUpdate(): void {
|
|
183
|
+
this.#view(
|
|
184
|
+
{
|
|
185
|
+
url: this.url,
|
|
186
|
+
imageSrc: this.#imageSrc,
|
|
187
|
+
isUnavailable: this.#isUnavailable,
|
|
188
|
+
onImageLoad: this.#onImageLoad,
|
|
189
|
+
onContextMenu: this.contextMenu.bind(this),
|
|
190
|
+
},
|
|
191
|
+
undefined,
|
|
192
|
+
this.contentElement,
|
|
193
|
+
);
|
|
142
194
|
}
|
|
143
195
|
|
|
196
|
+
#onImageLoad = (event: Event): void => {
|
|
197
|
+
const img = event.target as HTMLImageElement;
|
|
198
|
+
this.dimensionsLabel.setText(i18nString(UIStrings.dD, {PH1: img.naturalWidth, PH2: img.naturalHeight}));
|
|
199
|
+
this.aspectRatioLabel.setText(Platform.NumberUtilities.aspectRatio(img.naturalWidth, img.naturalHeight));
|
|
200
|
+
this.#loadResolve?.();
|
|
201
|
+
this.#loadResolve = undefined;
|
|
202
|
+
};
|
|
203
|
+
|
|
144
204
|
override async toolbarItems(): Promise<UI.Toolbar.ToolbarItem[]> {
|
|
145
205
|
await this.updateContentIfNeeded();
|
|
146
206
|
return [
|
|
@@ -156,13 +216,14 @@ export class ImageView extends UI.View.SimpleView {
|
|
|
156
216
|
|
|
157
217
|
override wasShown(): void {
|
|
158
218
|
super.wasShown();
|
|
219
|
+
this.requestUpdate();
|
|
159
220
|
void this.updateContentIfNeeded();
|
|
160
221
|
}
|
|
161
222
|
|
|
162
223
|
override disposeView(): void {
|
|
163
224
|
if (this.uiSourceCode) {
|
|
164
|
-
this.uiSourceCode.removeEventListener(
|
|
165
|
-
|
|
225
|
+
this.uiSourceCode.removeEventListener(Workspace.UISourceCode.Events.WorkingCopyCommitted,
|
|
226
|
+
this.workingCopyCommitted, this);
|
|
166
227
|
}
|
|
167
228
|
}
|
|
168
229
|
|
|
@@ -179,37 +240,35 @@ export class ImageView extends UI.View.SimpleView {
|
|
|
179
240
|
this.cachedContent = content;
|
|
180
241
|
const imageSrc = content.asImagePreviewUrl();
|
|
181
242
|
if (imageSrc === null) {
|
|
182
|
-
this
|
|
243
|
+
this.#isUnavailable = true;
|
|
244
|
+
this.#imageSrc = null;
|
|
245
|
+
this.performUpdate();
|
|
183
246
|
return;
|
|
184
247
|
}
|
|
185
|
-
this
|
|
186
|
-
const loadPromise = new Promise(
|
|
187
|
-
this
|
|
248
|
+
this.#isUnavailable = false;
|
|
249
|
+
const loadPromise = new Promise<void>(resolve => {
|
|
250
|
+
this.#loadResolve = resolve;
|
|
188
251
|
});
|
|
189
|
-
this
|
|
190
|
-
this.imagePreviewElement.alt = i18nString(UIStrings.imageFromS, {PH1: this.url});
|
|
252
|
+
this.#imageSrc = imageSrc;
|
|
191
253
|
const size = content.isTextContent ? content.text.length : Platform.StringUtilities.base64ToSize(content.base64);
|
|
192
254
|
this.sizeLabel.setText(i18n.ByteUtilities.bytesToString(size));
|
|
255
|
+
this.performUpdate();
|
|
193
256
|
await loadPromise;
|
|
194
|
-
this.dimensionsLabel.setText(i18nString(
|
|
195
|
-
UIStrings.dD, {PH1: this.imagePreviewElement.naturalWidth, PH2: this.imagePreviewElement.naturalHeight}));
|
|
196
|
-
this.aspectRatioLabel.setText(Platform.NumberUtilities.aspectRatio(
|
|
197
|
-
this.imagePreviewElement.naturalWidth, this.imagePreviewElement.naturalHeight));
|
|
198
257
|
}
|
|
199
258
|
|
|
200
259
|
private contextMenu(event: Event): void {
|
|
201
260
|
const contextMenu = new UI.ContextMenu.ContextMenu(event);
|
|
202
|
-
const parsedSrc = new Common.ParsedURL.ParsedURL(this
|
|
261
|
+
const parsedSrc = new Common.ParsedURL.ParsedURL(this.#imageSrc ?? '');
|
|
203
262
|
if (!this.parsedURL.isDataURL()) {
|
|
204
263
|
contextMenu.clipboardSection().appendItem(i18nString(UIStrings.copyImageUrl), this.copyImageURL.bind(this), {
|
|
205
264
|
jslogContext: 'image-view.copy-image-url',
|
|
206
265
|
});
|
|
207
266
|
}
|
|
208
267
|
if (parsedSrc.isDataURL()) {
|
|
209
|
-
contextMenu.clipboardSection().appendItem(
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
268
|
+
contextMenu.clipboardSection().appendItem(i18nString(UIStrings.copyImageAsDataUri),
|
|
269
|
+
this.copyImageAsDataURL.bind(this), {
|
|
270
|
+
jslogContext: 'image-view.copy-image-as-data-url',
|
|
271
|
+
});
|
|
213
272
|
}
|
|
214
273
|
|
|
215
274
|
contextMenu.clipboardSection().appendItem(i18nString(UIStrings.openImageInNewTab), this.openInNewTab.bind(this), {
|
|
@@ -223,7 +282,7 @@ export class ImageView extends UI.View.SimpleView {
|
|
|
223
282
|
}
|
|
224
283
|
|
|
225
284
|
private copyImageAsDataURL(): void {
|
|
226
|
-
Host.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(this
|
|
285
|
+
Host.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(this.#imageSrc ?? '');
|
|
227
286
|
}
|
|
228
287
|
|
|
229
288
|
private copyImageURL(): void {
|
|
@@ -593,8 +593,7 @@ export class Linkifier extends Common.ObjectWrapper.ObjectWrapper<EventTypes> im
|
|
|
593
593
|
const lineNumber = options.lineNumber;
|
|
594
594
|
const columnNumber = options.columnNumber;
|
|
595
595
|
const showColumnNumber = options.showColumnNumber;
|
|
596
|
-
const isPrivileged = Common.ParsedURL.
|
|
597
|
-
Common.ParsedURL.schemeIs(url, 'devtools:');
|
|
596
|
+
const isPrivileged = Common.ParsedURL.isPrivilegedScheme(url);
|
|
598
597
|
const preventClick = options.preventClick;
|
|
599
598
|
const maxLength = options.maxLength || UI.UIUtils.MaxLengthForDisplayedURLs;
|
|
600
599
|
const bypassURLTrimming = options.bypassURLTrimming;
|
|
@@ -1058,6 +1058,7 @@ export const knownContextValues: Set<string> = new Set([
|
|
|
1058
1058
|
'cookies',
|
|
1059
1059
|
'cookies-data',
|
|
1060
1060
|
'cookies-for-frame',
|
|
1061
|
+
'coordinate',
|
|
1061
1062
|
'copy',
|
|
1062
1063
|
'copy-ai-response',
|
|
1063
1064
|
'copy-all-as-curl',
|
|
@@ -1089,12 +1090,14 @@ export const knownContextValues: Set<string> = new Set([
|
|
|
1089
1090
|
'copy-css-declaration-as-js',
|
|
1090
1091
|
'copy-declaration',
|
|
1091
1092
|
'copy-element',
|
|
1093
|
+
'copy-element-html',
|
|
1092
1094
|
'copy-file-name',
|
|
1093
1095
|
'copy-full-xpath',
|
|
1094
1096
|
'copy-initiator-url',
|
|
1095
1097
|
'copy-js-path',
|
|
1096
1098
|
'copy-key',
|
|
1097
1099
|
'copy-link-address',
|
|
1100
|
+
'copy-message',
|
|
1098
1101
|
'copy-object',
|
|
1099
1102
|
'copy-outer-html',
|
|
1100
1103
|
'copy-payload',
|
|
@@ -2716,6 +2719,7 @@ export const knownContextValues: Set<string> = new Set([
|
|
|
2716
2719
|
'location',
|
|
2717
2720
|
'location-dialog',
|
|
2718
2721
|
'log-level',
|
|
2722
|
+
'logical',
|
|
2719
2723
|
'logpoint',
|
|
2720
2724
|
'long',
|
|
2721
2725
|
'long-interaction',
|
|
@@ -3203,6 +3207,7 @@ export const knownContextValues: Set<string> = new Set([
|
|
|
3203
3207
|
'perspective',
|
|
3204
3208
|
'perspective-origin',
|
|
3205
3209
|
'phone',
|
|
3210
|
+
'physical',
|
|
3206
3211
|
'picture-in-picture',
|
|
3207
3212
|
'pill',
|
|
3208
3213
|
'ping',
|
|
@@ -3253,6 +3258,8 @@ export const knownContextValues: Set<string> = new Set([
|
|
|
3253
3258
|
'position',
|
|
3254
3259
|
'position-anchor',
|
|
3255
3260
|
'position-area',
|
|
3261
|
+
'position-area-editor',
|
|
3262
|
+
'position-area-grid',
|
|
3256
3263
|
'position-fallback',
|
|
3257
3264
|
'position-try',
|
|
3258
3265
|
'position-try-fallbacks',
|
package/package.json
CHANGED