chrome-devtools-frontend 1.0.1028166 → 1.0.1029692
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 +5 -5
- package/config/gni/devtools_image_files.gni +1 -0
- package/front_end/Images/src/clear-warning_icon.svg +99 -0
- package/front_end/core/common/WasmDisassembly.ts +6 -1
- package/front_end/core/host/ResourceLoader.ts +17 -3
- package/front_end/core/i18n/locales/en-US.json +15 -3
- package/front_end/core/i18n/locales/en-XL.json +15 -3
- package/front_end/core/sdk/NetworkManager.ts +3 -1
- package/front_end/core/sdk/Script.ts +39 -13
- package/front_end/generated/InspectorBackendCommands.js +9 -9
- package/front_end/generated/SupportedCSSProperties.js +2 -4
- package/front_end/generated/protocol.ts +48 -11
- package/front_end/models/bindings/ContentProviderBasedProject.ts +7 -1
- package/front_end/models/issues_manager/AttributionReportingIssue.ts +26 -36
- package/front_end/models/issues_manager/DeprecationIssue.ts +17 -2
- package/front_end/models/issues_manager/descriptions/arInsecureContext.md +7 -0
- package/front_end/models/issues_manager/descriptions/arInvalidRegisterSourceHeader.md +5 -0
- package/front_end/models/issues_manager/descriptions/arInvalidRegisterTriggerHeader.md +5 -0
- package/front_end/models/issues_manager/descriptions/arPermissionPolicyDisabled.md +7 -4
- package/front_end/models/issues_manager/descriptions/arUntrustworthyReportingOrigin.md +10 -0
- package/front_end/models/javascript_metadata/NativeFunctions.js +1 -1
- package/front_end/models/text_utils/ContentProvider.ts +9 -1
- package/front_end/panels/application/components/Prerender2.ts +12 -0
- package/front_end/panels/issues/AttributionReportingIssueDetailsView.ts +11 -42
- package/front_end/panels/network/components/RequestHeadersView.ts +86 -46
- package/front_end/panels/network/network-meta.ts +16 -0
- package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +41 -21
- package/front_end/panels/timeline/TimelineLoader.ts +2 -1
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorController.ts +25 -7
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorPane.ts +22 -30
- package/front_end/ui/legacy/SplitWidget.ts +2 -0
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +9 -51
- package/package.json +1 -1
- package/front_end/models/issues_manager/descriptions/arAttributionSourceUntrustworthyFrameOrigin.md +0 -4
- package/front_end/models/issues_manager/descriptions/arAttributionSourceUntrustworthyOrigin.md +0 -5
- package/front_end/models/issues_manager/descriptions/arAttributionUntrustworthyFrameOrigin.md +0 -4
- package/front_end/models/issues_manager/descriptions/arAttributionUntrustworthyOrigin.md +0 -4
- package/front_end/models/issues_manager/descriptions/arInvalidHeader.md +0 -3
@@ -6,7 +6,6 @@ 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
8
|
import * as Platform from '../../../core/platform/platform.js';
|
9
|
-
import {assertNotNullOrUndefined} from '../../../core/platform/platform.js';
|
10
9
|
import * as SDK from '../../../core/sdk/sdk.js';
|
11
10
|
import * as Protocol from '../../../generated/protocol.js';
|
12
11
|
import * as IssuesManager from '../../../models/issues_manager/issues_manager.js';
|
@@ -212,7 +211,9 @@ export class RequestHeadersComponent extends HTMLElement {
|
|
212
211
|
}
|
213
212
|
|
214
213
|
#render(): void {
|
215
|
-
|
214
|
+
if (!this.#request) {
|
215
|
+
return;
|
216
|
+
}
|
216
217
|
|
217
218
|
// Disabled until https://crbug.com/1079231 is fixed.
|
218
219
|
// clang-format off
|
@@ -224,8 +225,10 @@ export class RequestHeadersComponent extends HTMLElement {
|
|
224
225
|
// clang-format on
|
225
226
|
}
|
226
227
|
|
227
|
-
#renderResponseHeaders(): LitHtml.
|
228
|
-
|
228
|
+
#renderResponseHeaders(): LitHtml.LitTemplate {
|
229
|
+
if (!this.#request) {
|
230
|
+
return LitHtml.nothing;
|
231
|
+
}
|
229
232
|
|
230
233
|
const headersWithIssues = [];
|
231
234
|
if (this.#request.wasBlocked()) {
|
@@ -260,6 +263,18 @@ export class RequestHeadersComponent extends HTMLElement {
|
|
260
263
|
|
261
264
|
const mergedHeaders = mergeHeadersWithIssues(this.#request.sortedResponseHeaders.slice(), headersWithIssues);
|
262
265
|
|
266
|
+
const blockedResponseCookies = this.#request.blockedResponseCookies();
|
267
|
+
const blockedCookieLineToReasons = new Map<string, Protocol.Network.SetCookieBlockedReason[]>(
|
268
|
+
blockedResponseCookies?.map(c => [c.cookieLine, c.blockedReasons]));
|
269
|
+
for (const header of mergedHeaders) {
|
270
|
+
if (header.name.toLowerCase() === 'set-cookie' && header.value) {
|
271
|
+
const matchingBlockedReasons = blockedCookieLineToReasons.get(header.value.toString());
|
272
|
+
if (matchingBlockedReasons) {
|
273
|
+
header.setCookieBlockedReasons = matchingBlockedReasons;
|
274
|
+
}
|
275
|
+
}
|
276
|
+
}
|
277
|
+
|
263
278
|
const toggleShowRaw = (): void => {
|
264
279
|
this.#showResponseHeadersText = !this.#showResponseHeadersText;
|
265
280
|
this.#render();
|
@@ -287,8 +302,10 @@ export class RequestHeadersComponent extends HTMLElement {
|
|
287
302
|
// clang-format on
|
288
303
|
}
|
289
304
|
|
290
|
-
#renderRequestHeaders(): LitHtml.
|
291
|
-
|
305
|
+
#renderRequestHeaders(): LitHtml.LitTemplate {
|
306
|
+
if (!this.#request) {
|
307
|
+
return LitHtml.nothing;
|
308
|
+
}
|
292
309
|
|
293
310
|
const headers = this.#request.requestHeaders().slice();
|
294
311
|
headers.sort(function(a, b) {
|
@@ -325,8 +342,7 @@ export class RequestHeadersComponent extends HTMLElement {
|
|
325
342
|
}
|
326
343
|
|
327
344
|
#maybeRenderProvisionalHeadersWarning(): LitHtml.LitTemplate {
|
328
|
-
|
329
|
-
if (this.#request.requestHeadersText() !== undefined) {
|
345
|
+
if (!this.#request || this.#request.requestHeadersText() !== undefined) {
|
330
346
|
return LitHtml.nothing;
|
331
347
|
}
|
332
348
|
|
@@ -338,14 +354,16 @@ export class RequestHeadersComponent extends HTMLElement {
|
|
338
354
|
} else {
|
339
355
|
cautionText = i18nString(UIStrings.provisionalHeadersAreShown);
|
340
356
|
}
|
357
|
+
// Disabled until https://crbug.com/1079231 is fixed.
|
358
|
+
// clang-format off
|
341
359
|
return html`
|
342
360
|
<div class="call-to-action">
|
343
361
|
<div class="call-to-action-body">
|
344
362
|
<div class="explanation" title=${cautionTitle}>
|
345
363
|
<${IconButton.Icon.Icon.litTagName} class="inline-icon" .data=${{
|
346
|
-
|
347
|
-
|
348
|
-
|
364
|
+
iconName: 'clear-warning_icon',
|
365
|
+
width: '12px',
|
366
|
+
height: '12px',
|
349
367
|
} as IconButton.Icon.IconData}>
|
350
368
|
</${IconButton.Icon.Icon.litTagName}>
|
351
369
|
${cautionText} <x-link href="https://developer.chrome.com/docs/devtools/network/reference/#provisional-headers" class="link">${i18nString(UIStrings.learnMore)}</x-link>
|
@@ -353,6 +371,7 @@ export class RequestHeadersComponent extends HTMLElement {
|
|
353
371
|
</div>
|
354
372
|
</div>
|
355
373
|
`;
|
374
|
+
// clang-format on
|
356
375
|
}
|
357
376
|
|
358
377
|
#renderHeader(header: HeaderDescriptor): LitHtml.TemplateResult {
|
@@ -361,51 +380,65 @@ export class RequestHeadersComponent extends HTMLElement {
|
|
361
380
|
return html`
|
362
381
|
<div class="row">
|
363
382
|
<div class="header-name">
|
364
|
-
${header.headerNotSet ?
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
383
|
+
${header.headerNotSet ?
|
384
|
+
html`<div class="header-badge header-badge-text">${i18n.i18n.lockedString('not-set')}</div>` :
|
385
|
+
LitHtml.nothing
|
386
|
+
}${header.name}:
|
387
|
+
</div>
|
388
|
+
<div class="header-value ${header.headerValueIncorrect ? 'header-warning' : ''}">
|
389
|
+
${header.value?.toString() || ''}
|
390
|
+
${this.#maybeRenderHeaderValueSuffix(header)}
|
369
391
|
</div>
|
370
|
-
${this.#renderHeaderValue(header)}
|
371
392
|
</div>
|
372
|
-
${this.#
|
393
|
+
${this.#maybeRenderBlockedDetails(header.blockedDetails)}
|
373
394
|
`;
|
374
395
|
// clang-format on
|
375
396
|
}
|
376
397
|
|
377
|
-
#
|
398
|
+
#maybeRenderHeaderValueSuffix(header: HeaderDescriptor): LitHtml.LitTemplate {
|
378
399
|
const headerId = header.name.toLowerCase();
|
400
|
+
|
401
|
+
if (headerId === 'set-cookie' && header.setCookieBlockedReasons) {
|
402
|
+
const titleText =
|
403
|
+
header.setCookieBlockedReasons.map(SDK.NetworkRequest.setCookieBlockedReasonToUiString).join('\n');
|
404
|
+
// Disabled until https://crbug.com/1079231 is fixed.
|
405
|
+
// clang-format off
|
406
|
+
return html`
|
407
|
+
<${IconButton.Icon.Icon.litTagName} class="inline-icon" title=${titleText} .data=${{
|
408
|
+
iconName: 'clear-warning_icon',
|
409
|
+
width: '12px',
|
410
|
+
height: '12px',
|
411
|
+
} as IconButton.Icon.IconData}>
|
412
|
+
</${IconButton.Icon.Icon.litTagName}>
|
413
|
+
`;
|
414
|
+
// clang-format on
|
415
|
+
}
|
416
|
+
|
379
417
|
if (headerId === 'x-client-data') {
|
380
418
|
const data = ClientVariations.parseClientVariations(header.value?.toString() || '');
|
381
419
|
const output = ClientVariations.formatClientVariations(
|
382
420
|
data, i18nString(UIStrings.activeClientExperimentVariation),
|
383
421
|
i18nString(UIStrings.activeClientExperimentVariationIds));
|
384
422
|
return html`
|
385
|
-
<div
|
386
|
-
|
387
|
-
<div>${i18nString(UIStrings.decoded)}</div>
|
388
|
-
<code>${output}</code>
|
389
|
-
</div>
|
423
|
+
<div>${i18nString(UIStrings.decoded)}</div>
|
424
|
+
<code>${output}</code>
|
390
425
|
`;
|
391
426
|
}
|
392
427
|
|
393
|
-
return
|
394
|
-
<div class="header-value ${header.headerValueIncorrect ? 'header-warning' : ''}">
|
395
|
-
${header.value?.toString() || ''}
|
396
|
-
</div>
|
397
|
-
`;
|
428
|
+
return LitHtml.nothing;
|
398
429
|
}
|
399
430
|
|
400
|
-
#
|
401
|
-
if (!
|
431
|
+
#maybeRenderBlockedDetails(blockedDetails?: BlockedDetailsDescriptor): LitHtml.LitTemplate {
|
432
|
+
if (!blockedDetails) {
|
402
433
|
return LitHtml.nothing;
|
403
434
|
}
|
435
|
+
// Disabled until https://crbug.com/1079231 is fixed.
|
436
|
+
// clang-format off
|
404
437
|
return html`
|
405
438
|
<div class="call-to-action">
|
406
439
|
<div class="call-to-action-body">
|
407
|
-
<div class="explanation">${
|
408
|
-
${
|
440
|
+
<div class="explanation">${blockedDetails.explanation()}</div>
|
441
|
+
${blockedDetails.examples.map(example => html`
|
409
442
|
<div class="example">
|
410
443
|
<code>${example.codeSnippet}</code>
|
411
444
|
${example.comment ? html`
|
@@ -413,13 +446,14 @@ export class RequestHeadersComponent extends HTMLElement {
|
|
413
446
|
` : ''}
|
414
447
|
</div>
|
415
448
|
`)}
|
416
|
-
${this.#
|
449
|
+
${this.#maybeRenderBlockedDetailsLink(blockedDetails)}
|
417
450
|
</div>
|
418
451
|
</div>
|
419
452
|
`;
|
453
|
+
// clang-format on
|
420
454
|
}
|
421
455
|
|
422
|
-
#
|
456
|
+
#maybeRenderBlockedDetailsLink(blockedDetails?: BlockedDetailsDescriptor): LitHtml.LitTemplate {
|
423
457
|
if (this.#request && IssuesManager.RelatedIssue.hasIssueOfCategory(this.#request, IssuesManager.Issue.IssueCategory.CrossOriginEmbedderPolicy)) {
|
424
458
|
const followLink = (): void => {
|
425
459
|
Host.userMetrics.issuesPanelOpenedFrom(Host.UserMetrics.IssueOpener.LearnMoreLinkCOEP);
|
@@ -441,9 +475,11 @@ export class RequestHeadersComponent extends HTMLElement {
|
|
441
475
|
</div>
|
442
476
|
`;
|
443
477
|
}
|
444
|
-
if (
|
478
|
+
if (blockedDetails?.link) {
|
479
|
+
// Disabled until https://crbug.com/1079231 is fixed.
|
480
|
+
// clang-format off
|
445
481
|
return html`
|
446
|
-
<x-link href=${
|
482
|
+
<x-link href=${blockedDetails.link.url} class="link">
|
447
483
|
<${IconButton.Icon.Icon.litTagName} class="inline-icon" .data=${{
|
448
484
|
iconName: 'link_icon',
|
449
485
|
color: 'var(--color-link)',
|
@@ -454,6 +490,7 @@ export class RequestHeadersComponent extends HTMLElement {
|
|
454
490
|
>${i18nString(UIStrings.learnMore)}
|
455
491
|
</x-link>
|
456
492
|
`;
|
493
|
+
// clang-format on
|
457
494
|
}
|
458
495
|
return LitHtml.nothing;
|
459
496
|
}
|
@@ -502,8 +539,10 @@ export class RequestHeadersComponent extends HTMLElement {
|
|
502
539
|
`;
|
503
540
|
}
|
504
541
|
|
505
|
-
#renderGeneralSection(): LitHtml.
|
506
|
-
|
542
|
+
#renderGeneralSection(): LitHtml.LitTemplate {
|
543
|
+
if (!this.#request) {
|
544
|
+
return LitHtml.nothing;
|
545
|
+
}
|
507
546
|
|
508
547
|
let coloredCircleClassName = 'red-circle';
|
509
548
|
if (this.#request.statusCode < 300 || this.#request.statusCode === 304) {
|
@@ -674,7 +713,7 @@ declare global {
|
|
674
713
|
}
|
675
714
|
}
|
676
715
|
|
677
|
-
interface
|
716
|
+
interface BlockedDetailsDescriptor {
|
678
717
|
explanation: () => string;
|
679
718
|
examples: Array<{
|
680
719
|
codeSnippet: string,
|
@@ -689,8 +728,9 @@ interface HeaderDescriptor {
|
|
689
728
|
name: string;
|
690
729
|
value: Object|null;
|
691
730
|
headerValueIncorrect?: boolean|null;
|
692
|
-
|
731
|
+
blockedDetails?: BlockedDetailsDescriptor;
|
693
732
|
headerNotSet: boolean|null;
|
733
|
+
setCookieBlockedReasons?: Protocol.Network.SetCookieBlockedReason[];
|
694
734
|
}
|
695
735
|
|
696
736
|
const BlockedReasonDetails = new Map<Protocol.Network.BlockedReason, HeaderDescriptor>([
|
@@ -700,7 +740,7 @@ const BlockedReasonDetails = new Map<Protocol.Network.BlockedReason, HeaderDescr
|
|
700
740
|
name: 'cross-origin-embedder-policy',
|
701
741
|
value: null,
|
702
742
|
headerValueIncorrect: null,
|
703
|
-
|
743
|
+
blockedDetails: {
|
704
744
|
explanation: i18nLazyString(UIStrings.toEmbedThisFrameInYourDocument),
|
705
745
|
examples: [{codeSnippet: 'Cross-Origin-Embedder-Policy: require-corp', comment: undefined}],
|
706
746
|
link: {url: 'https://web.dev/coop-coep/'},
|
@@ -714,7 +754,7 @@ const BlockedReasonDetails = new Map<Protocol.Network.BlockedReason, HeaderDescr
|
|
714
754
|
name: 'cross-origin-resource-policy',
|
715
755
|
value: null,
|
716
756
|
headerValueIncorrect: null,
|
717
|
-
|
757
|
+
blockedDetails: {
|
718
758
|
explanation: i18nLazyString(UIStrings.toUseThisResourceFromADifferent),
|
719
759
|
examples: [
|
720
760
|
{
|
@@ -737,7 +777,7 @@ const BlockedReasonDetails = new Map<Protocol.Network.BlockedReason, HeaderDescr
|
|
737
777
|
name: 'cross-origin-opener-policy',
|
738
778
|
value: null,
|
739
779
|
headerValueIncorrect: false,
|
740
|
-
|
780
|
+
blockedDetails: {
|
741
781
|
explanation: i18nLazyString(UIStrings.thisDocumentWasBlockedFrom),
|
742
782
|
examples: [],
|
743
783
|
link: {url: 'https://web.dev/coop-coep/'},
|
@@ -751,7 +791,7 @@ const BlockedReasonDetails = new Map<Protocol.Network.BlockedReason, HeaderDescr
|
|
751
791
|
name: 'cross-origin-resource-policy',
|
752
792
|
value: null,
|
753
793
|
headerValueIncorrect: true,
|
754
|
-
|
794
|
+
blockedDetails: {
|
755
795
|
explanation: i18nLazyString(UIStrings.toUseThisResourceFromADifferentSite),
|
756
796
|
examples: [
|
757
797
|
{
|
@@ -770,7 +810,7 @@ const BlockedReasonDetails = new Map<Protocol.Network.BlockedReason, HeaderDescr
|
|
770
810
|
name: 'cross-origin-resource-policy',
|
771
811
|
value: null,
|
772
812
|
headerValueIncorrect: true,
|
773
|
-
|
813
|
+
blockedDetails: {
|
774
814
|
explanation: i18nLazyString(UIStrings.toUseThisResourceFromADifferentOrigin),
|
775
815
|
examples: [
|
776
816
|
{
|
@@ -108,6 +108,11 @@ const UIStrings = {
|
|
108
108
|
*@description Title of a setting under the Network category that can be invoked through the Command Menu
|
109
109
|
*/
|
110
110
|
dontGroupNetworkLogItemsByFrame: 'Don\'t group network log items by frame',
|
111
|
+
/**
|
112
|
+
* @description Label of a checkbox in the DevTools settings UI.
|
113
|
+
*/
|
114
|
+
enableUNCLoading:
|
115
|
+
'Allow `DevTools` to load resources, such as source maps, from Windows Shares via `UNC` paths. Disabled by default for security reasons.',
|
111
116
|
};
|
112
117
|
const str_ = i18n.i18n.registerUIStrings('panels/network/network-meta.ts', UIStrings);
|
113
118
|
const i18nLazyString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined, str_);
|
@@ -316,6 +321,17 @@ Common.Settings.registerSettingExtension({
|
|
316
321
|
],
|
317
322
|
});
|
318
323
|
|
324
|
+
// While this setting is used by the Network module, we place it under the
|
325
|
+
// "sources" category as source map loading is the dominant use case.
|
326
|
+
Common.Settings.registerSettingExtension({
|
327
|
+
category: Common.Settings.SettingCategory.SOURCES,
|
328
|
+
storageType: Common.Settings.SettingStorageType.Synced,
|
329
|
+
title: i18nLazyString(UIStrings.enableUNCLoading),
|
330
|
+
settingName: 'network.enable-unc-loading',
|
331
|
+
settingType: Common.Settings.SettingType.BOOLEAN,
|
332
|
+
defaultValue: false,
|
333
|
+
});
|
334
|
+
|
319
335
|
UI.ViewManager.registerLocationResolver({
|
320
336
|
name: UI.ViewManager.ViewLocationValues.NETWORK_SIDEBAR,
|
321
337
|
category: UI.ViewManager.ViewLocationCategoryValues.NETWORK,
|
@@ -82,6 +82,11 @@ const UIStrings = {
|
|
82
82
|
*@description A placeholder for an input in Protocol Monitor. The input accepts commands that are sent to the backend on Enter. CDP stands for Chrome DevTools Protocol.
|
83
83
|
*/
|
84
84
|
sendRawCDPCommand: 'Send a raw `CDP` command',
|
85
|
+
/**
|
86
|
+
* @description A tooltip text for the input in the Protocol Monitor panel. The tooltip describes what format is expected.
|
87
|
+
*/
|
88
|
+
sendRawCDPCommandExplanation:
|
89
|
+
'Format: `\'Domain.commandName\'` for a command without parameters, or `\'{"command":"Domain.commandName", "parameters": {...}}\'` as a JSON object for a command with parameters. `\'cmd\'`/`\'method\'` and `\'args\'`/`\'params\'`/`\'arguments\'` are also supported as alternative keys for the `JSON` object.',
|
85
90
|
};
|
86
91
|
const str_ = i18n.i18n.registerUIStrings('panels/protocol_monitor/ProtocolMonitor.ts', UIStrings);
|
87
92
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
@@ -287,28 +292,29 @@ export class ProtocolMonitorImpl extends UI.Widget.VBox {
|
|
287
292
|
});
|
288
293
|
topToolbar.appendToolbarItem(this.textFilterUI);
|
289
294
|
|
290
|
-
const onSend = (): void => {
|
291
|
-
const value = input.value();
|
292
|
-
// If input cannot be parsed as json, we assume it's the command name
|
293
|
-
// for a command without parameters. Otherwise, we expect an object
|
294
|
-
// with "command" and "parameters" attributes.
|
295
|
-
let json = null;
|
296
|
-
try {
|
297
|
-
json = JSON.parse(value);
|
298
|
-
} catch (err) {
|
299
|
-
}
|
300
|
-
const command = json ? json.command : value;
|
301
|
-
const parameters = json ? json.parameters : null;
|
302
|
-
const test = ProtocolClient.InspectorBackend.test;
|
303
|
-
// TODO: TS thinks that properties are read-only because
|
304
|
-
// in TS test is defined as a namespace.
|
305
|
-
// @ts-ignore
|
306
|
-
test.sendRawMessage(command, parameters, () => {});
|
307
|
-
};
|
308
|
-
const input = new UI.Toolbar.ToolbarInput(i18nString(UIStrings.sendRawCDPCommand), '', 1, .2, '', undefined, false);
|
309
|
-
input.addEventListener(UI.Toolbar.ToolbarInput.Event.EnterPressed, onSend);
|
310
295
|
const bottomToolbar = new UI.Toolbar.Toolbar('protocol-monitor-bottom-toolbar', this.contentElement);
|
311
|
-
bottomToolbar.appendToolbarItem(
|
296
|
+
bottomToolbar.appendToolbarItem(this.#createCommandInput());
|
297
|
+
}
|
298
|
+
|
299
|
+
#createCommandInput(): UI.Toolbar.ToolbarInput {
|
300
|
+
const placeholder = i18nString(UIStrings.sendRawCDPCommand);
|
301
|
+
const accessiblePlaceholder = placeholder;
|
302
|
+
const growFactor = 1;
|
303
|
+
const shrinkFactor = 0.2;
|
304
|
+
const tooltip = i18nString(UIStrings.sendRawCDPCommandExplanation);
|
305
|
+
const input = new UI.Toolbar.ToolbarInput(
|
306
|
+
placeholder, accessiblePlaceholder, growFactor, shrinkFactor, tooltip, undefined, false);
|
307
|
+
input.addEventListener(UI.Toolbar.ToolbarInput.Event.EnterPressed, () => this.#onCommandSend(input));
|
308
|
+
return input;
|
309
|
+
}
|
310
|
+
|
311
|
+
#onCommandSend(input: UI.Toolbar.ToolbarInput): void {
|
312
|
+
const {command, parameters} = parseCommandInput(input.value());
|
313
|
+
const test = ProtocolClient.InspectorBackend.test;
|
314
|
+
// TODO: TS thinks that properties are read-only because
|
315
|
+
// in TS test is defined as a namespace.
|
316
|
+
// @ts-ignore
|
317
|
+
test.sendRawMessage(command, parameters, () => {});
|
312
318
|
}
|
313
319
|
|
314
320
|
static instance(opts = {forceNew: null}): ProtocolMonitorImpl {
|
@@ -518,3 +524,17 @@ export class InfoWidget extends UI.Widget.VBox {
|
|
518
524
|
this.tabbedPane.changeTabView('response', SourceFrame.JSONView.JSONView.createViewSync(responseParsed));
|
519
525
|
}
|
520
526
|
}
|
527
|
+
|
528
|
+
export function parseCommandInput(input: string): {command: string, parameters: unknown} {
|
529
|
+
// If input cannot be parsed as json, we assume it's the command name
|
530
|
+
// for a command without parameters. Otherwise, we expect an object
|
531
|
+
// with "command"/"method"/"cmd" and "parameters"/"params"/"args"/"arguments" attributes.
|
532
|
+
let json = null;
|
533
|
+
try {
|
534
|
+
json = JSON.parse(input);
|
535
|
+
} catch (err) {
|
536
|
+
}
|
537
|
+
const command = json ? json.command || json.method || json.cmd : input;
|
538
|
+
const parameters = json ? json.parameters || json.params || json.args || json.arguments : null;
|
539
|
+
return {command, parameters};
|
540
|
+
}
|
@@ -98,7 +98,8 @@ export class TimelineLoader implements Common.StringOutputStream.OutputStream {
|
|
98
98
|
|
99
99
|
static loadFromURL(url: Platform.DevToolsPath.UrlString, client: Client): TimelineLoader {
|
100
100
|
const loader = new TimelineLoader(client);
|
101
|
-
|
101
|
+
const allowFileUNCPaths = Common.Settings.Settings.instance().moduleSetting('network.enable-unc-loading').get();
|
102
|
+
Host.ResourceLoader.loadAsStream(url, null, loader, undefined, allowFileUNCPaths);
|
102
103
|
return loader;
|
103
104
|
}
|
104
105
|
|
@@ -111,6 +111,7 @@ type SerializableSettings = {
|
|
111
111
|
export class LinearMemoryInspectorController extends SDK.TargetManager.SDKModelObserver<SDK.RuntimeModel.RuntimeModel> {
|
112
112
|
#paneInstance = LinearMemoryInspectorPaneImpl.instance();
|
113
113
|
#bufferIdToRemoteObject: Map<string, SDK.RemoteObject.RemoteObject> = new Map();
|
114
|
+
#bufferIdToHighlightInfo: Map<string, HighlightInfo> = new Map();
|
114
115
|
#settings: Common.Settings.Setting<SerializableSettings>;
|
115
116
|
|
116
117
|
private constructor() {
|
@@ -178,6 +179,18 @@ export class LinearMemoryInspectorController extends SDK.TargetManager.SDKModelO
|
|
178
179
|
};
|
179
180
|
}
|
180
181
|
|
182
|
+
getHighlightInfo(bufferId: string): HighlightInfo|undefined {
|
183
|
+
return this.#bufferIdToHighlightInfo.get(bufferId);
|
184
|
+
}
|
185
|
+
|
186
|
+
#setHighlightInfo(bufferId: string, highlightInfo: HighlightInfo): void {
|
187
|
+
this.#bufferIdToHighlightInfo.set(bufferId, highlightInfo);
|
188
|
+
}
|
189
|
+
|
190
|
+
#resetHighlightInfo(bufferId: string): void {
|
191
|
+
this.#bufferIdToHighlightInfo.delete(bufferId);
|
192
|
+
}
|
193
|
+
|
181
194
|
static async retrieveDWARFMemoryObjectAndAddress(obj: SDK.RemoteObject.RemoteObject):
|
182
195
|
Promise<{obj: SDK.RemoteObject.RemoteObject, address: number}|undefined> {
|
183
196
|
if (obj instanceof Bindings.DebuggerLanguagePlugins.ExtensionRemoteObject) {
|
@@ -253,8 +266,6 @@ export class LinearMemoryInspectorController extends SDK.TargetManager.SDKModelO
|
|
253
266
|
memoryObj = response.obj;
|
254
267
|
}
|
255
268
|
|
256
|
-
const highlightInfo = this.#extractHighlightInfo(obj, memoryAddress);
|
257
|
-
|
258
269
|
if (memoryAddress !== undefined) {
|
259
270
|
Host.userMetrics.linearMemoryInspectorTarget(
|
260
271
|
Host.UserMetrics.LinearMemoryInspectorTarget.DWARFInspectableAddress);
|
@@ -277,9 +288,14 @@ export class LinearMemoryInspectorController extends SDK.TargetManager.SDKModelO
|
|
277
288
|
}
|
278
289
|
const memoryProperty = internalProperties?.find(({name}) => name === '[[WebAssemblyMemory]]');
|
279
290
|
const memory = memoryProperty?.value;
|
280
|
-
|
291
|
+
const highlightInfo = LinearMemoryInspectorController.extractHighlightInfo(obj, memoryAddress);
|
292
|
+
if (highlightInfo !== undefined) {
|
293
|
+
this.#setHighlightInfo(id, highlightInfo);
|
294
|
+
} else {
|
295
|
+
this.#resetHighlightInfo(id);
|
296
|
+
}
|
281
297
|
if (this.#bufferIdToRemoteObject.has(id)) {
|
282
|
-
this.#paneInstance.reveal(id, memoryAddress
|
298
|
+
this.#paneInstance.reveal(id, memoryAddress);
|
283
299
|
void UI.ViewManager.ViewManager.instance().showView('linear-memory-inspector');
|
284
300
|
return;
|
285
301
|
}
|
@@ -288,11 +304,11 @@ export class LinearMemoryInspectorController extends SDK.TargetManager.SDKModelO
|
|
288
304
|
this.#bufferIdToRemoteObject.set(id, buffer.object());
|
289
305
|
const arrayBufferWrapper = new RemoteArrayBufferWrapper(buffer);
|
290
306
|
|
291
|
-
this.#paneInstance.create(id, title, arrayBufferWrapper, memoryAddress
|
307
|
+
this.#paneInstance.create(id, title, arrayBufferWrapper, memoryAddress);
|
292
308
|
void UI.ViewManager.ViewManager.instance().showView('linear-memory-inspector');
|
293
309
|
}
|
294
310
|
|
295
|
-
|
311
|
+
static extractHighlightInfo(obj: SDK.RemoteObject.RemoteObject, memoryAddress?: number): HighlightInfo|undefined {
|
296
312
|
let highlightInfo;
|
297
313
|
if (obj instanceof Bindings.DebuggerLanguagePlugins.ValueNode) {
|
298
314
|
try {
|
@@ -311,6 +327,7 @@ export class LinearMemoryInspectorController extends SDK.TargetManager.SDKModelO
|
|
311
327
|
for (const [bufferId, remoteObject] of this.#bufferIdToRemoteObject) {
|
312
328
|
if (model === remoteObject.runtimeModel()) {
|
313
329
|
this.#bufferIdToRemoteObject.delete(bufferId);
|
330
|
+
this.#resetHighlightInfo(bufferId);
|
314
331
|
this.#paneInstance.close(bufferId);
|
315
332
|
}
|
316
333
|
}
|
@@ -320,7 +337,7 @@ export class LinearMemoryInspectorController extends SDK.TargetManager.SDKModelO
|
|
320
337
|
const debuggerModel = event.data;
|
321
338
|
for (const [bufferId, remoteObject] of this.#bufferIdToRemoteObject) {
|
322
339
|
if (debuggerModel.runtimeModel() === remoteObject.runtimeModel()) {
|
323
|
-
this.#
|
340
|
+
this.#resetHighlightInfo(bufferId);
|
324
341
|
this.#paneInstance.refreshView(bufferId);
|
325
342
|
}
|
326
343
|
}
|
@@ -336,5 +353,6 @@ export class LinearMemoryInspectorController extends SDK.TargetManager.SDKModelO
|
|
336
353
|
remoteObj.release();
|
337
354
|
}
|
338
355
|
this.#bufferIdToRemoteObject.delete(bufferId);
|
356
|
+
this.#resetHighlightInfo(bufferId);
|
339
357
|
}
|
340
358
|
}
|
@@ -84,14 +84,13 @@ export class LinearMemoryInspectorPaneImpl extends Common.ObjectWrapper.eventMix
|
|
84
84
|
getViewForTabId(tabId: string): LinearMemoryInspectorView {
|
85
85
|
const view = this.#tabIdToInspectorView.get(tabId);
|
86
86
|
if (!view) {
|
87
|
-
throw new Error(`No linear memory inspector view for given tab id: ${tabId}`);
|
87
|
+
throw new Error(`No linear memory inspector view for the given tab id: ${tabId}`);
|
88
88
|
}
|
89
89
|
return view;
|
90
90
|
}
|
91
91
|
|
92
|
-
create(tabId: string, title: string, arrayWrapper: LazyUint8Array, address?: number
|
93
|
-
|
94
|
-
const inspectorView = new LinearMemoryInspectorView(arrayWrapper, address, highlightInfo);
|
92
|
+
create(tabId: string, title: string, arrayWrapper: LazyUint8Array, address?: number): void {
|
93
|
+
const inspectorView = new LinearMemoryInspectorView(arrayWrapper, address, tabId);
|
95
94
|
this.#tabIdToInspectorView.set(tabId, inspectorView);
|
96
95
|
this.#tabbedPane.appendTab(tabId, title, inspectorView, undefined, false, true);
|
97
96
|
this.#tabbedPane.selectTab(tabId);
|
@@ -101,15 +100,12 @@ export class LinearMemoryInspectorPaneImpl extends Common.ObjectWrapper.eventMix
|
|
101
100
|
this.#tabbedPane.closeTab(tabId, false);
|
102
101
|
}
|
103
102
|
|
104
|
-
reveal(tabId: string, address?: number
|
103
|
+
reveal(tabId: string, address?: number): void {
|
105
104
|
const view = this.getViewForTabId(tabId);
|
106
105
|
|
107
106
|
if (address !== undefined) {
|
108
107
|
view.updateAddress(address);
|
109
108
|
}
|
110
|
-
if (highlightInfo !== undefined) {
|
111
|
-
view.updateHighlightInfo(highlightInfo);
|
112
|
-
}
|
113
109
|
this.refreshView(tabId);
|
114
110
|
this.#tabbedPane.selectTab(tabId);
|
115
111
|
}
|
@@ -119,11 +115,6 @@ export class LinearMemoryInspectorPaneImpl extends Common.ObjectWrapper.eventMix
|
|
119
115
|
view.refreshData();
|
120
116
|
}
|
121
117
|
|
122
|
-
resetHighlightInfo(tabId: string): void {
|
123
|
-
const view = this.getViewForTabId(tabId);
|
124
|
-
view.updateHighlightInfo(undefined);
|
125
|
-
}
|
126
|
-
|
127
118
|
#tabClosed(event: Common.EventTarget.EventTargetEvent<UI.TabbedPane.EventData>): void {
|
128
119
|
const {tabId} = event.data;
|
129
120
|
this.#tabIdToInspectorView.delete(tabId);
|
@@ -142,10 +133,10 @@ export type EventTypes = {
|
|
142
133
|
class LinearMemoryInspectorView extends UI.Widget.VBox {
|
143
134
|
#memoryWrapper: LazyUint8Array;
|
144
135
|
#address: number;
|
145
|
-
#
|
136
|
+
#tabId: string;
|
146
137
|
#inspector: LinearMemoryInspector;
|
147
138
|
firstTimeOpen: boolean;
|
148
|
-
constructor(memoryWrapper: LazyUint8Array, address: number|undefined = 0,
|
139
|
+
constructor(memoryWrapper: LazyUint8Array, address: number|undefined = 0, tabId: string) {
|
149
140
|
super(false);
|
150
141
|
|
151
142
|
if (address < 0 || address >= memoryWrapper.length()) {
|
@@ -154,7 +145,7 @@ class LinearMemoryInspectorView extends UI.Widget.VBox {
|
|
154
145
|
|
155
146
|
this.#memoryWrapper = memoryWrapper;
|
156
147
|
this.#address = address;
|
157
|
-
this.#
|
148
|
+
this.#tabId = tabId;
|
158
149
|
this.#inspector = new LinearMemoryInspector();
|
159
150
|
this.#inspector.addEventListener('memoryrequest', (event: MemoryRequestEvent) => {
|
160
151
|
this.#memoryRequested(event);
|
@@ -186,18 +177,6 @@ class LinearMemoryInspectorView extends UI.Widget.VBox {
|
|
186
177
|
this.#address = address;
|
187
178
|
}
|
188
179
|
|
189
|
-
updateHighlightInfo(highlightInfo?: HighlightInfo): void {
|
190
|
-
if (highlightInfo !== undefined) {
|
191
|
-
if (highlightInfo.startAddress < 0 || highlightInfo.startAddress >= this.#memoryWrapper.length()) {
|
192
|
-
throw new Error('Highlight info start address is out of bounds.');
|
193
|
-
}
|
194
|
-
if (highlightInfo.size < 0) {
|
195
|
-
throw new Error('Highlight size cannot be negative.');
|
196
|
-
}
|
197
|
-
}
|
198
|
-
this.#highlightInfo = highlightInfo;
|
199
|
-
}
|
200
|
-
|
201
180
|
refreshData(): void {
|
202
181
|
void LinearMemoryInspectorController.getMemoryForAddress(this.#memoryWrapper, this.#address).then(({
|
203
182
|
memory,
|
@@ -221,7 +200,7 @@ class LinearMemoryInspectorView extends UI.Widget.VBox {
|
|
221
200
|
valueTypes,
|
222
201
|
valueTypeModes,
|
223
202
|
endianness,
|
224
|
-
highlightInfo: this.#
|
203
|
+
highlightInfo: this.#getHighlightInfo(),
|
225
204
|
};
|
226
205
|
});
|
227
206
|
}
|
@@ -238,8 +217,21 @@ class LinearMemoryInspectorView extends UI.Widget.VBox {
|
|
238
217
|
address: address,
|
239
218
|
memoryOffset: start,
|
240
219
|
outerMemoryLength: this.#memoryWrapper.length(),
|
241
|
-
highlightInfo: this.#
|
220
|
+
highlightInfo: this.#getHighlightInfo(),
|
242
221
|
};
|
243
222
|
});
|
244
223
|
}
|
224
|
+
|
225
|
+
#getHighlightInfo(): HighlightInfo|undefined {
|
226
|
+
const highlightInfo = LinearMemoryInspectorController.instance().getHighlightInfo(this.#tabId);
|
227
|
+
if (highlightInfo !== undefined) {
|
228
|
+
if (highlightInfo.startAddress < 0 || highlightInfo.startAddress >= this.#memoryWrapper.length()) {
|
229
|
+
throw new Error('Highlight info start address is out of bounds.');
|
230
|
+
}
|
231
|
+
if (highlightInfo.size <= 0) {
|
232
|
+
throw new Error('Highlight size must be a positive number.');
|
233
|
+
}
|
234
|
+
}
|
235
|
+
return highlightInfo;
|
236
|
+
}
|
245
237
|
}
|
@@ -532,6 +532,7 @@ export class SplitWidget extends Common.ObjectWrapper.eventMixin<EventTypes, typ
|
|
532
532
|
// This order of things is important.
|
533
533
|
// 1. Resize main element early and force layout.
|
534
534
|
this.contentElement.style.setProperty(animatedMarginPropertyName, marginFrom);
|
535
|
+
this.contentElement.style.setProperty('overflow', 'hidden');
|
535
536
|
if (!reverse) {
|
536
537
|
suppressUnused(this.mainElement.offsetWidth);
|
537
538
|
suppressUnused(this.sidebarElementInternal.offsetWidth);
|
@@ -579,6 +580,7 @@ export class SplitWidget extends Common.ObjectWrapper.eventMixin<EventTypes, typ
|
|
579
580
|
this.contentElement.style.removeProperty('margin-bottom');
|
580
581
|
this.contentElement.style.removeProperty('margin-left');
|
581
582
|
this.contentElement.style.removeProperty('transition');
|
583
|
+
this.contentElement.style.removeProperty('overflow');
|
582
584
|
|
583
585
|
if (this.animationFrameHandle) {
|
584
586
|
this.contentElement.window().cancelAnimationFrame(this.animationFrameHandle);
|