chrome-devtools-frontend 1.0.1556696 → 1.0.1558690
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/Object.ts +5 -1
- package/front_end/core/host/ResourceLoader.ts +1 -1
- package/front_end/core/host/UserMetrics.ts +3 -1
- package/front_end/core/sdk/DOMModel.ts +7 -0
- package/front_end/core/sdk/NetworkManager.ts +0 -7
- package/front_end/core/sdk/SourceMap.ts +16 -2
- package/front_end/core/sdk/SourceMapManager.ts +1 -1
- package/front_end/core/sdk/SourceMapScopesInfo.ts +11 -4
- package/front_end/entrypoints/formatter_worker/FormatterActions.ts +1 -0
- package/front_end/entrypoints/formatter_worker/ScopeParser.ts +51 -8
- package/front_end/entrypoints/main/GlobalAiButton.ts +5 -1
- package/front_end/generated/Deprecation.ts +0 -7
- package/front_end/generated/InspectorBackendCommands.ts +3 -3
- package/front_end/generated/protocol.ts +9 -0
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +3 -3
- package/front_end/models/bindings/CompilerScriptMapping.ts +7 -6
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +4 -4
- package/front_end/models/javascript_metadata/NativeFunctions.js +2 -2
- package/front_end/models/stack_trace/StackTraceImpl.ts +5 -3
- package/front_end/models/stack_trace/StackTraceModel.ts +53 -40
- package/front_end/models/trace/EventsSerializer.ts +8 -2
- package/front_end/models/trace/handlers/LayoutShiftsHandler.ts +2 -2
- package/front_end/panels/application/AppManifestView.ts +134 -223
- package/front_end/panels/application/CookieItemsView.ts +1 -0
- package/front_end/panels/application/SharedStorageTreeElement.ts +3 -0
- package/front_end/panels/application/appManifestView.css +1 -1
- package/front_end/panels/console/ConsoleViewMessage.ts +4 -3
- package/front_end/panels/elements/ElementsTreeElement.ts +30 -1
- package/front_end/panels/elements/ElementsTreeOutlineRenderer.ts +7 -1
- package/front_end/panels/elements/components/AdornerManager.ts +8 -0
- package/front_end/panels/emulation/DeviceModeToolbar.ts +3 -1
- package/front_end/panels/issues/AffectedResourcesView.ts +0 -1
- package/front_end/panels/lighthouse/LighthousePanel.ts +10 -0
- package/front_end/panels/lighthouse/lighthousePanel.css +46 -3
- package/front_end/panels/network/NetworkLogViewColumns.ts +9 -9
- package/front_end/panels/network/RequestCookiesView.ts +125 -141
- package/front_end/panels/network/components/RequestHeadersView.ts +2 -2
- package/front_end/panels/network/requestCookiesView.css +22 -20
- package/front_end/panels/recorder/components/RecordingView.ts +3 -3
- package/front_end/panels/recorder/components/StepView.ts +2 -1
- package/front_end/panels/settings/keybindsSettingsTab.css +4 -0
- package/front_end/panels/sources/CallStackSidebarPane.ts +7 -3
- package/front_end/panels/sources/DebuggerPausedMessage.ts +125 -90
- package/front_end/panels/sources/SourcesPanel.ts +10 -7
- package/front_end/panels/sources/debuggerPausedMessage.css +8 -0
- package/front_end/panels/timeline/components/sidebarInsightsTab.css +2 -0
- package/front_end/third_party/acorn/estree-legacy.d.ts +2 -0
- 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/cjs/puppeteer/api/Browser.d.ts +12 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts +14 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Browser.d.ts +3 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Browser.js +6 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/HTTPRequest.d.ts +0 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/HTTPRequest.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/HTTPRequest.js +0 -20
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/HTTPRequest.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.d.ts +3 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.js +10 -14
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.d.ts +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.js +14 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.d.ts +3 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.js +12 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/EmulationManager.d.ts +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/EmulationManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/EmulationManager.js +22 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/EmulationManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.d.ts +3 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js +9 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +3 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +3 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +26 -0
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +72 -15
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.d.ts +12 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts +14 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Browser.d.ts +3 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Browser.js +6 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/HTTPRequest.d.ts +0 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/HTTPRequest.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/HTTPRequest.js +0 -20
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/HTTPRequest.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.d.ts +3 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.js +11 -15
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.d.ts +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.js +14 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.d.ts +3 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.js +12 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/EmulationManager.d.ts +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/EmulationManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/EmulationManager.js +22 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/EmulationManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.d.ts +3 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js +9 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +3 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +3 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/types.d.ts +26 -0
- package/front_end/third_party/puppeteer/package/package.json +1 -1
- package/front_end/third_party/puppeteer/package/src/api/Browser.ts +18 -0
- package/front_end/third_party/puppeteer/package/src/api/Page.ts +16 -2
- package/front_end/third_party/puppeteer/package/src/bidi/Browser.ts +13 -0
- package/front_end/third_party/puppeteer/package/src/bidi/HTTPRequest.ts +0 -33
- package/front_end/third_party/puppeteer/package/src/bidi/Page.ts +14 -28
- package/front_end/third_party/puppeteer/package/src/bidi/core/BrowsingContext.ts +19 -0
- package/front_end/third_party/puppeteer/package/src/cdp/Browser.ts +19 -0
- package/front_end/third_party/puppeteer/package/src/cdp/EmulationManager.ts +30 -0
- package/front_end/third_party/puppeteer/package/src/cdp/Page.ts +15 -6
- 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/components/icon_button/iconButton.css +3 -1
- package/front_end/ui/components/report_view/ReportView.ts +11 -2
- package/front_end/ui/components/report_view/report.css +16 -0
- package/front_end/ui/components/text_editor/AiCodeGenerationProvider.ts +135 -7
- package/front_end/ui/components/text_editor/config.ts +6 -6
- package/front_end/ui/legacy/ContextMenu.ts +11 -2
- package/front_end/ui/legacy/TextPrompt.ts +1 -1
- package/front_end/ui/legacy/Toolbar.ts +4 -0
- package/front_end/ui/legacy/UIUtils.ts +0 -2
- package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +18 -3
- package/front_end/ui/legacy/components/data_grid/DataGrid.ts +3 -3
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +6 -0
- package/package.json +1 -1
|
@@ -44,6 +44,7 @@ import * as Badges from '../../models/badges/badges.js';
|
|
|
44
44
|
import type * as Elements from '../../models/elements/elements.js';
|
|
45
45
|
import type * as IssuesManager from '../../models/issues_manager/issues_manager.js';
|
|
46
46
|
import * as TextUtils from '../../models/text_utils/text_utils.js';
|
|
47
|
+
import * as Workspace from '../../models/workspace/workspace.js';
|
|
47
48
|
import * as CodeMirror from '../../third_party/codemirror.next/codemirror.next.js';
|
|
48
49
|
import type {DirectiveResult} from '../../third_party/lit/lib/directive.js';
|
|
49
50
|
import * as Adorners from '../../ui/components/adorners/adorners.js';
|
|
@@ -275,6 +276,10 @@ const UIStrings = {
|
|
|
275
276
|
*/
|
|
276
277
|
startAChat: 'Start a chat',
|
|
277
278
|
/**
|
|
279
|
+
* @description Label of an adorner next to the html node in the Elements panel.
|
|
280
|
+
*/
|
|
281
|
+
viewSourceCode: 'View source code',
|
|
282
|
+
/**
|
|
278
283
|
* @description Context menu item in Elements panel to assess visibility of an element via AI.
|
|
279
284
|
*/
|
|
280
285
|
assessVisibility: 'Assess visibility',
|
|
@@ -386,6 +391,7 @@ export interface ViewInput {
|
|
|
386
391
|
showTopLayerAdorner: boolean;
|
|
387
392
|
isSubgrid: boolean;
|
|
388
393
|
|
|
394
|
+
showViewSourceAdorner: boolean;
|
|
389
395
|
adorners?: Set<Adorners.Adorner.Adorner>;
|
|
390
396
|
nodeInfo?: DocumentFragment;
|
|
391
397
|
topLayerIndex: number;
|
|
@@ -399,6 +405,7 @@ export interface ViewInput {
|
|
|
399
405
|
onMediaAdornerClick: (e: Event) => void;
|
|
400
406
|
onPopoverAdornerClick: (e: Event) => void;
|
|
401
407
|
onTopLayerAdornerClick: (e: Event) => void;
|
|
408
|
+
onViewSourceAdornerClick: () => void;
|
|
402
409
|
}
|
|
403
410
|
|
|
404
411
|
export interface ViewOutput {
|
|
@@ -429,6 +436,8 @@ function adornerRef(input: ViewInput): DirectiveResult<typeof Lit.Directives.Ref
|
|
|
429
436
|
export const DEFAULT_VIEW = (input: ViewInput, output: ViewOutput, target: HTMLElement): void => {
|
|
430
437
|
const adAdornerConfig =
|
|
431
438
|
ElementsComponents.AdornerManager.getRegisteredAdorner(ElementsComponents.AdornerManager.RegisteredAdorners.AD);
|
|
439
|
+
const viewSourceAdornerConfig = ElementsComponents.AdornerManager.getRegisteredAdorner(
|
|
440
|
+
ElementsComponents.AdornerManager.RegisteredAdorners.VIEW_SOURCE);
|
|
432
441
|
const containerAdornerConfig = ElementsComponents.AdornerManager.getRegisteredAdorner(
|
|
433
442
|
ElementsComponents.AdornerManager.RegisteredAdorners.CONTAINER);
|
|
434
443
|
const flexAdornerConfig =
|
|
@@ -447,7 +456,7 @@ export const DEFAULT_VIEW = (input: ViewInput, output: ViewOutput, target: HTMLE
|
|
|
447
456
|
ElementsComponents.AdornerManager.RegisteredAdorners.TOP_LAYER);
|
|
448
457
|
const hasAdorners = input.adorners?.size || input.showAdAdorner || input.showContainerAdorner ||
|
|
449
458
|
input.showFlexAdorner || input.showGridAdorner || input.showGridLanesAdorner || input.showMediaAdorner ||
|
|
450
|
-
input.showPopoverAdorner || input.showTopLayerAdorner;
|
|
459
|
+
input.showPopoverAdorner || input.showTopLayerAdorner || input.showViewSourceAdorner;
|
|
451
460
|
// clang-format off
|
|
452
461
|
render(html`
|
|
453
462
|
<div ${ref(el => { output.contentElement = el as HTMLElement; })}>
|
|
@@ -463,6 +472,13 @@ export const DEFAULT_VIEW = (input: ViewInput, output: ViewOutput, target: HTMLE
|
|
|
463
472
|
${adornerRef(input)}>
|
|
464
473
|
<span>${adAdornerConfig.name}</span>
|
|
465
474
|
</devtools-adorner>` : nothing}
|
|
475
|
+
${input.showViewSourceAdorner ? html`<devtools-adorner
|
|
476
|
+
.data=${{name: viewSourceAdornerConfig.name, jslogContext: viewSourceAdornerConfig.name}}
|
|
477
|
+
aria-label=${i18nString(UIStrings.viewSourceCode)}
|
|
478
|
+
@click=${input.onViewSourceAdornerClick}
|
|
479
|
+
${adornerRef(input)}>
|
|
480
|
+
<span>${viewSourceAdornerConfig.name}</span>
|
|
481
|
+
</devtools-adorner>` : nothing}
|
|
466
482
|
${input.showContainerAdorner ? html`<devtools-adorner
|
|
467
483
|
class=clickable
|
|
468
484
|
role=button
|
|
@@ -800,8 +816,10 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
800
816
|
gridAdornerActive: this.#gridAdornerActive,
|
|
801
817
|
popoverAdornerActive: this.#popoverAdornerActive,
|
|
802
818
|
isSubgrid: Boolean(this.#layout?.isSubgrid),
|
|
819
|
+
showViewSourceAdorner: this.nodeInternal.isRootNode() && isOpeningTag(this.tagTypeContext),
|
|
803
820
|
nodeInfo: this.#nodeInfo,
|
|
804
821
|
topLayerIndex: this.node().topLayerIndex(),
|
|
822
|
+
onViewSourceAdornerClick: this.revealHTMLInSources.bind(this),
|
|
805
823
|
onGutterClick: this.showContextMenu.bind(this),
|
|
806
824
|
onAdornerAdded: adorner => {
|
|
807
825
|
ElementsPanel.instance().registerAdorner(adorner);
|
|
@@ -1291,6 +1309,17 @@ export class ElementsTreeElement extends UI.TreeOutline.TreeElement {
|
|
|
1291
1309
|
this.treeOutline && void this.treeOutline.showContextMenu(this, event);
|
|
1292
1310
|
}
|
|
1293
1311
|
|
|
1312
|
+
private revealHTMLInSources(): void {
|
|
1313
|
+
const frameOwnerId = this.nodeInternal.frameOwnerFrameId();
|
|
1314
|
+
if (frameOwnerId) {
|
|
1315
|
+
const frame = SDK.FrameManager.FrameManager.instance().getFrame(frameOwnerId);
|
|
1316
|
+
if (frame) {
|
|
1317
|
+
const sourceCode = Workspace.Workspace.WorkspaceImpl.instance().uiSourceCodeForURL(frame.url);
|
|
1318
|
+
void Common.Revealer.reveal(sourceCode);
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1294
1323
|
async populateTagContextMenu(contextMenu: UI.ContextMenu.ContextMenu, event: Event): Promise<void> {
|
|
1295
1324
|
// Add attribute-related actions.
|
|
1296
1325
|
const treeElement =
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
*/
|
|
34
34
|
|
|
35
35
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
36
|
-
import
|
|
36
|
+
import * as UI from '../../ui/legacy/legacy.js';
|
|
37
37
|
|
|
38
38
|
import {ElementsTreeOutline} from './ElementsTreeOutline.js';
|
|
39
39
|
|
|
@@ -75,6 +75,12 @@ export class Renderer implements UI.UIUtils.Renderer {
|
|
|
75
75
|
if (options?.expand) {
|
|
76
76
|
treeOutline.firstChild()?.expand();
|
|
77
77
|
}
|
|
78
|
+
const dispatchDimensionChange = (): void => {
|
|
79
|
+
treeOutline.element.dispatchEvent(new CustomEvent('dimensionschanged'));
|
|
80
|
+
};
|
|
81
|
+
treeOutline.addEventListener(UI.TreeOutline.Events.ElementAttached, dispatchDimensionChange);
|
|
82
|
+
treeOutline.addEventListener(UI.TreeOutline.Events.ElementExpanded, dispatchDimensionChange);
|
|
83
|
+
treeOutline.addEventListener(UI.TreeOutline.Events.ElementCollapsed, dispatchDimensionChange);
|
|
78
84
|
return {
|
|
79
85
|
element: treeOutline.element,
|
|
80
86
|
forceSelect: treeOutline.forceSelect.bind(treeOutline),
|
|
@@ -33,6 +33,7 @@ export enum RegisteredAdorners {
|
|
|
33
33
|
SCROLL = 'scroll',
|
|
34
34
|
SCROLL_SNAP = 'scroll-snap',
|
|
35
35
|
SLOT = 'slot',
|
|
36
|
+
VIEW_SOURCE = 'view-source',
|
|
36
37
|
STARTING_STYLE = 'starting-style',
|
|
37
38
|
SUBGRID = 'subgrid',
|
|
38
39
|
TOP_LAYER = 'top-layer',
|
|
@@ -129,6 +130,13 @@ export function getRegisteredAdorner(which: RegisteredAdorners): RegisteredAdorn
|
|
|
129
130
|
enabledByDefault: true,
|
|
130
131
|
};
|
|
131
132
|
}
|
|
133
|
+
case RegisteredAdorners.VIEW_SOURCE: {
|
|
134
|
+
return {
|
|
135
|
+
name: 'view-source',
|
|
136
|
+
category: AdornerCategories.DEFAULT,
|
|
137
|
+
enabledByDefault: true,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
132
140
|
}
|
|
133
141
|
}
|
|
134
142
|
|
|
@@ -351,7 +351,9 @@ export class DeviceModeToolbar {
|
|
|
351
351
|
MobileThrottling.ThrottlingManager.throttlingManager().createMobileThrottlingButton();
|
|
352
352
|
this.throttlingConditionsItem.turnShrinkable();
|
|
353
353
|
toolbar.appendToolbarItem(this.throttlingConditionsItem);
|
|
354
|
-
|
|
354
|
+
const saveDataItem = MobileThrottling.ThrottlingManager.throttlingManager().createSaveDataOverrideSelector();
|
|
355
|
+
saveDataItem.turnShrinkable();
|
|
356
|
+
toolbar.appendToolbarItem(saveDataItem);
|
|
355
357
|
}
|
|
356
358
|
|
|
357
359
|
private appendDevicePositionItems(toolbar: UI.Toolbar.Toolbar): void {
|
|
@@ -254,7 +254,6 @@ export abstract class AffectedResourcesView extends UI.TreeOutline.TreeElement {
|
|
|
254
254
|
sourceCodeLocation.classList.add('affected-source-location');
|
|
255
255
|
if (sourceLocation) {
|
|
256
256
|
const maxLengthForDisplayedURLs = 40; // Same as console messages.
|
|
257
|
-
// TODO(crbug.com/1108503): Add some mechanism to be able to add telemetry to this element.
|
|
258
257
|
const linkifier = new Components.Linkifier.Linkifier(maxLengthForDisplayedURLs);
|
|
259
258
|
const sourceAnchor = linkifier.linkifyScriptLocation(
|
|
260
259
|
target || null, sourceLocation.scriptId || null, sourceLocation.url as Platform.DevToolsPath.UrlString,
|
|
@@ -104,6 +104,7 @@ export class LighthousePanel extends UI.Panel.Panel {
|
|
|
104
104
|
|
|
105
105
|
this.renderToolbar();
|
|
106
106
|
this.auditResultsElement = this.contentElement.createChild('div', 'lighthouse-results-container');
|
|
107
|
+
this.auditResultsElement.addEventListener('keydown', this.onKeyDown.bind(this));
|
|
107
108
|
this.renderStartView();
|
|
108
109
|
|
|
109
110
|
this.controller.recomputePageAuditability();
|
|
@@ -365,4 +366,13 @@ export class LighthousePanel extends UI.Panel.Panel {
|
|
|
365
366
|
}
|
|
366
367
|
return els;
|
|
367
368
|
}
|
|
369
|
+
|
|
370
|
+
private onKeyDown(event: KeyboardEvent): void {
|
|
371
|
+
// The LHR's tool button is a toggle. When the user hits escape, the default behavior
|
|
372
|
+
// is to close the tool drawer. We want to prevent this behavior and instead let the
|
|
373
|
+
// LHR's tool button handle the event and close the tool's dropdown.
|
|
374
|
+
if (event.key === 'Escape' && this.auditResultsElement.querySelector('.lh-tools__button.lh-active')) {
|
|
375
|
+
event.handled = true;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
368
378
|
}
|
|
@@ -19,9 +19,6 @@ button.view-trace {
|
|
|
19
19
|
margin: 10px;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
.lighthouse-results-container {
|
|
23
|
-
position: relative;
|
|
24
|
-
}
|
|
25
22
|
/** `window.opener` is null for windows opened from DevTools. This breaks
|
|
26
23
|
the LH viewer app, so disable this feature. */
|
|
27
24
|
|
|
@@ -63,3 +60,49 @@ select.lighthouse-report {
|
|
|
63
60
|
.lh-devtools .lh-element-screenshot__overlay {
|
|
64
61
|
position: absolute;
|
|
65
62
|
}
|
|
63
|
+
|
|
64
|
+
.lighthouse-results-container {
|
|
65
|
+
position: relative;
|
|
66
|
+
|
|
67
|
+
:focus-visible {
|
|
68
|
+
outline: -webkit-focus-ring-color auto 1px;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.lh-tools__button {
|
|
72
|
+
height: var(--sys-size-9);
|
|
73
|
+
width: var(--sys-size-9);
|
|
74
|
+
min-width: var(--sys-size-9);
|
|
75
|
+
|
|
76
|
+
&:focus-visible {
|
|
77
|
+
border-radius: var(--sys-shape-corner-full);
|
|
78
|
+
outline: var(--sys-size-2) solid var(--sys-color-state-focus-ring);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&.lh-active + .lh-tools__dropdown {
|
|
82
|
+
clip: rect(-8px, 204px, 270px, -10px); /* stylelint-disable-line property-no-deprecated */
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.lh-tools__dropdown {
|
|
87
|
+
padding: var(--sys-size-5) 0;
|
|
88
|
+
border-radius: var(--sys-shape-corner-small);
|
|
89
|
+
box-shadow: var(--sys-elevation-level3);
|
|
90
|
+
top: 24px;
|
|
91
|
+
|
|
92
|
+
&:hover a:focus {
|
|
93
|
+
background-color: transparent;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
a {
|
|
97
|
+
height: var(--sys-size-11);
|
|
98
|
+
padding: 0 var(--sys-size-8);
|
|
99
|
+
white-space: nowrap;
|
|
100
|
+
align-items: center;
|
|
101
|
+
|
|
102
|
+
&::before {
|
|
103
|
+
content: none;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
}
|
|
@@ -31,11 +31,11 @@ const UIStrings = {
|
|
|
31
31
|
/**
|
|
32
32
|
* @description A context menu item in the Network Log View Columns of the Network panel
|
|
33
33
|
*/
|
|
34
|
-
responseHeaders: 'Response
|
|
34
|
+
responseHeaders: 'Response headers',
|
|
35
35
|
/**
|
|
36
36
|
* @description A context menu item in the Network Log View Columns of the Network panel
|
|
37
37
|
*/
|
|
38
|
-
requestHeaders: 'Request
|
|
38
|
+
requestHeaders: 'Request headers',
|
|
39
39
|
/**
|
|
40
40
|
* @description Text in Network Log View Columns of the Network panel
|
|
41
41
|
*/
|
|
@@ -43,19 +43,19 @@ const UIStrings = {
|
|
|
43
43
|
/**
|
|
44
44
|
* @description Text for the start time of an activity
|
|
45
45
|
*/
|
|
46
|
-
startTime: 'Start
|
|
46
|
+
startTime: 'Start time',
|
|
47
47
|
/**
|
|
48
48
|
* @description Text in Network Log View Columns of the Network panel
|
|
49
49
|
*/
|
|
50
|
-
responseTime: 'Response
|
|
50
|
+
responseTime: 'Response time',
|
|
51
51
|
/**
|
|
52
52
|
* @description Text in Network Log View Columns of the Network panel
|
|
53
53
|
*/
|
|
54
|
-
endTime: 'End
|
|
54
|
+
endTime: 'End time',
|
|
55
55
|
/**
|
|
56
56
|
* @description Text in Network Log View Columns of the Network panel
|
|
57
57
|
*/
|
|
58
|
-
totalDuration: 'Total
|
|
58
|
+
totalDuration: 'Total duration',
|
|
59
59
|
/**
|
|
60
60
|
* @description Text for the latency of a task
|
|
61
61
|
*/
|
|
@@ -99,7 +99,7 @@ const UIStrings = {
|
|
|
99
99
|
/**
|
|
100
100
|
* @description Text in Network Log View Columns of the Network panel
|
|
101
101
|
*/
|
|
102
|
-
remoteAddress: 'Remote
|
|
102
|
+
remoteAddress: 'Remote address',
|
|
103
103
|
/**
|
|
104
104
|
* @description Text that refers to some types
|
|
105
105
|
*/
|
|
@@ -115,7 +115,7 @@ const UIStrings = {
|
|
|
115
115
|
/**
|
|
116
116
|
* @description Column header in the Network log view of the Network panel
|
|
117
117
|
*/
|
|
118
|
-
initiatorAddressSpace: 'Initiator
|
|
118
|
+
initiatorAddressSpace: 'Initiator address space',
|
|
119
119
|
/**
|
|
120
120
|
* @description Text for web cookies
|
|
121
121
|
*/
|
|
@@ -147,7 +147,7 @@ const UIStrings = {
|
|
|
147
147
|
/**
|
|
148
148
|
* @description Text in Network Log View Columns of the Network panel
|
|
149
149
|
*/
|
|
150
|
-
remoteAddressSpace: 'Remote
|
|
150
|
+
remoteAddressSpace: 'Remote address space',
|
|
151
151
|
/**
|
|
152
152
|
* @description Text to show whether a request is ad-related
|
|
153
153
|
*/
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
// Copyright 2011 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
|
import * as Common from '../../core/common/common.js';
|
|
7
6
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
8
7
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
9
8
|
import * as Protocol from '../../generated/protocol.js';
|
|
10
9
|
import * as uiI18n from '../../ui/i18n/i18n.js';
|
|
11
|
-
import {Icon} from '../../ui/kit/kit.js';
|
|
12
10
|
import * as CookieTable from '../../ui/legacy/components/cookie_table/cookie_table.js';
|
|
13
|
-
import * as SettingsUI from '../../ui/legacy/components/settings_ui/settings_ui.js';
|
|
14
11
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
12
|
+
import * as Lit from '../../ui/lit/lit.js';
|
|
15
13
|
import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
|
|
16
14
|
|
|
17
15
|
import requestCookiesViewStyles from './requestCookiesView.css.js';
|
|
16
|
+
const {render, html} = Lit;
|
|
18
17
|
|
|
19
18
|
const UIStrings = {
|
|
20
19
|
/**
|
|
@@ -74,74 +73,108 @@ const UIStrings = {
|
|
|
74
73
|
const str_ = i18n.i18n.registerUIStrings('panels/network/RequestCookiesView.ts', UIStrings);
|
|
75
74
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
76
75
|
|
|
76
|
+
interface ViewInput {
|
|
77
|
+
requestCookies: CookieTable.CookiesTable.CookiesTableData;
|
|
78
|
+
responseCookies: CookieTable.CookiesTable.CookiesTableData;
|
|
79
|
+
malformedResponseCookies: SDK.NetworkRequest.BlockedSetCookieWithReason[];
|
|
80
|
+
showFilteredOutCookies: boolean;
|
|
81
|
+
hasBlockedCookies: boolean;
|
|
82
|
+
gotCookies: boolean;
|
|
83
|
+
onShowFilteredOutCookiesChange: (checked: boolean) => void;
|
|
84
|
+
siteHasCookieInOtherPartition: boolean;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
type ViewFunction = (input: ViewInput, output: undefined, target: HTMLElement) => void;
|
|
88
|
+
|
|
89
|
+
export const DEFAULT_VIEW: ViewFunction = (input, _output, target) => {
|
|
90
|
+
// clang-format off
|
|
91
|
+
render(
|
|
92
|
+
html`
|
|
93
|
+
<style>${requestCookiesViewStyles}</style>
|
|
94
|
+
<style>${UI.inspectorCommonStyles}</style>
|
|
95
|
+
<div class="request-cookies-view">
|
|
96
|
+
${input.gotCookies ? Lit.nothing : html`
|
|
97
|
+
<devtools-widget .widgetConfig=${UI.Widget.widgetConfig(UI.EmptyWidget.EmptyWidget, {
|
|
98
|
+
header: i18nString(UIStrings.thisRequestHasNoCookies)})}></devtools-widget>
|
|
99
|
+
`}
|
|
100
|
+
|
|
101
|
+
<div class=${input.requestCookies.cookies.length || input.hasBlockedCookies ? '' : 'hidden'}>
|
|
102
|
+
<span class="request-cookies-title" title=${i18nString(UIStrings.cookiesThatWereSentToTheServerIn)}>
|
|
103
|
+
${i18nString(UIStrings.requestCookies)}
|
|
104
|
+
</span>
|
|
105
|
+
<devtools-checkbox
|
|
106
|
+
@change=${(e: Event) => input.onShowFilteredOutCookiesChange((e.target as HTMLInputElement).checked)}
|
|
107
|
+
.checked=${input.showFilteredOutCookies}>
|
|
108
|
+
${i18nString(UIStrings.showFilteredOutRequestCookies)}
|
|
109
|
+
</devtools-checkbox>
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
<div class="cookies-panel-item ${!input.requestCookies.cookies.length && input.hasBlockedCookies ? '' : 'hidden'}">
|
|
113
|
+
${i18nString(UIStrings.noRequestCookiesWereSent)}
|
|
114
|
+
</div>
|
|
115
|
+
|
|
116
|
+
${input.requestCookies.cookies.length > 0 ? html`
|
|
117
|
+
<devtools-widget .widgetConfig=${UI.Widget.widgetConfig(CookieTable.CookiesTable.CookiesTable, {
|
|
118
|
+
cookiesData: input.requestCookies,
|
|
119
|
+
inline: true
|
|
120
|
+
})} class="cookie-table cookies-panel-item"></devtools-widget>
|
|
121
|
+
` : Lit.nothing}
|
|
122
|
+
|
|
123
|
+
<div class="cookies-panel-item site-has-cookies-in-other-partition ${input.siteHasCookieInOtherPartition ? '' : 'hidden'}">
|
|
124
|
+
${uiI18n.getFormatLocalizedString(str_, UIStrings.siteHasCookieInOtherPartition, {
|
|
125
|
+
PH1: UI.XLink.XLink.create(
|
|
126
|
+
'https://developer.chrome.com/en/docs/privacy-sandbox/chips/', i18nString(UIStrings.learnMore), undefined,
|
|
127
|
+
undefined, 'learn-more'),})}
|
|
128
|
+
</div>
|
|
129
|
+
|
|
130
|
+
<div class="request-cookies-title ${input.responseCookies.cookies.length ? '' : 'hidden'}"
|
|
131
|
+
title=${i18nString(UIStrings.cookiesThatWereReceivedFromThe)}>
|
|
132
|
+
${i18nString(UIStrings.responseCookies)}
|
|
133
|
+
</div>
|
|
134
|
+
|
|
135
|
+
${input.responseCookies.cookies.length ? html`
|
|
136
|
+
<devtools-widget .widgetConfig=${UI.Widget.widgetConfig(CookieTable.CookiesTable.CookiesTable, {
|
|
137
|
+
cookiesData: input.responseCookies,
|
|
138
|
+
inline: true })} class="cookie-table cookies-panel-item"></devtools-widget>
|
|
139
|
+
` : Lit.nothing}
|
|
140
|
+
|
|
141
|
+
<div class="request-cookies-title ${input.malformedResponseCookies.length ? '' : 'hidden'}" title=${i18nString(UIStrings.cookiesThatWereReceivedFromTheServer)}>
|
|
142
|
+
${i18nString(UIStrings.malformedResponseCookies)}
|
|
143
|
+
</div>
|
|
144
|
+
|
|
145
|
+
<div class=${input.malformedResponseCookies.length ? '' : 'hidden'}>
|
|
146
|
+
${input.malformedResponseCookies.map(malformedCookie => html`
|
|
147
|
+
<span class="cookie-line source-code" title=${getMalformedCookieTooltip(malformedCookie)}>
|
|
148
|
+
<devtools-icon class="cookie-warning-icon small" .name=${'cross-circle-filled'}></devtools-icon>
|
|
149
|
+
${malformedCookie.cookieLine}
|
|
150
|
+
</span>
|
|
151
|
+
`)}
|
|
152
|
+
</div>
|
|
153
|
+
</div>
|
|
154
|
+
`,
|
|
155
|
+
target);
|
|
156
|
+
// clang-format on
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
function getMalformedCookieTooltip(malformedCookie: SDK.NetworkRequest.BlockedSetCookieWithReason): string {
|
|
160
|
+
if (malformedCookie.blockedReasons.includes(Protocol.Network.SetCookieBlockedReason.NameValuePairExceedsMaxSize)) {
|
|
161
|
+
return SDK.NetworkRequest.setCookieBlockedReasonToUiString(
|
|
162
|
+
Protocol.Network.SetCookieBlockedReason.NameValuePairExceedsMaxSize);
|
|
163
|
+
}
|
|
164
|
+
return SDK.NetworkRequest.setCookieBlockedReasonToUiString(Protocol.Network.SetCookieBlockedReason.SyntaxError);
|
|
165
|
+
}
|
|
166
|
+
|
|
77
167
|
export class RequestCookiesView extends UI.Widget.Widget {
|
|
78
168
|
private request: SDK.NetworkRequest.NetworkRequest;
|
|
79
169
|
private readonly showFilteredOutCookiesSetting: Common.Settings.Setting<boolean>;
|
|
80
|
-
private readonly
|
|
81
|
-
private readonly requestCookiesTitle: HTMLElement;
|
|
82
|
-
private readonly requestCookiesEmpty: HTMLElement;
|
|
83
|
-
private readonly requestCookiesTable: CookieTable.CookiesTable.CookiesTable;
|
|
84
|
-
private readonly responseCookiesTitle: HTMLElement;
|
|
85
|
-
private readonly responseCookiesTable: CookieTable.CookiesTable.CookiesTable;
|
|
86
|
-
private readonly siteHasCookieInOtherPartition: HTMLElement;
|
|
87
|
-
private readonly malformedResponseCookiesTitle: HTMLElement;
|
|
88
|
-
private readonly malformedResponseCookiesList: HTMLElement;
|
|
170
|
+
private readonly view: ViewFunction;
|
|
89
171
|
|
|
90
|
-
constructor(request: SDK.NetworkRequest.NetworkRequest) {
|
|
172
|
+
constructor(request: SDK.NetworkRequest.NetworkRequest, view: ViewFunction = DEFAULT_VIEW) {
|
|
91
173
|
super({jslog: `${VisualLogging.pane('cookies').track({resize: true})}`});
|
|
92
|
-
this.registerRequiredCSS(requestCookiesViewStyles);
|
|
93
|
-
|
|
94
|
-
this.element.classList.add('request-cookies-view');
|
|
95
|
-
|
|
96
174
|
this.request = request;
|
|
97
175
|
this.showFilteredOutCookiesSetting = Common.Settings.Settings.instance().createSetting(
|
|
98
176
|
'show-filtered-out-request-cookies', /* defaultValue */ false);
|
|
99
|
-
|
|
100
|
-
this.emptyWidget = new UI.EmptyWidget.EmptyWidget(i18nString(UIStrings.thisRequestHasNoCookies), '');
|
|
101
|
-
this.emptyWidget.show(this.element);
|
|
102
|
-
|
|
103
|
-
this.requestCookiesTitle = this.element.createChild('div');
|
|
104
|
-
const titleText = this.requestCookiesTitle.createChild('span', 'request-cookies-title');
|
|
105
|
-
titleText.textContent = i18nString(UIStrings.requestCookies);
|
|
106
|
-
UI.Tooltip.Tooltip.install(titleText, i18nString(UIStrings.cookiesThatWereSentToTheServerIn));
|
|
107
|
-
|
|
108
|
-
const requestCookiesCheckbox = SettingsUI.SettingsUI.createSettingCheckbox(
|
|
109
|
-
i18nString(UIStrings.showFilteredOutRequestCookies), this.showFilteredOutCookiesSetting);
|
|
110
|
-
requestCookiesCheckbox.addEventListener('change', () => {
|
|
111
|
-
this.refreshRequestCookiesView();
|
|
112
|
-
});
|
|
113
|
-
this.requestCookiesTitle.appendChild(requestCookiesCheckbox);
|
|
114
|
-
|
|
115
|
-
this.requestCookiesEmpty = this.element.createChild('div', 'cookies-panel-item');
|
|
116
|
-
this.requestCookiesEmpty.textContent = i18nString(UIStrings.noRequestCookiesWereSent);
|
|
117
|
-
|
|
118
|
-
this.requestCookiesTable = new CookieTable.CookiesTable.CookiesTable(/* renderInline */ true);
|
|
119
|
-
this.requestCookiesTable.contentElement.classList.add('cookie-table', 'cookies-panel-item');
|
|
120
|
-
this.requestCookiesTable.show(this.element);
|
|
121
|
-
|
|
122
|
-
this.siteHasCookieInOtherPartition =
|
|
123
|
-
this.element.createChild('div', 'cookies-panel-item site-has-cookies-in-other-partition');
|
|
124
|
-
this.siteHasCookieInOtherPartition.appendChild(
|
|
125
|
-
uiI18n.getFormatLocalizedString(str_, UIStrings.siteHasCookieInOtherPartition, {
|
|
126
|
-
PH1: UI.XLink.XLink.create(
|
|
127
|
-
'https://developer.chrome.com/en/docs/privacy-sandbox/chips/', i18nString(UIStrings.learnMore), undefined,
|
|
128
|
-
undefined, 'learn-more'),
|
|
129
|
-
}));
|
|
130
|
-
|
|
131
|
-
this.responseCookiesTitle = this.element.createChild('div', 'request-cookies-title');
|
|
132
|
-
this.responseCookiesTitle.textContent = i18nString(UIStrings.responseCookies);
|
|
133
|
-
this.responseCookiesTitle.title = i18nString(UIStrings.cookiesThatWereReceivedFromThe);
|
|
134
|
-
|
|
135
|
-
this.responseCookiesTable = new CookieTable.CookiesTable.CookiesTable(/* renderInline */ true);
|
|
136
|
-
this.responseCookiesTable.contentElement.classList.add('cookie-table', 'cookies-panel-item');
|
|
137
|
-
this.responseCookiesTable.show(this.element);
|
|
138
|
-
|
|
139
|
-
this.malformedResponseCookiesTitle = this.element.createChild('div', 'request-cookies-title');
|
|
140
|
-
this.malformedResponseCookiesTitle.textContent = i18nString(UIStrings.malformedResponseCookies);
|
|
141
|
-
UI.Tooltip.Tooltip.install(
|
|
142
|
-
this.malformedResponseCookiesTitle, i18nString(UIStrings.cookiesThatWereReceivedFromTheServer));
|
|
143
|
-
|
|
144
|
-
this.malformedResponseCookiesList = this.element.createChild('div');
|
|
177
|
+
this.view = view;
|
|
145
178
|
}
|
|
146
179
|
|
|
147
180
|
private getRequestCookies(): {
|
|
@@ -230,99 +263,50 @@ export class RequestCookiesView extends UI.Widget.Widget {
|
|
|
230
263
|
return {responseCookies, responseCookieToBlockedReasons, responseCookieToExemptionReason, malformedResponseCookies};
|
|
231
264
|
}
|
|
232
265
|
|
|
233
|
-
|
|
266
|
+
override performUpdate(): void {
|
|
234
267
|
if (!this.isShowing()) {
|
|
235
268
|
return;
|
|
236
269
|
}
|
|
237
|
-
|
|
238
|
-
const gotCookies = this.request.hasRequestCookies() || this.request.responseCookies.length;
|
|
239
|
-
if (gotCookies) {
|
|
240
|
-
this.emptyWidget.hideWidget();
|
|
241
|
-
} else {
|
|
242
|
-
this.emptyWidget.showWidget();
|
|
243
|
-
}
|
|
244
|
-
|
|
245
270
|
const {requestCookies, requestCookieToBlockedReasons, requestCookieToExemptionReason} = this.getRequestCookies();
|
|
246
271
|
const {responseCookies, responseCookieToBlockedReasons, responseCookieToExemptionReason, malformedResponseCookies} =
|
|
247
272
|
this.getResponseCookies();
|
|
248
273
|
|
|
249
|
-
|
|
250
|
-
this.
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
this.
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
this.
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
} else {
|
|
273
|
-
this.responseCookiesTitle.classList.add('hidden');
|
|
274
|
-
this.responseCookiesTable.hideWidget();
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
if (malformedResponseCookies.length) {
|
|
278
|
-
this.malformedResponseCookiesTitle.classList.remove('hidden');
|
|
279
|
-
this.malformedResponseCookiesList.classList.remove('hidden');
|
|
280
|
-
|
|
281
|
-
this.malformedResponseCookiesList.removeChildren();
|
|
282
|
-
for (const malformedCookie of malformedResponseCookies) {
|
|
283
|
-
const listItem = this.malformedResponseCookiesList.createChild('span', 'cookie-line source-code');
|
|
284
|
-
const icon = new Icon();
|
|
285
|
-
icon.name = 'cross-circle-filled';
|
|
286
|
-
icon.classList.add('cookie-warning-icon', 'small');
|
|
287
|
-
listItem.appendChild(icon);
|
|
288
|
-
UI.UIUtils.createTextChild(listItem, malformedCookie.cookieLine);
|
|
289
|
-
|
|
290
|
-
if (malformedCookie.blockedReasons.includes(
|
|
291
|
-
Protocol.Network.SetCookieBlockedReason.NameValuePairExceedsMaxSize)) {
|
|
292
|
-
listItem.title = SDK.NetworkRequest.setCookieBlockedReasonToUiString(
|
|
293
|
-
Protocol.Network.SetCookieBlockedReason.NameValuePairExceedsMaxSize);
|
|
294
|
-
} else {
|
|
295
|
-
listItem.title =
|
|
296
|
-
SDK.NetworkRequest.setCookieBlockedReasonToUiString(Protocol.Network.SetCookieBlockedReason.SyntaxError);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
} else {
|
|
300
|
-
this.malformedResponseCookiesTitle.classList.add('hidden');
|
|
301
|
-
this.malformedResponseCookiesList.classList.add('hidden');
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
if (this.request.siteHasCookieInOtherPartition()) {
|
|
305
|
-
this.siteHasCookieInOtherPartition.classList.remove('hidden');
|
|
306
|
-
} else {
|
|
307
|
-
this.siteHasCookieInOtherPartition.classList.add('hidden');
|
|
308
|
-
}
|
|
274
|
+
const input: ViewInput = {
|
|
275
|
+
gotCookies: this.request.hasRequestCookies() || this.request.responseCookies.length > 0,
|
|
276
|
+
requestCookies: {
|
|
277
|
+
cookies: requestCookies,
|
|
278
|
+
cookieToBlockedReasons: requestCookieToBlockedReasons,
|
|
279
|
+
cookieToExemptionReason: requestCookieToExemptionReason,
|
|
280
|
+
},
|
|
281
|
+
responseCookies: {
|
|
282
|
+
cookies: responseCookies,
|
|
283
|
+
cookieToBlockedReasons: responseCookieToBlockedReasons,
|
|
284
|
+
cookieToExemptionReason: responseCookieToExemptionReason,
|
|
285
|
+
},
|
|
286
|
+
malformedResponseCookies,
|
|
287
|
+
showFilteredOutCookies: this.showFilteredOutCookiesSetting.get(),
|
|
288
|
+
onShowFilteredOutCookiesChange: (checked: boolean) => {
|
|
289
|
+
this.showFilteredOutCookiesSetting.set(checked);
|
|
290
|
+
this.requestUpdate();
|
|
291
|
+
},
|
|
292
|
+
siteHasCookieInOtherPartition: this.request.siteHasCookieInOtherPartition(),
|
|
293
|
+
hasBlockedCookies: this.request.blockedRequestCookies().length > 0,
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
this.view(input, undefined, this.contentElement);
|
|
309
297
|
}
|
|
310
298
|
|
|
311
299
|
override wasShown(): void {
|
|
312
300
|
super.wasShown();
|
|
313
|
-
this.request.addEventListener(
|
|
314
|
-
|
|
315
|
-
this.request.addEventListener(
|
|
316
|
-
SDK.NetworkRequest.Events.RESPONSE_HEADERS_CHANGED, this.refreshRequestCookiesView, this);
|
|
301
|
+
this.request.addEventListener(SDK.NetworkRequest.Events.REQUEST_HEADERS_CHANGED, this.requestUpdate, this);
|
|
302
|
+
this.request.addEventListener(SDK.NetworkRequest.Events.RESPONSE_HEADERS_CHANGED, this.requestUpdate, this);
|
|
317
303
|
|
|
318
|
-
this.
|
|
304
|
+
this.requestUpdate();
|
|
319
305
|
}
|
|
320
306
|
|
|
321
307
|
override willHide(): void {
|
|
322
308
|
super.willHide();
|
|
323
|
-
this.request.removeEventListener(
|
|
324
|
-
|
|
325
|
-
this.request.removeEventListener(
|
|
326
|
-
SDK.NetworkRequest.Events.RESPONSE_HEADERS_CHANGED, this.refreshRequestCookiesView, this);
|
|
309
|
+
this.request.removeEventListener(SDK.NetworkRequest.Events.REQUEST_HEADERS_CHANGED, this.requestUpdate, this);
|
|
310
|
+
this.request.removeEventListener(SDK.NetworkRequest.Events.RESPONSE_HEADERS_CHANGED, this.requestUpdate, this);
|
|
327
311
|
}
|
|
328
312
|
}
|
|
@@ -86,11 +86,11 @@ const UIStrings = {
|
|
|
86
86
|
/**
|
|
87
87
|
* @description A context menu item in the Network Log View Columns of the Network panel
|
|
88
88
|
*/
|
|
89
|
-
responseHeaders: 'Response
|
|
89
|
+
responseHeaders: 'Response headers',
|
|
90
90
|
/**
|
|
91
91
|
* @description A context menu item in the Network Log View Columns of the Network panel
|
|
92
92
|
*/
|
|
93
|
-
earlyHintsHeaders: 'Early
|
|
93
|
+
earlyHintsHeaders: 'Early hints headers',
|
|
94
94
|
/**
|
|
95
95
|
* @description Title text for a link to the Sources panel to the file containing the header override definitions
|
|
96
96
|
*/
|