chrome-devtools-frontend 1.0.970302 → 1.0.971727
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/config/gni/devtools_grd_files.gni +11 -7
- package/config/gni/devtools_image_files.gni +1 -0
- package/front_end/Images/src/ic_changes.svg +5 -0
- package/front_end/core/common/ParsedURL.ts +33 -4
- package/front_end/core/host/UserMetrics.ts +4 -1
- package/front_end/core/i18n/locales/en-US.json +21 -3
- package/front_end/core/i18n/locales/en-XL.json +21 -3
- package/front_end/core/platform/UserVisibleError.ts +28 -0
- package/front_end/core/platform/platform.ts +2 -0
- package/front_end/core/sdk/CSSModel.ts +21 -0
- package/front_end/core/sdk/CSSStyleSheetHeader.ts +10 -10
- package/front_end/core/sdk/ChildTargetManager.ts +0 -1
- package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +6 -4
- package/front_end/core/sdk/DOMDebuggerModel.ts +4 -3
- package/front_end/core/sdk/DebuggerModel.ts +21 -16
- package/front_end/core/sdk/NetworkManager.ts +17 -3
- package/front_end/core/sdk/NetworkRequest.ts +16 -5
- package/front_end/core/sdk/Resource.ts +10 -10
- package/front_end/core/sdk/ResourceTreeModel.ts +18 -13
- package/front_end/core/sdk/Script.ts +10 -10
- package/front_end/core/sdk/SourceMap.ts +3 -1
- package/front_end/entrypoints/lighthouse_worker/LighthouseService.ts +15 -6
- package/front_end/entrypoints/main/MainImpl.ts +8 -0
- package/front_end/generated/InspectorBackendCommands.js +14 -8
- package/front_end/generated/SupportedCSSProperties.js +2 -0
- package/front_end/generated/protocol-mapping.d.ts +5 -0
- package/front_end/generated/protocol-proxy-api.d.ts +5 -0
- package/front_end/generated/protocol.ts +20 -12
- package/front_end/models/bindings/BreakpointManager.ts +7 -5
- package/front_end/models/bindings/CSSWorkspaceBinding.ts +21 -0
- package/front_end/models/bindings/DebuggerLanguagePlugins.ts +2 -1
- package/front_end/models/bindings/ResourceMapping.ts +2 -1
- package/front_end/models/bindings/ResourceScriptMapping.ts +2 -1
- package/front_end/models/bindings/StylesSourceMapping.ts +2 -1
- package/front_end/models/issues_manager/FederatedAuthRequestIssue.ts +12 -12
- package/front_end/models/issues_manager/descriptions/{federatedAuthRequestClientIdMetadataHttpNotFound.md → federatedAuthRequestClientMetadataHttpNotFound.md} +0 -0
- package/front_end/models/issues_manager/descriptions/{federatedAuthRequestClientIdMetadataInvalidResponse.md → federatedAuthRequestClientMetadataInvalidResponse.md} +0 -0
- package/front_end/models/issues_manager/descriptions/{federatedAuthRequestClientIdMetadataNoResponse.md → federatedAuthRequestClientMetadataNoResponse.md} +0 -0
- package/front_end/models/issues_manager/descriptions/federatedAuthRequestManifestHttpNotFound.md +1 -0
- package/front_end/models/issues_manager/descriptions/federatedAuthRequestManifestInvalidResponse.md +1 -0
- package/front_end/models/issues_manager/descriptions/federatedAuthRequestManifestNoResponse.md +1 -0
- package/front_end/models/persistence/Automapping.ts +3 -33
- package/front_end/models/persistence/FileSystemWorkspaceBinding.ts +12 -10
- package/front_end/models/persistence/IsolatedFileSystem.ts +26 -22
- package/front_end/models/persistence/NetworkPersistenceManager.ts +8 -4
- package/front_end/models/persistence/PersistenceActions.ts +1 -4
- package/front_end/models/persistence/PlatformFileSystem.ts +6 -5
- package/front_end/{panels/sources/SourceMapNamesResolver.ts → models/source_map_scopes/NamesResolver.ts} +5 -5
- package/front_end/models/source_map_scopes/source_map_scopes.ts +7 -0
- package/front_end/models/text_utils/ContentProvider.ts +2 -1
- package/front_end/models/text_utils/StaticContentProvider.ts +5 -4
- package/front_end/models/workspace/UISourceCode.ts +18 -21
- package/front_end/models/workspace/WorkspaceImpl.ts +3 -1
- package/front_end/panels/application/ServiceWorkerCacheViews.ts +1 -1
- package/front_end/panels/browser_debugger/categorizedBreakpointsSidebarPane.css +0 -1
- package/front_end/panels/console/ConsolePrompt.ts +25 -2
- package/front_end/panels/console/ConsoleViewMessage.ts +41 -8
- package/front_end/panels/coverage/CoverageModel.ts +1 -1
- package/front_end/panels/elements/ElementsPanel.ts +25 -11
- package/front_end/panels/elements/ElementsTreeElement.ts +0 -6
- package/front_end/panels/elements/StylesSidebarPane.ts +214 -41
- package/front_end/panels/elements/elementsTreeOutline.css +0 -1
- package/front_end/panels/issues/AffectedResourcesView.ts +1 -1
- package/front_end/panels/issues/AffectedSourcesView.ts +1 -1
- package/front_end/panels/lighthouse/LighthouseController.ts +30 -0
- package/front_end/panels/lighthouse/LighthousePanel.ts +7 -1
- package/front_end/panels/lighthouse/LighthouseProtocolService.ts +6 -1
- package/front_end/panels/lighthouse/LighthouseReportRenderer.ts +0 -5
- package/front_end/panels/lighthouse/LighthouseStartView.ts +2 -2
- package/front_end/panels/lighthouse/LighthouseStartViewFR.ts +39 -0
- package/front_end/panels/network/NetworkDataGridNode.ts +1 -1
- package/front_end/panels/profiler/CPUProfileView.ts +1 -1
- package/front_end/panels/profiler/HeapProfileView.ts +0 -2
- package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +0 -1
- package/front_end/panels/profiler/HeapSnapshotView.ts +2 -3
- package/front_end/panels/sensors/sensors.css +0 -1
- package/front_end/panels/snippets/ScriptSnippetFileSystem.ts +5 -5
- package/front_end/panels/snippets/SnippetsQuickOpen.ts +1 -1
- package/front_end/panels/sources/DebuggerPlugin.ts +5 -4
- package/front_end/panels/sources/NavigatorView.ts +10 -6
- package/front_end/panels/sources/ScopeChainSidebarPane.ts +6 -3
- package/front_end/panels/sources/SourcesNavigator.ts +7 -1
- package/front_end/panels/sources/TabbedEditorContainer.ts +9 -0
- package/front_end/panels/sources/sources-legacy.ts +5 -16
- package/front_end/panels/sources/sources.ts +0 -2
- package/front_end/panels/sources/sourcesView.css +0 -4
- package/front_end/panels/timeline/TimelineUIUtils.ts +4 -47
- package/front_end/ui/legacy/ViewManager.ts +2 -1
- package/front_end/ui/legacy/closeButton.css +0 -1
- package/front_end/ui/legacy/components/source_frame/FontView.ts +1 -1
- package/front_end/ui/legacy/components/source_frame/ImageView.ts +1 -1
- package/front_end/ui/legacy/components/utils/JSPresentationUtils.ts +2 -3
- package/front_end/ui/legacy/components/utils/Linkifier.ts +20 -59
- package/front_end/ui/legacy/tabbedPane.css +0 -3
- package/front_end/ui/legacy/toolbar.css +28 -3
- package/package.json +1 -1
- package/scripts/npm_test.js +1 -1
- package/front_end/models/issues_manager/descriptions/federatedAuthRequestWellKnownHttpNotFound.md +0 -1
- package/front_end/models/issues_manager/descriptions/federatedAuthRequestWellKnownInvalidResponse.md +0 -1
- package/front_end/models/issues_manager/descriptions/federatedAuthRequestWellKnownNoResponse.md +0 -1
@@ -36,7 +36,7 @@ import * as Platform from '../../core/platform/platform.js';
|
|
36
36
|
import * as TextUtils from '../text_utils/text_utils.js';
|
37
37
|
|
38
38
|
import type {Project} from './WorkspaceImpl.js';
|
39
|
-
import {Events as WorkspaceImplEvents
|
39
|
+
import {Events as WorkspaceImplEvents} from './WorkspaceImpl.js';
|
40
40
|
|
41
41
|
const UIStrings = {
|
42
42
|
/**
|
@@ -56,7 +56,7 @@ export class UISourceCode extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
56
56
|
private projectInternal: Project;
|
57
57
|
private urlInternal: string;
|
58
58
|
private readonly originInternal: string;
|
59
|
-
private readonly parentURLInternal:
|
59
|
+
private readonly parentURLInternal: Platform.DevToolsPath.UrlString;
|
60
60
|
private nameInternal: string;
|
61
61
|
private contentTypeInternal: Common.ResourceType.ResourceType;
|
62
62
|
private requestContentPromise: Promise<TextUtils.ContentProvider.DeferredContent>|null;
|
@@ -81,14 +81,18 @@ export class UISourceCode extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
81
81
|
const parsedURL = Common.ParsedURL.ParsedURL.fromString(url);
|
82
82
|
if (parsedURL) {
|
83
83
|
this.originInternal = parsedURL.securityOrigin();
|
84
|
-
this.parentURLInternal = this.originInternal + parsedURL.folderPathComponents;
|
85
|
-
this.nameInternal = parsedURL.lastPathComponent;
|
84
|
+
this.parentURLInternal = this.originInternal + parsedURL.folderPathComponents as Platform.DevToolsPath.UrlString;
|
86
85
|
if (parsedURL.queryParams) {
|
87
|
-
|
86
|
+
// in case file name contains query params, it doesn't look like a normal file name anymore
|
87
|
+
// so it can as well remain encoded
|
88
|
+
this.nameInternal = parsedURL.lastPathComponent + '?' + parsedURL.queryParams;
|
89
|
+
} else {
|
90
|
+
// file name looks best decoded
|
91
|
+
this.nameInternal = decodeURIComponent(parsedURL.lastPathComponent);
|
88
92
|
}
|
89
93
|
} else {
|
90
94
|
this.originInternal = '';
|
91
|
-
this.parentURLInternal = '';
|
95
|
+
this.parentURLInternal = '' as Platform.DevToolsPath.UrlString;
|
92
96
|
this.nameInternal = url;
|
93
97
|
}
|
94
98
|
|
@@ -118,11 +122,11 @@ export class UISourceCode extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
118
122
|
return this.projectInternal.mimeType(this);
|
119
123
|
}
|
120
124
|
|
121
|
-
url():
|
122
|
-
return this.urlInternal;
|
125
|
+
url(): Platform.DevToolsPath.UrlString {
|
126
|
+
return this.urlInternal as Platform.DevToolsPath.UrlString;
|
123
127
|
}
|
124
128
|
|
125
|
-
parentURL():
|
129
|
+
parentURL(): Platform.DevToolsPath.UrlString {
|
126
130
|
return this.parentURLInternal;
|
127
131
|
}
|
128
132
|
|
@@ -138,15 +142,7 @@ export class UISourceCode extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
138
142
|
if (!this.nameInternal) {
|
139
143
|
return i18nString(UIStrings.index);
|
140
144
|
}
|
141
|
-
|
142
|
-
try {
|
143
|
-
if (this.project().type() === projectTypes.FileSystem) {
|
144
|
-
name = unescape(name);
|
145
|
-
} else {
|
146
|
-
name = decodeURI(name);
|
147
|
-
}
|
148
|
-
} catch (error) {
|
149
|
-
}
|
145
|
+
const name = this.nameInternal;
|
150
146
|
return skipTrim ? name : Platform.StringUtilities.trimEndWithMaxLength(name, 100);
|
151
147
|
}
|
152
148
|
|
@@ -178,10 +174,12 @@ export class UISourceCode extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
178
174
|
|
179
175
|
private updateName(name: string, url: string, contentType?: Common.ResourceType.ResourceType): void {
|
180
176
|
const oldURL = this.urlInternal;
|
181
|
-
this.urlInternal = this.urlInternal.substring(0, this.urlInternal.length - this.nameInternal.length) + name;
|
182
177
|
this.nameInternal = name;
|
183
178
|
if (url) {
|
184
179
|
this.urlInternal = url;
|
180
|
+
} else {
|
181
|
+
this.urlInternal = Common.ParsedURL.ParsedURL.relativePathToUrlString(
|
182
|
+
name as Platform.DevToolsPath.RawPathString, oldURL as Platform.DevToolsPath.UrlString);
|
185
183
|
}
|
186
184
|
if (contentType) {
|
187
185
|
this.contentTypeInternal = contentType;
|
@@ -191,8 +189,7 @@ export class UISourceCode extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
191
189
|
WorkspaceImplEvents.UISourceCodeRenamed, {oldURL: oldURL, uiSourceCode: this});
|
192
190
|
}
|
193
191
|
|
194
|
-
|
195
|
-
contentURL(): string {
|
192
|
+
contentURL(): Platform.DevToolsPath.UrlString {
|
196
193
|
return this.url();
|
197
194
|
}
|
198
195
|
|
@@ -175,7 +175,9 @@ export abstract class ProjectStore implements Project {
|
|
175
175
|
|
176
176
|
renameUISourceCode(uiSourceCode: UISourceCode, newName: string): void {
|
177
177
|
const oldPath = uiSourceCode.url();
|
178
|
-
const newPath = uiSourceCode.parentURL() ?
|
178
|
+
const newPath = uiSourceCode.parentURL() ?
|
179
|
+
Common.ParsedURL.ParsedURL.urlFromParentUrlAndName(uiSourceCode.parentURL(), newName) :
|
180
|
+
encodeURIComponent(newName);
|
179
181
|
const value = this.uiSourceCodesMap.get(oldPath) as {
|
180
182
|
uiSourceCode: UISourceCode,
|
181
183
|
index: number,
|
@@ -454,7 +454,7 @@ export class DataGridNode extends DataGrid.DataGrid.DataGridNode<DataGridNode> {
|
|
454
454
|
createCell(columnId: string): HTMLElement {
|
455
455
|
const cell = this.createTD(columnId);
|
456
456
|
let value;
|
457
|
-
let tooltip = this.request.url();
|
457
|
+
let tooltip = this.request.url() as string;
|
458
458
|
if (columnId === 'number') {
|
459
459
|
value = String(this.number);
|
460
460
|
} else if (columnId === 'name') {
|
@@ -5,7 +5,9 @@
|
|
5
5
|
import * as Common from '../../core/common/common.js';
|
6
6
|
import * as Host from '../../core/host/host.js';
|
7
7
|
import * as i18n from '../../core/i18n/i18n.js';
|
8
|
+
import * as Root from '../../core/root/root.js';
|
8
9
|
import * as SDK from '../../core/sdk/sdk.js';
|
10
|
+
import * as SourceMapScopes from '../../models/source_map_scopes/source_map_scopes.js';
|
9
11
|
import * as CodeMirror from '../../third_party/codemirror.next/codemirror.next.js';
|
10
12
|
import * as TextEditor from '../../ui/components/text_editor/text_editor.js';
|
11
13
|
import * as ObjectUI from '../../ui/legacy/components/object_ui/object_ui.js';
|
@@ -280,14 +282,35 @@ export class ConsolePrompt extends Common.ObjectWrapper.eventMixin<EventTypes, t
|
|
280
282
|
const executionContext = currentExecutionContext;
|
281
283
|
const message = SDK.ConsoleModel.ConsoleModel.instance().addCommandMessage(executionContext, text);
|
282
284
|
const expression = ObjectUI.JavaScriptREPL.JavaScriptREPL.preprocessExpression(text);
|
283
|
-
void
|
284
|
-
executionContext, message, expression, useCommandLineAPI);
|
285
|
+
void this.evaluateCommandInConsole(executionContext, message, expression, useCommandLineAPI);
|
285
286
|
if (ConsolePanel.instance().isShowing()) {
|
286
287
|
Host.userMetrics.actionTaken(Host.UserMetrics.Action.CommandEvaluatedInConsolePanel);
|
287
288
|
}
|
288
289
|
}
|
289
290
|
}
|
290
291
|
|
292
|
+
private async evaluateCommandInConsole(
|
293
|
+
executionContext: SDK.RuntimeModel.ExecutionContext, message: SDK.ConsoleModel.ConsoleMessage, expression: string,
|
294
|
+
useCommandLineAPI: boolean): Promise<void> {
|
295
|
+
if (Root.Runtime.experiments.isEnabled('evaluateExpressionsWithSourceMaps')) {
|
296
|
+
const callFrame = executionContext.debuggerModel.selectedCallFrame();
|
297
|
+
if (callFrame) {
|
298
|
+
const nameMap = await SourceMapScopes.NamesResolver.allVariablesInCallFrame(callFrame);
|
299
|
+
expression = this.substituteNames(expression, nameMap);
|
300
|
+
}
|
301
|
+
}
|
302
|
+
|
303
|
+
await SDK.ConsoleModel.ConsoleModel.instance().evaluateCommandInConsole(
|
304
|
+
executionContext, message, expression, useCommandLineAPI);
|
305
|
+
}
|
306
|
+
|
307
|
+
private substituteNames(expression: string, mapping: Map<string, string>): string {
|
308
|
+
// TODO(jarin) Build a more reliable replacer, based on the parsed AST.
|
309
|
+
// Here, we just replace exact occurrences.
|
310
|
+
const replacement = mapping.get(expression);
|
311
|
+
return replacement ?? expression;
|
312
|
+
}
|
313
|
+
|
291
314
|
private editorUpdate(update: CodeMirror.ViewUpdate): void {
|
292
315
|
if (update.docChanged ||
|
293
316
|
CodeMirror.selectedCompletion(update.state) !== CodeMirror.selectedCompletion(update.startState)) {
|
@@ -548,8 +548,7 @@ export class ConsoleViewMessage implements ConsoleViewportElement {
|
|
548
548
|
return null;
|
549
549
|
}
|
550
550
|
return this.linkifier.linkifyScriptLocation(
|
551
|
-
runtimeModel.target(), /* scriptId */ null, url, lineNumber,
|
552
|
-
{columnNumber, className: undefined, tabStop: undefined, inlineFrameIndex: 0});
|
551
|
+
runtimeModel.target(), /* scriptId */ null, url, lineNumber, {columnNumber, inlineFrameIndex: 0});
|
553
552
|
}
|
554
553
|
|
555
554
|
private linkifyStackTraceTopFrame(stackTrace: Protocol.Runtime.StackTrace): HTMLElement|null {
|
@@ -567,8 +566,7 @@ export class ConsoleViewMessage implements ConsoleViewportElement {
|
|
567
566
|
return null;
|
568
567
|
}
|
569
568
|
return this.linkifier.linkifyScriptLocation(
|
570
|
-
runtimeModel.target(), scriptId, url, lineNumber,
|
571
|
-
{columnNumber, className: undefined, tabStop: undefined, inlineFrameIndex: 0});
|
569
|
+
runtimeModel.target(), scriptId, url, lineNumber, {columnNumber, inlineFrameIndex: 0});
|
572
570
|
}
|
573
571
|
|
574
572
|
private format(rawParameters: (string|SDK.RemoteObject.RemoteObject|Protocol.Runtime.RemoteObject|undefined)[]):
|
@@ -1435,8 +1433,7 @@ export class ConsoleViewMessage implements ConsoleViewportElement {
|
|
1435
1433
|
const formattedLine = document.createElement('span');
|
1436
1434
|
formattedLine.appendChild(this.linkifyStringAsFragment(`${prefix} ${name} (`));
|
1437
1435
|
const scriptLocationLink = this.linkifier.linkifyScriptLocation(
|
1438
|
-
debuggerModel.target(), null, url, lineNumber,
|
1439
|
-
{columnNumber, className: undefined, tabStop: undefined, inlineFrameIndex: f});
|
1436
|
+
debuggerModel.target(), null, url, lineNumber, {columnNumber, inlineFrameIndex: f});
|
1440
1437
|
scriptLocationLink.tabIndex = -1;
|
1441
1438
|
this.selectableChildren.push({element: scriptLocationLink, forceSelect: (): void => scriptLocationLink.focus()});
|
1442
1439
|
formattedLine.appendChild(scriptLocationLink);
|
@@ -1446,6 +1443,30 @@ export class ConsoleViewMessage implements ConsoleViewportElement {
|
|
1446
1443
|
return true;
|
1447
1444
|
}
|
1448
1445
|
|
1446
|
+
private createScriptLocationLinkForSyntaxError(
|
1447
|
+
debuggerModel: SDK.DebuggerModel.DebuggerModel, exceptionDetails: Protocol.Runtime.ExceptionDetails): HTMLElement
|
1448
|
+
|undefined {
|
1449
|
+
const {scriptId, lineNumber, columnNumber} = exceptionDetails;
|
1450
|
+
if (!scriptId) {
|
1451
|
+
return;
|
1452
|
+
}
|
1453
|
+
|
1454
|
+
// SyntaxErrors might not populate the URL field. Try to resolve it via scriptId.
|
1455
|
+
const url = exceptionDetails.url || debuggerModel.scriptForId(scriptId)?.sourceURL;
|
1456
|
+
if (!url) {
|
1457
|
+
return;
|
1458
|
+
}
|
1459
|
+
|
1460
|
+
const scriptLocationLink = this.linkifier.linkifyScriptLocation(
|
1461
|
+
debuggerModel.target(), exceptionDetails.scriptId || null, url, lineNumber, {
|
1462
|
+
columnNumber,
|
1463
|
+
inlineFrameIndex: 0,
|
1464
|
+
showColumnNumber: true,
|
1465
|
+
});
|
1466
|
+
scriptLocationLink.tabIndex = -1;
|
1467
|
+
return scriptLocationLink;
|
1468
|
+
}
|
1469
|
+
|
1449
1470
|
private tryFormatAsError(string: string, exceptionDetails?: Protocol.Runtime.ExceptionDetails): HTMLElement|null {
|
1450
1471
|
const runtimeModel = this.message.runtimeModel();
|
1451
1472
|
if (!runtimeModel) {
|
@@ -1465,6 +1486,20 @@ export class ConsoleViewMessage implements ConsoleViewportElement {
|
|
1465
1486
|
for (let i = 0; i < linkInfos.length; ++i) {
|
1466
1487
|
const newline = i < linkInfos.length - 1 ? '\n' : '';
|
1467
1488
|
const {line, link} = linkInfos[i];
|
1489
|
+
// Syntax errors don't have a stack frame that points to the source position
|
1490
|
+
// where the error occurred. We use the source location from the
|
1491
|
+
// exceptionDetails and append it to the end of the message instead.
|
1492
|
+
if (!link && exceptionDetails && line.startsWith('SyntaxError')) {
|
1493
|
+
formattedResult.appendChild(this.linkifyStringAsFragment(line));
|
1494
|
+
const maybeScriptLocation = this.createScriptLocationLinkForSyntaxError(debuggerModel, exceptionDetails);
|
1495
|
+
if (maybeScriptLocation) {
|
1496
|
+
formattedResult.append(' (at ');
|
1497
|
+
formattedResult.appendChild(maybeScriptLocation);
|
1498
|
+
formattedResult.append(')');
|
1499
|
+
}
|
1500
|
+
formattedResult.append(newline);
|
1501
|
+
continue;
|
1502
|
+
}
|
1468
1503
|
if (!link) {
|
1469
1504
|
formattedResult.appendChild(this.linkifyStringAsFragment(`${line}${newline}`));
|
1470
1505
|
continue;
|
@@ -1475,8 +1510,6 @@ export class ConsoleViewMessage implements ConsoleViewportElement {
|
|
1475
1510
|
const scriptLocationLink = this.linkifier.linkifyScriptLocation(
|
1476
1511
|
debuggerModel.target(), link.scriptId || null, link.url, link.lineNumber, {
|
1477
1512
|
columnNumber: link.columnNumber,
|
1478
|
-
className: undefined,
|
1479
|
-
tabStop: undefined,
|
1480
1513
|
inlineFrameIndex: 0,
|
1481
1514
|
showColumnNumber: true,
|
1482
1515
|
});
|
@@ -35,6 +35,7 @@
|
|
35
35
|
import * as Common from '../../core/common/common.js';
|
36
36
|
import * as Host from '../../core/host/host.js';
|
37
37
|
import * as i18n from '../../core/i18n/i18n.js';
|
38
|
+
import * as Platform from '../../core/platform/platform.js';
|
38
39
|
import * as Root from '../../core/root/root.js';
|
39
40
|
import * as SDK from '../../core/sdk/sdk.js';
|
40
41
|
import * as Extensions from '../../models/extensions/extensions.js';
|
@@ -1269,9 +1270,22 @@ export class DOMNodeRevealer implements Common.Revealer.Revealer {
|
|
1269
1270
|
const panel = ElementsPanel.instance();
|
1270
1271
|
panel.pendingNodeReveal = true;
|
1271
1272
|
|
1272
|
-
return new Promise(revealPromise)
|
1273
|
+
return (new Promise<void>(revealPromise)).catch((reason: Error) => {
|
1274
|
+
let message: string;
|
1275
|
+
if (Platform.UserVisibleError.isUserVisibleError(reason)) {
|
1276
|
+
message = reason.message;
|
1277
|
+
} else {
|
1278
|
+
message = i18nString(UIStrings.nodeCannotBeFoundInTheCurrent);
|
1279
|
+
}
|
1273
1280
|
|
1274
|
-
|
1281
|
+
Common.Console.Console.instance().warn(message);
|
1282
|
+
// Blink tests expect an exception to be raised and unhandled here to detect that the node
|
1283
|
+
// was actually not successfully viewed.
|
1284
|
+
throw reason;
|
1285
|
+
});
|
1286
|
+
|
1287
|
+
function revealPromise(
|
1288
|
+
resolve: () => void, reject: (arg0: Platform.UserVisibleError.UserVisibleError) => void): void {
|
1275
1289
|
if (node instanceof SDK.DOMModel.DOMNode) {
|
1276
1290
|
onNodeResolved((node as SDK.DOMModel.DOMNode));
|
1277
1291
|
} else if (node instanceof SDK.DOMModel.DeferredDOMNode) {
|
@@ -1281,10 +1295,12 @@ export class DOMNodeRevealer implements Common.Revealer.Revealer {
|
|
1281
1295
|
if (domModel) {
|
1282
1296
|
void domModel.pushObjectAsNodeToFrontend(node).then(checkRemoteObjectThenReveal);
|
1283
1297
|
} else {
|
1284
|
-
|
1298
|
+
const msg = i18nString(UIStrings.nodeCannotBeFoundInTheCurrent);
|
1299
|
+
reject(new Platform.UserVisibleError.UserVisibleError(msg));
|
1285
1300
|
}
|
1286
1301
|
} else {
|
1287
|
-
|
1302
|
+
const msg = i18nString(UIStrings.theRemoteObjectCouldNotBe);
|
1303
|
+
reject(new Platform.UserVisibleError.UserVisibleError(msg));
|
1288
1304
|
panel.pendingNodeReveal = false;
|
1289
1305
|
}
|
1290
1306
|
|
@@ -1304,8 +1320,7 @@ export class DOMNodeRevealer implements Common.Revealer.Revealer {
|
|
1304
1320
|
const isDocument = node instanceof SDK.DOMModel.DOMDocument;
|
1305
1321
|
if (!isDocument && isDetached) {
|
1306
1322
|
const msg = i18nString(UIStrings.nodeCannotBeFoundInTheCurrent);
|
1307
|
-
|
1308
|
-
reject(new Error(msg));
|
1323
|
+
reject(new Platform.UserVisibleError.UserVisibleError(msg));
|
1309
1324
|
return;
|
1310
1325
|
}
|
1311
1326
|
|
@@ -1313,14 +1328,14 @@ export class DOMNodeRevealer implements Common.Revealer.Revealer {
|
|
1313
1328
|
void panel.revealAndSelectNode(resolvedNode, !omitFocus).then(resolve);
|
1314
1329
|
return;
|
1315
1330
|
}
|
1316
|
-
|
1331
|
+
const msg = i18nString(UIStrings.nodeCannotBeFoundInTheCurrent);
|
1332
|
+
reject(new Platform.UserVisibleError.UserVisibleError(msg));
|
1317
1333
|
}
|
1318
1334
|
|
1319
1335
|
function checkRemoteObjectThenReveal(resolvedNode: SDK.DOMModel.DOMNode|null): void {
|
1320
1336
|
if (!resolvedNode) {
|
1321
1337
|
const msg = i18nString(UIStrings.theRemoteObjectCouldNotBe);
|
1322
|
-
|
1323
|
-
reject(new Error(msg));
|
1338
|
+
reject(new Platform.UserVisibleError.UserVisibleError(msg));
|
1324
1339
|
return;
|
1325
1340
|
}
|
1326
1341
|
onNodeResolved(resolvedNode);
|
@@ -1329,8 +1344,7 @@ export class DOMNodeRevealer implements Common.Revealer.Revealer {
|
|
1329
1344
|
function checkDeferredDOMNodeThenReveal(resolvedNode: SDK.DOMModel.DOMNode|null): void {
|
1330
1345
|
if (!resolvedNode) {
|
1331
1346
|
const msg = i18nString(UIStrings.theDeferredDomNodeCouldNotBe);
|
1332
|
-
|
1333
|
-
reject(new Error(msg));
|
1347
|
+
reject(new Platform.UserVisibleError.UserVisibleError(msg));
|
1334
1348
|
return;
|
1335
1349
|
}
|
1336
1350
|
onNodeResolved(resolvedNode);
|
@@ -1514,14 +1514,8 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
|
|
1514
1514
|
Components.Linkifier.Linkifier.linkifyURL(rewrittenHref, {
|
1515
1515
|
text: value,
|
1516
1516
|
preventClick: true,
|
1517
|
-
className: undefined,
|
1518
|
-
lineNumber: undefined,
|
1519
|
-
columnNumber: undefined,
|
1520
1517
|
showColumnNumber: false,
|
1521
1518
|
inlineFrameIndex: 0,
|
1522
|
-
maxLength: undefined,
|
1523
|
-
tabStop: undefined,
|
1524
|
-
bypassURLTrimming: undefined,
|
1525
1519
|
});
|
1526
1520
|
return ImagePreviewPopover.setImageUrl(link, rewrittenHref);
|
1527
1521
|
}
|