chrome-devtools-frontend 1.0.1736236 → 1.0.1738725
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/.agents/rules/ui-and-widgets/ui-css-scoping-and-flex-layout.md +1 -1
- package/.agents/skills/version-control/SKILL.md +63 -11
- package/docs/devtools-protocol.md +3 -1
- package/eslint.config.mjs +0 -6
- package/front_end/core/host/AidaClient.ts +14 -36
- package/front_end/core/host/AidaGcaTranslation.ts +8 -5
- package/front_end/core/root/Runtime.ts +0 -5
- package/front_end/design_system_tokens.css +1 -0
- package/front_end/entrypoints/main/GlobalAiButton.ts +2 -9
- package/front_end/entrypoints/main/MainImpl.ts +0 -4
- package/front_end/generated/SupportedCSSProperties.ts +8 -23
- package/front_end/models/ai-utils/AiUtils.ts +1 -5
- package/front_end/models/ai_assistance/agents/AiAgent.ts +2 -18
- package/front_end/models/ai_assistance/contexts/FileContext.ts +1 -2
- package/front_end/models/ai_assistance/tools/ListSources.ts +3 -1
- package/front_end/models/ai_code_generation/AiCodeGeneration.ts +0 -6
- package/front_end/models/javascript_metadata/NativeFunctions.ts +9 -5
- package/front_end/models/trace/EventsSerializer.ts +0 -8
- package/front_end/models/workspace/UISourceCode.ts +30 -8
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +1 -7
- package/front_end/panels/ai_assistance/ai_assistance-meta.ts +15 -34
- package/front_end/panels/ai_assistance/components/ChatView.ts +2 -16
- package/front_end/panels/ai_assistance/components/chatView.css +0 -32
- package/front_end/panels/ai_assistance/components/walkthroughView.css +1 -1
- package/front_end/panels/animation/AnimationTimeline.ts +1 -1
- package/front_end/panels/animation/animationTimeline.css +5 -3
- package/front_end/panels/application/PrivateVerificationTokensView.ts +114 -26
- package/front_end/panels/application/ResourcesPanel.ts +1 -0
- package/front_end/panels/application/backgroundServiceView.css +2 -2
- package/front_end/panels/application/components/permissionsPolicySection.css +0 -4
- package/front_end/panels/application/frameDetailsReportView.css +0 -7
- package/front_end/panels/application/indexedDBViews.css +3 -3
- package/front_end/panels/application/privateVerificationTokensView.css +6 -0
- package/front_end/panels/application/serviceWorkerUpdateCycleView.css +1 -1
- package/front_end/panels/application/serviceWorkersView.css +2 -2
- package/front_end/panels/comments/CommentsPane.ts +1 -1
- package/front_end/panels/comments/commentsPane.css +1 -1
- package/front_end/panels/common/common.ts +0 -1
- package/front_end/panels/console/ConsoleView.ts +11 -1
- package/front_end/panels/console/ConsoleViewMessage.ts +5 -1
- package/front_end/panels/console/consolePinPane.css +1 -1
- package/front_end/panels/console/consoleView.css +5 -4
- package/front_end/panels/elements/DOMTreeWidget.ts +47 -5
- package/front_end/panels/elements/layoutPane.css +0 -1
- package/front_end/panels/emulation/InspectedPagePlaceholder.ts +1 -0
- package/front_end/panels/emulation/deviceModeView.css +0 -1
- package/front_end/panels/issues/issuesTree.css +2 -2
- package/front_end/panels/layer_viewer/LayerDetailsView.ts +34 -17
- package/front_end/panels/layer_viewer/LayerTreeOutline.ts +39 -17
- package/front_end/panels/layer_viewer/Layers3DView.ts +34 -13
- package/front_end/panels/layer_viewer/layerDetailsView.css +1 -1
- package/front_end/panels/layer_viewer/layers3DView.css +0 -4
- package/front_end/panels/media/playerListView.css +0 -18
- package/front_end/panels/media/playerPropertiesView.css +1 -1
- package/front_end/panels/network/NetworkWaterfallColumn.ts +22 -10
- package/front_end/panels/network/RequestPreviewView.ts +182 -63
- package/front_end/panels/network/SignedExchangeInfoView.ts +242 -158
- package/front_end/panels/network/networkConfigView.css +1 -1
- package/front_end/panels/network/networkLogView.css +2 -1
- package/front_end/panels/network/networkPanel.css +0 -5
- package/front_end/panels/network/networkTimingTable.css +1 -1
- package/front_end/panels/network/signedExchangeInfoView.css +12 -8
- package/front_end/panels/performance_monitor/performanceMonitor.css +2 -2
- package/front_end/panels/profiler/IsolateSelector.ts +31 -10
- package/front_end/panels/profiler/profilesPanel.css +0 -8
- package/front_end/panels/protocol_monitor/JSONEditor.css +1 -1
- package/front_end/panels/screencast/screencastView.css +2 -2
- package/front_end/panels/security/SecurityPanel.ts +474 -418
- package/front_end/panels/security/SecurityPanelSidebar.ts +68 -48
- package/front_end/panels/security/lockIcon.css +52 -50
- package/front_end/panels/security/mainView.css +149 -145
- package/front_end/panels/security/originView.css +117 -115
- package/front_end/panels/sensors/LocationsSettingsTab.ts +2 -50
- package/front_end/panels/sensors/locationsSettingsTab.css +1 -21
- package/front_end/panels/settings/AISettingsTab.ts +1 -2
- package/front_end/panels/settings/SettingsScreen.ts +1 -1
- package/front_end/panels/sources/CallStackSidebarPane.ts +31 -6
- package/front_end/panels/sources/NavigatorView.ts +105 -31
- package/front_end/panels/sources/breakpointsView.css +2 -1
- package/front_end/panels/sources/scopeChainSidebarPane.css +1 -1
- package/front_end/panels/timeline/ThirdPartyTreeView.ts +1 -0
- package/front_end/panels/timeline/TimelineLayersView.ts +108 -46
- package/front_end/panels/timeline/TimelinePanel.ts +4 -2
- package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +1 -1
- package/front_end/panels/timeline/components/networkRequestDetails.css +1 -1
- package/front_end/panels/timeline/overlays/components/EntryLabelOverlay.ts +0 -7
- package/front_end/panels/web_audio/webAudio.css +1 -2
- package/front_end/panels/webauthn/WebauthnPane.ts +1 -1
- package/front_end/panels/whats_new/ReleaseNoteText.ts +6 -6
- package/front_end/panels/whats_new/resources/WNDT.md +6 -6
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/ui/comments/CommentAnchorResolver.ts +45 -4
- package/front_end/ui/comments/CommentOverlayManager.ts +45 -12
- package/front_end/ui/components/buttons/FloatingButton.ts +2 -6
- package/front_end/ui/components/buttons/button.css +2 -2
- package/front_end/ui/components/buttons/floatingButton.css +0 -44
- package/front_end/ui/components/icon_button/iconButton.css +1 -1
- package/front_end/ui/components/markdown_view/markdownView.css +1 -1
- package/front_end/ui/legacy/ContextMenu.ts +7 -5
- package/front_end/ui/legacy/InspectorDrawerView.ts +1 -0
- package/front_end/ui/legacy/InspectorView.ts +5 -1
- package/front_end/ui/legacy/PopoverHelper.ts +1 -0
- package/front_end/ui/legacy/RootView.ts +9 -3
- package/front_end/ui/legacy/SplitWidget.ts +1 -0
- package/front_end/ui/legacy/Treeoutline.ts +9 -0
- package/front_end/ui/legacy/UIUtils.ts +1 -1
- package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +130 -137
- package/front_end/ui/legacy/components/inline_editor/CSSShadowEditor.ts +1 -1
- package/front_end/ui/legacy/components/inline_editor/SwatchPopoverHelper.ts +1 -0
- package/front_end/ui/legacy/components/inline_editor/bezierEditor.css +1 -1
- package/front_end/ui/legacy/components/inline_editor/cssAngleEditor.css +3 -1
- package/front_end/ui/legacy/components/inline_editor/cssShadowEditor.css +7 -6
- package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +2 -0
- package/front_end/ui/legacy/components/perf_ui/pieChart.css +2 -2
- package/front_end/ui/legacy/components/quick_open/filteredListWidget.css +1 -10
- package/front_end/ui/legacy/filter.css +1 -1
- package/front_end/ui/legacy/infobar.css +1 -1
- package/front_end/ui/legacy/inspectorCommon.css +2 -2
- package/front_end/ui/legacy/inspectorDrawerTabbedPane.css +3 -3
- package/front_end/ui/legacy/listWidget.css +2 -7
- package/front_end/ui/legacy/softDropDownButton.css +1 -1
- package/front_end/ui/legacy/tabbedPane.css +2 -1
- package/front_end/ui/legacy/treeoutline.css +3 -2
- package/front_end/ui/visual_logging/KnownContextValues.ts +133 -0
- package/front_end/ui/visual_logging/LoggingEvents.ts +1 -1
- package/package.json +1 -1
- package/front_end/Images/geminiInDevTools.png +0 -0
- package/front_end/Images/geminiInDevTools_2x.png +0 -0
- package/front_end/generated/InspectorBackendCommands.ts +0 -1690
- package/front_end/generated/protocol-mapping.d.ts +0 -5986
- package/front_end/generated/protocol-proxy-api.d.ts +0 -5452
- package/front_end/generated/protocol.ts +0 -23364
- package/front_end/panels/common/GeminiRebrandPromoDialog.ts +0 -193
- package/front_end/panels/common/geminiRebrandPromoDialog.css +0 -47
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
// Copyright 2015 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
|
-
|
|
4
|
+
|
|
5
|
+
import '../../ui/kit/kit.js';
|
|
5
6
|
|
|
6
7
|
import * as Common from '../../core/common/common.js';
|
|
7
8
|
import * as Host from '../../core/host/host.js';
|
|
8
9
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
9
|
-
import
|
|
10
|
+
import * as Platform from '../../core/platform/platform.js';
|
|
10
11
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
11
12
|
import * as Protocol from '../../generated/protocol.js';
|
|
12
13
|
import * as NetworkForward from '../../panels/network/forward/forward.js';
|
|
13
14
|
import * as Buttons from '../../ui/components/buttons/buttons.js';
|
|
14
|
-
import {createIcon, type Icon} from '../../ui/kit/kit.js';
|
|
15
15
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
16
16
|
import {Directives, html, type LitTemplate, nothing, render, type TemplateResult} from '../../ui/lit/lit.js';
|
|
17
17
|
import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
|
|
@@ -29,7 +29,8 @@ import {
|
|
|
29
29
|
} from './SecurityModel.js';
|
|
30
30
|
import {SecurityPanelSidebar} from './SecurityPanelSidebar.js';
|
|
31
31
|
|
|
32
|
-
const {widget
|
|
32
|
+
const {widget} = UI.Widget;
|
|
33
|
+
const {ifDefined} = Directives;
|
|
33
34
|
|
|
34
35
|
const UIStrings = {
|
|
35
36
|
/**
|
|
@@ -480,12 +481,13 @@ function getSecurityStateIconNameForDetailedView(securityState: Protocol.Securit
|
|
|
480
481
|
}
|
|
481
482
|
|
|
482
483
|
export function getSecurityStateIconForDetailedView(securityState: Protocol.Security.SecurityState,
|
|
483
|
-
className: string):
|
|
484
|
-
return
|
|
484
|
+
className: string): TemplateResult {
|
|
485
|
+
return html`<devtools-icon name=${getSecurityStateIconNameForDetailedView(securityState)} class=${
|
|
486
|
+
className}></devtools-icon>`;
|
|
485
487
|
}
|
|
486
488
|
|
|
487
|
-
export function getSecurityStateIconForOverview(
|
|
488
|
-
|
|
489
|
+
export function getSecurityStateIconForOverview(securityState: Protocol.Security.SecurityState, className: string,
|
|
490
|
+
title?: string): TemplateResult {
|
|
489
491
|
let iconName: string;
|
|
490
492
|
switch (securityState) {
|
|
491
493
|
case Protocol.Security.SecurityState.Unknown: // fallthrough
|
|
@@ -502,7 +504,7 @@ export function getSecurityStateIconForOverview(
|
|
|
502
504
|
case Protocol.Security.SecurityState.Info:
|
|
503
505
|
throw new Error(`Unexpected security state ${securityState}`);
|
|
504
506
|
}
|
|
505
|
-
return
|
|
507
|
+
return html`<devtools-icon name=${iconName} class=${className} title=${ifDefined(title)}></devtools-icon>`;
|
|
506
508
|
}
|
|
507
509
|
|
|
508
510
|
export function renderHighlightedUrl(url: Platform.DevToolsPath.UrlString, securityState: string): TemplateResult {
|
|
@@ -539,80 +541,89 @@ export function renderCertificateViewerButton(text: string, jslogContext: string
|
|
|
539
541
|
}
|
|
540
542
|
|
|
541
543
|
export interface ViewInput {
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
544
|
+
mainOrigin: string|null;
|
|
545
|
+
sidebarOrigins: ReadonlyMap<Platform.DevToolsPath.UrlString, Protocol.Security.SecurityState>;
|
|
546
|
+
originsHidden: boolean;
|
|
547
|
+
showOriginsUnconditionally: boolean;
|
|
548
|
+
overviewSecurityState: Protocol.Security.SecurityState;
|
|
549
|
+
activeOrigin: Platform.DevToolsPath.UrlString|null;
|
|
550
|
+
activeOriginState: OriginState|null;
|
|
551
|
+
visibleSecurityState: PageVisibleSecurityState|null;
|
|
552
|
+
filterRequestCounts: ReadonlyMap<string, number>;
|
|
553
|
+
onShowOrigin: (origin: Platform.DevToolsPath.UrlString|null) => void;
|
|
550
554
|
}
|
|
551
555
|
|
|
552
|
-
export type View = (input: ViewInput, output:
|
|
556
|
+
export type View = (input: ViewInput, output: undefined, target: HTMLElement) => void;
|
|
553
557
|
|
|
554
|
-
const DEFAULT_VIEW: View = (input
|
|
558
|
+
export const DEFAULT_VIEW: View = (input, _output, target): void => {
|
|
559
|
+
const {activeOrigin, activeOriginState} = input;
|
|
555
560
|
// clang-format off
|
|
556
561
|
render(html`
|
|
557
|
-
<devtools-split-view direction="column" name="security"
|
|
558
|
-
${UI.Widget.widgetRef(UI.SplitWidget.SplitWidget, e => {output.splitWidget = e;})}>
|
|
562
|
+
<devtools-split-view direction="column" name="security">
|
|
559
563
|
<devtools-widget
|
|
560
564
|
slot="sidebar"
|
|
561
|
-
|
|
562
|
-
|
|
565
|
+
autofocus
|
|
566
|
+
class="panel-sidebar"
|
|
567
|
+
jslog=${VisualLogging.pane('sidebar').track({resize: true})}
|
|
568
|
+
${widget(SecurityPanelSidebar, {
|
|
569
|
+
mainOrigin: input.mainOrigin,
|
|
570
|
+
origins: input.sidebarOrigins,
|
|
571
|
+
originsHidden: input.originsHidden,
|
|
572
|
+
showOriginsUnconditionally: input.showOriginsUnconditionally,
|
|
573
|
+
overviewSecurityState: input.overviewSecurityState,
|
|
574
|
+
activeOrigin: input.activeOrigin,
|
|
575
|
+
onShowOrigin: input.onShowOrigin,
|
|
576
|
+
})}>
|
|
563
577
|
</devtools-widget>
|
|
564
|
-
|
|
565
|
-
|
|
578
|
+
${activeOrigin !== null && activeOriginState !== null ? html`
|
|
579
|
+
<devtools-widget
|
|
580
|
+
slot="main"
|
|
581
|
+
${widget(SecurityOriginView, {
|
|
582
|
+
origin: activeOrigin,
|
|
583
|
+
securityState: activeOriginState.securityState,
|
|
584
|
+
securityDetails: activeOriginState.securityDetails,
|
|
585
|
+
loadedFromCache: activeOriginState.loadedFromCache,
|
|
586
|
+
})}>
|
|
587
|
+
</devtools-widget>` : html`
|
|
588
|
+
<devtools-widget
|
|
589
|
+
slot="main"
|
|
590
|
+
${widget(SecurityMainView, {
|
|
591
|
+
visibleSecurityState: input.visibleSecurityState,
|
|
592
|
+
filterRequestCounts: input.filterRequestCounts,
|
|
593
|
+
})}>
|
|
594
|
+
</devtools-widget>`}
|
|
595
|
+
</devtools-split-view>
|
|
596
|
+
`, target);
|
|
566
597
|
// clang-format on
|
|
567
598
|
};
|
|
568
599
|
|
|
569
600
|
export class SecurityPanel extends UI.Panel.Panel implements SDK.TargetManager.SDKModelObserver<SecurityModel> {
|
|
570
|
-
readonly
|
|
571
|
-
readonly
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
this.
|
|
586
|
-
|
|
587
|
-
this.sidebar.setMinimumSize(100, 25);
|
|
588
|
-
this.sidebar.element.classList.add('panel-sidebar');
|
|
589
|
-
this.sidebar.element.setAttribute('jslog', `${VisualLogging.pane('sidebar').track({resize: true})}`);
|
|
590
|
-
|
|
591
|
-
this.mainView = new SecurityMainView();
|
|
592
|
-
this.sidebar.onShowOrigin = (origin: Platform.DevToolsPath.UrlString|null) => {
|
|
593
|
-
if (origin) {
|
|
594
|
-
this.showOrigin(origin);
|
|
595
|
-
} else {
|
|
596
|
-
this.setVisibleView(this.mainView);
|
|
597
|
-
}
|
|
598
|
-
};
|
|
599
|
-
|
|
600
|
-
this.lastResponseReceivedForLoaderId = new Map();
|
|
601
|
-
|
|
602
|
-
this.origins = new Map();
|
|
603
|
-
|
|
604
|
-
this.filterRequestCounts = new Map();
|
|
601
|
+
readonly #view: View;
|
|
602
|
+
readonly #lastResponseReceivedForLoaderId = new Map<string, SDK.NetworkRequest.NetworkRequest>();
|
|
603
|
+
readonly #origins = new Map<Platform.DevToolsPath.UrlString, OriginState>();
|
|
604
|
+
#sidebarOrigins: ReadonlyMap<Platform.DevToolsPath.UrlString, Protocol.Security.SecurityState> = new Map();
|
|
605
|
+
#filterRequestCounts: ReadonlyMap<string, number> = new Map();
|
|
606
|
+
#visibleSecurityState: PageVisibleSecurityState|null = null;
|
|
607
|
+
#activeOrigin: Platform.DevToolsPath.UrlString|null = null;
|
|
608
|
+
#mainOrigin: string|null = null;
|
|
609
|
+
#originsHidden = false;
|
|
610
|
+
#showOriginsUnconditionally = false;
|
|
611
|
+
#overviewSecurityState: Protocol.Security.SecurityState = Protocol.Security.SecurityState.Unknown;
|
|
612
|
+
#eventListeners: Common.EventTarget.EventDescriptor[] = [];
|
|
613
|
+
#securityModel: SecurityModel|null = null;
|
|
614
|
+
|
|
615
|
+
readonly #onShowOrigin = (origin: Platform.DevToolsPath.UrlString|null): void => {
|
|
616
|
+
this.showOrigin(origin);
|
|
617
|
+
};
|
|
605
618
|
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
this
|
|
619
|
+
constructor(view: View = DEFAULT_VIEW) {
|
|
620
|
+
super('security');
|
|
621
|
+
this.#view = view;
|
|
609
622
|
|
|
610
623
|
SDK.TargetManager.TargetManager.instance().observeModels(SecurityModel, this, {scoped: true});
|
|
611
|
-
SDK.TargetManager.TargetManager.instance().addModelListener(
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
this.sidebar.showOverview();
|
|
624
|
+
SDK.TargetManager.TargetManager.instance().addModelListener(SDK.ResourceTreeModel.ResourceTreeModel,
|
|
625
|
+
SDK.ResourceTreeModel.Events.PrimaryPageChanged,
|
|
626
|
+
this.#onPrimaryPageChanged, this);
|
|
616
627
|
}
|
|
617
628
|
|
|
618
629
|
static instance(opts: {forceNew: boolean|null} = {forceNew: null}): SecurityPanel {
|
|
@@ -623,77 +634,57 @@ export class SecurityPanel extends UI.Panel.Panel implements SDK.TargetManager.S
|
|
|
623
634
|
|
|
624
635
|
return securityPanelInstance;
|
|
625
636
|
}
|
|
626
|
-
|
|
627
|
-
static createCertificateViewerButtonForCert(text: string, names: string[]): Element {
|
|
628
|
-
const certificateButton = UI.UIUtils.createTextButton(text, e => {
|
|
629
|
-
e.consume();
|
|
630
|
-
Host.InspectorFrontendHost.InspectorFrontendHostInstance.showCertificateViewer(names);
|
|
631
|
-
}, {className: 'origin-button', jslogContext: 'security.view-certificate'});
|
|
632
|
-
UI.ARIAUtils.markAsButton(certificateButton);
|
|
633
|
-
return certificateButton;
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
update(): void {
|
|
637
|
-
this.view({panel: this}, this, this.contentElement);
|
|
638
|
-
}
|
|
639
|
-
|
|
640
|
-
private updateVisibleSecurityState(visibleSecurityState: PageVisibleSecurityState): void {
|
|
641
|
-
this.sidebar.updateOverviewSecurityState(visibleSecurityState.securityState);
|
|
642
|
-
this.mainView.updateVisibleSecurityState(visibleSecurityState);
|
|
643
|
-
}
|
|
644
|
-
|
|
645
|
-
private onVisibleSecurityStateChanged({data}: Common.EventTarget.EventTargetEvent<PageVisibleSecurityState>): void {
|
|
646
|
-
this.updateVisibleSecurityState(data);
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
showOrigin(origin: Platform.DevToolsPath.UrlString): void {
|
|
650
|
-
const originState = this.origins.get(origin);
|
|
651
|
-
if (!originState) {
|
|
652
|
-
return;
|
|
653
|
-
}
|
|
654
|
-
if (!originState.originView) {
|
|
655
|
-
originState.originView = new SecurityOriginView(origin, originState);
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
this.setVisibleView(originState.originView);
|
|
659
|
-
}
|
|
660
|
-
|
|
661
637
|
override wasShown(): void {
|
|
662
638
|
super.wasShown();
|
|
663
|
-
|
|
664
|
-
this.sidebar.showOverview();
|
|
665
|
-
}
|
|
639
|
+
this.requestUpdate();
|
|
666
640
|
}
|
|
667
641
|
|
|
668
|
-
override
|
|
669
|
-
this.
|
|
642
|
+
override performUpdate(): void {
|
|
643
|
+
const activeOriginState = this.#activeOrigin ? this.#origins.get(this.#activeOrigin) ?? null : null;
|
|
644
|
+
const input: ViewInput = {
|
|
645
|
+
mainOrigin: this.#mainOrigin,
|
|
646
|
+
sidebarOrigins: this.#sidebarOrigins,
|
|
647
|
+
originsHidden: this.#originsHidden,
|
|
648
|
+
showOriginsUnconditionally: this.#showOriginsUnconditionally,
|
|
649
|
+
overviewSecurityState: this.#overviewSecurityState,
|
|
650
|
+
activeOrigin: this.#activeOrigin,
|
|
651
|
+
activeOriginState,
|
|
652
|
+
visibleSecurityState: this.#visibleSecurityState,
|
|
653
|
+
filterRequestCounts: this.#filterRequestCounts,
|
|
654
|
+
onShowOrigin: this.#onShowOrigin,
|
|
655
|
+
};
|
|
656
|
+
this.#view(input, undefined, this.contentElement);
|
|
670
657
|
}
|
|
671
658
|
|
|
672
|
-
|
|
673
|
-
if (this.
|
|
659
|
+
showOrigin(origin: Platform.DevToolsPath.UrlString|null): void {
|
|
660
|
+
if (origin !== null && !this.#origins.has(origin)) {
|
|
674
661
|
return;
|
|
675
662
|
}
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
this.visibleView.detach();
|
|
663
|
+
if (this.#activeOrigin === origin) {
|
|
664
|
+
return;
|
|
679
665
|
}
|
|
666
|
+
this.#activeOrigin = origin;
|
|
667
|
+
this.requestUpdate();
|
|
668
|
+
}
|
|
680
669
|
|
|
681
|
-
|
|
670
|
+
#updateVisibleSecurityState(visibleSecurityState: PageVisibleSecurityState): void {
|
|
671
|
+
this.#overviewSecurityState = visibleSecurityState.securityState;
|
|
672
|
+
this.#visibleSecurityState = visibleSecurityState;
|
|
673
|
+
this.requestUpdate();
|
|
674
|
+
}
|
|
682
675
|
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
}
|
|
676
|
+
#onVisibleSecurityStateChanged({data}: Common.EventTarget.EventTargetEvent<PageVisibleSecurityState>): void {
|
|
677
|
+
this.#updateVisibleSecurityState(data);
|
|
686
678
|
}
|
|
687
679
|
|
|
688
|
-
|
|
689
|
-
void {
|
|
680
|
+
#onResponseReceived(event: Common.EventTarget.EventTargetEvent<SDK.NetworkManager.ResponseReceivedEvent>): void {
|
|
690
681
|
const request = event.data.request;
|
|
691
682
|
if (request.resourceType() === Common.ResourceType.resourceTypes.Document && request.loaderId) {
|
|
692
|
-
this
|
|
683
|
+
this.#lastResponseReceivedForLoaderId.set(request.loaderId, request);
|
|
693
684
|
}
|
|
694
685
|
}
|
|
695
686
|
|
|
696
|
-
|
|
687
|
+
#processRequest(request: SDK.NetworkRequest.NetworkRequest): void {
|
|
697
688
|
const origin = Common.ParsedURL.ParsedURL.extractOrigin(request.url());
|
|
698
689
|
|
|
699
690
|
if (!origin) {
|
|
@@ -707,7 +698,7 @@ export class SecurityPanel extends UI.Panel.Panel implements SDK.TargetManager.S
|
|
|
707
698
|
securityState = Protocol.Security.SecurityState.Insecure;
|
|
708
699
|
}
|
|
709
700
|
|
|
710
|
-
const originState = this
|
|
701
|
+
const originState = this.#origins.get(origin);
|
|
711
702
|
if (originState) {
|
|
712
703
|
if (securityStateCompare(securityState, originState.securityState) < 0) {
|
|
713
704
|
originState.securityState = securityState;
|
|
@@ -715,10 +706,10 @@ export class SecurityPanel extends UI.Panel.Panel implements SDK.TargetManager.S
|
|
|
715
706
|
if (securityDetails) {
|
|
716
707
|
originState.securityDetails = securityDetails;
|
|
717
708
|
}
|
|
718
|
-
this
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
709
|
+
const newSidebarOrigins = new Map(this.#sidebarOrigins);
|
|
710
|
+
newSidebarOrigins.set(origin, securityState);
|
|
711
|
+
this.#sidebarOrigins = newSidebarOrigins;
|
|
712
|
+
this.requestUpdate();
|
|
722
713
|
}
|
|
723
714
|
} else {
|
|
724
715
|
// This stores the first security details we see for an origin, but we should
|
|
@@ -729,21 +720,21 @@ export class SecurityPanel extends UI.Panel.Panel implements SDK.TargetManager.S
|
|
|
729
720
|
securityDetails: request.securityDetails(),
|
|
730
721
|
loadedFromCache: request.cached(),
|
|
731
722
|
};
|
|
732
|
-
this
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
723
|
+
this.#origins.set(origin, newOriginState);
|
|
724
|
+
const newSidebarOrigins = new Map(this.#sidebarOrigins);
|
|
725
|
+
newSidebarOrigins.set(origin, securityState);
|
|
726
|
+
this.#sidebarOrigins = newSidebarOrigins;
|
|
727
|
+
this.requestUpdate();
|
|
737
728
|
}
|
|
738
729
|
}
|
|
739
730
|
|
|
740
|
-
|
|
731
|
+
#onRequestFinished(event: Common.EventTarget.EventTargetEvent<SDK.NetworkRequest.NetworkRequest>): void {
|
|
741
732
|
const request = event.data;
|
|
742
|
-
this
|
|
743
|
-
this
|
|
733
|
+
this.#updateFilterRequestCounts(request);
|
|
734
|
+
this.#processRequest(request);
|
|
744
735
|
}
|
|
745
736
|
|
|
746
|
-
|
|
737
|
+
#updateFilterRequestCounts(request: SDK.NetworkRequest.NetworkRequest): void {
|
|
747
738
|
if (request.mixedContentType === Protocol.Security.MixedContentType.None) {
|
|
748
739
|
return;
|
|
749
740
|
}
|
|
@@ -757,14 +748,11 @@ export class SecurityPanel extends UI.Panel.Panel implements SDK.TargetManager.S
|
|
|
757
748
|
filterKey = NetworkForward.UIFilter.MixedContentFilterValues.DISPLAYED;
|
|
758
749
|
}
|
|
759
750
|
|
|
760
|
-
const currentCount = this
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
}
|
|
766
|
-
|
|
767
|
-
this.mainView.setFilterRequestCounts(new Map(this.filterRequestCounts));
|
|
751
|
+
const currentCount = this.#filterRequestCounts.get(filterKey) ?? 0;
|
|
752
|
+
const newCounts = new Map(this.#filterRequestCounts);
|
|
753
|
+
newCounts.set(filterKey, currentCount + 1);
|
|
754
|
+
this.#filterRequestCounts = newCounts;
|
|
755
|
+
this.requestUpdate();
|
|
768
756
|
}
|
|
769
757
|
|
|
770
758
|
modelAdded(securityModel: SecurityModel): void {
|
|
@@ -772,72 +760,74 @@ export class SecurityPanel extends UI.Panel.Panel implements SDK.TargetManager.S
|
|
|
772
760
|
return;
|
|
773
761
|
}
|
|
774
762
|
|
|
775
|
-
this
|
|
763
|
+
this.#securityModel = securityModel;
|
|
776
764
|
const resourceTreeModel = securityModel.resourceTreeModel();
|
|
777
765
|
const networkManager = securityModel.networkManager();
|
|
778
|
-
if (this
|
|
779
|
-
Common.EventTarget.removeEventListeners(this
|
|
766
|
+
if (this.#eventListeners.length) {
|
|
767
|
+
Common.EventTarget.removeEventListeners(this.#eventListeners);
|
|
780
768
|
}
|
|
781
|
-
this
|
|
782
|
-
securityModel.addEventListener(Events.VisibleSecurityStateChanged, this
|
|
783
|
-
resourceTreeModel.addEventListener(
|
|
784
|
-
|
|
785
|
-
resourceTreeModel.addEventListener(
|
|
786
|
-
|
|
787
|
-
networkManager.addEventListener(SDK.NetworkManager.Events.ResponseReceived, this
|
|
788
|
-
networkManager.addEventListener(SDK.NetworkManager.Events.RequestFinished, this
|
|
769
|
+
this.#eventListeners = [
|
|
770
|
+
securityModel.addEventListener(Events.VisibleSecurityStateChanged, this.#onVisibleSecurityStateChanged, this),
|
|
771
|
+
resourceTreeModel.addEventListener(SDK.ResourceTreeModel.Events.InterstitialShown, this.#onInterstitialShown,
|
|
772
|
+
this),
|
|
773
|
+
resourceTreeModel.addEventListener(SDK.ResourceTreeModel.Events.InterstitialHidden, this.#onInterstitialHidden,
|
|
774
|
+
this),
|
|
775
|
+
networkManager.addEventListener(SDK.NetworkManager.Events.ResponseReceived, this.#onResponseReceived, this),
|
|
776
|
+
networkManager.addEventListener(SDK.NetworkManager.Events.RequestFinished, this.#onRequestFinished, this),
|
|
789
777
|
];
|
|
790
778
|
|
|
791
779
|
if (resourceTreeModel.isInterstitialShowing) {
|
|
792
|
-
this
|
|
780
|
+
this.#onInterstitialShown();
|
|
793
781
|
}
|
|
794
782
|
}
|
|
795
783
|
|
|
796
784
|
modelRemoved(securityModel: SecurityModel): void {
|
|
797
|
-
if (this
|
|
785
|
+
if (this.#securityModel !== securityModel) {
|
|
798
786
|
return;
|
|
799
787
|
}
|
|
800
788
|
|
|
801
|
-
this
|
|
802
|
-
Common.EventTarget.removeEventListeners(this
|
|
789
|
+
this.#securityModel = null;
|
|
790
|
+
Common.EventTarget.removeEventListeners(this.#eventListeners);
|
|
803
791
|
}
|
|
804
792
|
|
|
805
|
-
|
|
793
|
+
#onPrimaryPageChanged(
|
|
806
794
|
event: Common.EventTarget.EventTargetEvent<
|
|
807
795
|
{frame: SDK.ResourceTreeModel.ResourceTreeFrame, type: SDK.ResourceTreeModel.PrimaryPageChangeType}>): void {
|
|
808
796
|
const {frame} = event.data;
|
|
809
|
-
const request = this
|
|
797
|
+
const request = this.#lastResponseReceivedForLoaderId.get(frame.loaderId);
|
|
810
798
|
|
|
811
|
-
this
|
|
812
|
-
this.
|
|
813
|
-
this
|
|
814
|
-
this
|
|
815
|
-
this
|
|
816
|
-
// After clearing the filtered request counts, refresh the
|
|
817
|
-
// explanations to reflect the new counts.
|
|
818
|
-
this.mainView.setFilterRequestCounts(new Map(this.filterRequestCounts));
|
|
799
|
+
this.#activeOrigin = null;
|
|
800
|
+
this.#origins.clear();
|
|
801
|
+
this.#sidebarOrigins = new Map();
|
|
802
|
+
this.#lastResponseReceivedForLoaderId.clear();
|
|
803
|
+
this.#filterRequestCounts = new Map();
|
|
819
804
|
|
|
820
805
|
// If we could not find a matching request (as in the case of clicking
|
|
821
806
|
// through an interstitial, see https://crbug.com/669309), set the origin
|
|
822
807
|
// based upon the url data from the PrimaryPageChanged event itself.
|
|
823
808
|
const origin = Common.ParsedURL.ParsedURL.extractOrigin(request ? request.url() : frame.url);
|
|
824
|
-
this
|
|
809
|
+
this.#mainOrigin = origin;
|
|
810
|
+
this.requestUpdate();
|
|
825
811
|
|
|
826
812
|
if (request) {
|
|
827
|
-
this
|
|
813
|
+
this.#processRequest(request);
|
|
828
814
|
}
|
|
829
815
|
}
|
|
830
816
|
|
|
831
|
-
|
|
817
|
+
#onInterstitialShown(): void {
|
|
832
818
|
// The panel might have been displaying the origin view on the
|
|
833
819
|
// previously loaded page. When showing an interstitial, switch
|
|
834
820
|
// back to the overview view.
|
|
835
|
-
this
|
|
836
|
-
this
|
|
821
|
+
this.#activeOrigin = null;
|
|
822
|
+
this.#originsHidden = true;
|
|
823
|
+
this.#showOriginsUnconditionally = false;
|
|
824
|
+
this.requestUpdate();
|
|
837
825
|
}
|
|
838
826
|
|
|
839
|
-
|
|
840
|
-
this
|
|
827
|
+
#onInterstitialHidden(): void {
|
|
828
|
+
this.#originsHidden = false;
|
|
829
|
+
this.#showOriginsUnconditionally = true;
|
|
830
|
+
this.requestUpdate();
|
|
841
831
|
}
|
|
842
832
|
}
|
|
843
833
|
|
|
@@ -850,152 +840,252 @@ export enum OriginGroup {
|
|
|
850
840
|
/* eslint-enable @typescript-eslint/naming-convention */
|
|
851
841
|
}
|
|
852
842
|
|
|
853
|
-
export
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
843
|
+
export interface SecurityMainViewExplanation {
|
|
844
|
+
securityState: Protocol.Security.SecurityState;
|
|
845
|
+
title?: string;
|
|
846
|
+
summary: string;
|
|
847
|
+
description: string;
|
|
848
|
+
certificate: string[];
|
|
849
|
+
recommendations?: string[];
|
|
850
|
+
mixedContent?: {filterKey: string, count: number};
|
|
851
|
+
}
|
|
862
852
|
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
853
|
+
export interface SecurityMainViewInput {
|
|
854
|
+
securityState: Protocol.Security.SecurityState|null;
|
|
855
|
+
summaryText: string;
|
|
856
|
+
mainExplanations: SecurityMainViewExplanation[];
|
|
857
|
+
extraExplanations: SecurityMainViewExplanation[];
|
|
858
|
+
onShowCertificateViewer: (certificate: string[]) => void;
|
|
859
|
+
onShowNetworkFilter: (filterKey: string) => void;
|
|
860
|
+
}
|
|
866
861
|
|
|
867
|
-
|
|
862
|
+
export type SecurityMainViewFunction = (input: SecurityMainViewInput, _output: undefined, target: HTMLElement) => void;
|
|
868
863
|
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
this.#summaryText = this.#summarySection.createChild('div', 'security-summary-text');
|
|
914
|
-
UI.ARIAUtils.markAsHeading(this.#summaryText, 2);
|
|
915
|
-
|
|
916
|
-
this.#explanations = null;
|
|
917
|
-
this.#securityState = null;
|
|
918
|
-
}
|
|
864
|
+
function renderExplanation(explanation: SecurityMainViewExplanation, input: SecurityMainViewInput): TemplateResult {
|
|
865
|
+
const icon = getSecurityStateIconForDetailedView(explanation.securityState,
|
|
866
|
+
`security-property security-property-${explanation.securityState}`);
|
|
867
|
+
const mixedContent = explanation.mixedContent;
|
|
868
|
+
return html`
|
|
869
|
+
<div class=${`security-explanation security-explanation-${explanation.securityState}`}>
|
|
870
|
+
${icon}
|
|
871
|
+
<div class="security-explanation-text">
|
|
872
|
+
<div class="security-explanation-title">${
|
|
873
|
+
explanation.title ? html`<span>${explanation.title} - </span><span class=${
|
|
874
|
+
`security-explanation-title-${explanation.securityState}`}>${
|
|
875
|
+
explanation.summary}</span>` :
|
|
876
|
+
explanation.summary}</div>
|
|
877
|
+
<div>${explanation.description}</div>
|
|
878
|
+
${
|
|
879
|
+
explanation.certificate.length > 0 ?
|
|
880
|
+
renderCertificateViewerButton(i18nString(UIStrings.viewCertificate), 'security.view-certificate',
|
|
881
|
+
() => input.onShowCertificateViewer(explanation.certificate)) :
|
|
882
|
+
nothing}
|
|
883
|
+
${
|
|
884
|
+
explanation.recommendations?.length ? html`
|
|
885
|
+
<ul class="security-explanation-recommendations">
|
|
886
|
+
${explanation.recommendations.map(recommendation => html`<li>${recommendation}</li>`)}
|
|
887
|
+
</ul>` :
|
|
888
|
+
nothing}
|
|
889
|
+
${
|
|
890
|
+
mixedContent ?
|
|
891
|
+
(mixedContent.count === 0 ?
|
|
892
|
+
html`
|
|
893
|
+
<div class="security-mixed-content">${i18nString(UIStrings.reloadThePageToRecordRequestsFor)}</div>` :
|
|
894
|
+
html`
|
|
895
|
+
<devtools-button
|
|
896
|
+
class="security-mixed-content"
|
|
897
|
+
.variant=${Buttons.Button.Variant.TEXT}
|
|
898
|
+
.jslogContext=${'reveal-in-network'}
|
|
899
|
+
@click=${(e: Event) => {
|
|
900
|
+
e.consume();
|
|
901
|
+
input.onShowNetworkFilter(mixedContent.filterKey);
|
|
902
|
+
}}>${i18nString(UIStrings.viewDRequestsInNetworkPanel, {n: mixedContent.count})}</devtools-button>`) :
|
|
903
|
+
nothing}
|
|
904
|
+
</div>
|
|
905
|
+
</div>`;
|
|
906
|
+
}
|
|
919
907
|
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
908
|
+
export const DEFAULT_SECURITY_MAIN_VIEW: SecurityMainViewFunction = (input, _output, target): void => {
|
|
909
|
+
const isInsecureBroken = input.securityState === Protocol.Security.SecurityState.InsecureBroken;
|
|
910
|
+
const insecureIconClass = isInsecureBroken ? 'lock-icon lock-icon-insecure-broken' : 'lock-icon lock-icon-insecure';
|
|
911
|
+
const insecureTooltip = isInsecureBroken ? i18nString(UIStrings.notSecureBroken) : i18nString(UIStrings.notSecure);
|
|
924
912
|
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
913
|
+
// clang-format off
|
|
914
|
+
render(
|
|
915
|
+
html`
|
|
916
|
+
<style>${lockIconStyles}</style>
|
|
917
|
+
<style>${mainViewStyles}</style>
|
|
918
|
+
<div class=${Directives.classMap({
|
|
919
|
+
'security-summary': true,
|
|
920
|
+
[`security-summary-${input.securityState}`]: input.securityState !== null,
|
|
921
|
+
})}>
|
|
922
|
+
<div class="security-summary-section-title" role="heading" aria-level="1">
|
|
923
|
+
${i18nString(UIStrings.securityOverview)}
|
|
924
|
+
</div>
|
|
925
|
+
<div class="lock-spectrum">
|
|
926
|
+
${getSecurityStateIconForOverview(
|
|
927
|
+
Protocol.Security.SecurityState.Secure, 'lock-icon lock-icon-secure', i18nString(UIStrings.secure))}
|
|
928
|
+
${getSecurityStateIconForOverview(
|
|
929
|
+
Protocol.Security.SecurityState.Neutral, 'lock-icon lock-icon-neutral', i18nString(UIStrings.info))}
|
|
930
|
+
${getSecurityStateIconForOverview(
|
|
931
|
+
isInsecureBroken ? Protocol.Security.SecurityState.InsecureBroken : Protocol.Security.SecurityState.Insecure,
|
|
932
|
+
insecureIconClass, insecureTooltip)}
|
|
933
|
+
</div>
|
|
934
|
+
<div class="triangle-pointer-container">
|
|
935
|
+
<div class="triangle-pointer-wrapper">
|
|
936
|
+
<div class="triangle-pointer"></div>
|
|
937
|
+
</div>
|
|
938
|
+
</div>
|
|
939
|
+
<div class="security-summary-text" role="heading" aria-level="2">${input.summaryText}</div>
|
|
940
|
+
</div>
|
|
941
|
+
<div class="security-explanation-list security-explanations-main">${input.mainExplanations.length > 0 ? input.mainExplanations.map(explanation => renderExplanation(explanation, input)) : nothing}</div>
|
|
942
|
+
<div class="security-explanation-list security-explanations-extra">${input.extraExplanations.length > 0 ? input.extraExplanations.map(explanation => renderExplanation(explanation, input)) : nothing}</div>
|
|
943
|
+
`,
|
|
944
|
+
target,
|
|
945
|
+
{
|
|
946
|
+
container: {
|
|
947
|
+
classes: ['security-main-view'],
|
|
948
|
+
attributes: {
|
|
949
|
+
jslog: `${VisualLogging.pane('security.main-view')}`,
|
|
950
|
+
},
|
|
951
|
+
},
|
|
952
|
+
},
|
|
953
|
+
);
|
|
954
|
+
// clang-format on
|
|
955
|
+
};
|
|
932
956
|
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
957
|
+
export class SecurityMainView extends UI.Widget.VBox {
|
|
958
|
+
readonly #view: SecurityMainViewFunction;
|
|
959
|
+
#visibleSecurityState: PageVisibleSecurityState|null = null;
|
|
960
|
+
#summaryText = '';
|
|
961
|
+
#explanations: Array<Protocol.Security.SecurityStateExplanation|SecurityStyleExplanation>|null = null;
|
|
962
|
+
#securityState: Protocol.Security.SecurityState|null = null;
|
|
963
|
+
#filterRequestCounts: ReadonlyMap<string, number> = new Map();
|
|
937
964
|
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
const text = explanationSection.createChild('div', 'security-explanation-text');
|
|
965
|
+
readonly #showCertificateViewer = (certificate: string[]): void => {
|
|
966
|
+
Host.InspectorFrontendHost.InspectorFrontendHostInstance.showCertificateViewer(certificate);
|
|
967
|
+
};
|
|
942
968
|
|
|
943
|
-
|
|
969
|
+
readonly #showNetworkFilter = (filterKey: string): void => {
|
|
970
|
+
void Common.Revealer.reveal(NetworkForward.UIFilter.UIRequestFilter.filters(
|
|
971
|
+
[{filterType: NetworkForward.UIFilter.FilterType.MixedContent, filterValue: filterKey}]));
|
|
972
|
+
};
|
|
944
973
|
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
explanationHeader.textContent = explanation.summary;
|
|
951
|
-
}
|
|
974
|
+
constructor(element?: HTMLElement, view: SecurityMainViewFunction = DEFAULT_SECURITY_MAIN_VIEW) {
|
|
975
|
+
super(element);
|
|
976
|
+
this.#view = view;
|
|
977
|
+
this.setMinimumSize(200, 100);
|
|
978
|
+
}
|
|
952
979
|
|
|
953
|
-
|
|
980
|
+
override wasShown(): void {
|
|
981
|
+
super.wasShown();
|
|
982
|
+
this.requestUpdate();
|
|
983
|
+
}
|
|
954
984
|
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
985
|
+
override performUpdate(): void {
|
|
986
|
+
const mainExplanations: SecurityMainViewExplanation[] = [];
|
|
987
|
+
const extraExplanations: SecurityMainViewExplanation[] = [];
|
|
988
|
+
|
|
989
|
+
if (this.#explanations) {
|
|
990
|
+
for (const explanation of this.#explanations) {
|
|
991
|
+
if (explanation.securityState === Protocol.Security.SecurityState.Info) {
|
|
992
|
+
extraExplanations.push({
|
|
993
|
+
securityState: explanation.securityState,
|
|
994
|
+
title: explanation.title,
|
|
995
|
+
summary: explanation.summary,
|
|
996
|
+
description: explanation.description,
|
|
997
|
+
certificate: explanation.certificate ?? [],
|
|
998
|
+
recommendations: explanation.recommendations,
|
|
999
|
+
});
|
|
1000
|
+
} else {
|
|
1001
|
+
let mixedContent: {filterKey: string, count: number}|undefined;
|
|
1002
|
+
switch (explanation.mixedContentType) {
|
|
1003
|
+
case Protocol.Security.MixedContentType.Blockable: {
|
|
1004
|
+
const filterKey = NetworkForward.UIFilter.MixedContentFilterValues.BLOCK_OVERRIDDEN;
|
|
1005
|
+
mixedContent = {filterKey, count: this.#filterRequestCounts.get(filterKey) ?? 0};
|
|
1006
|
+
break;
|
|
1007
|
+
}
|
|
1008
|
+
case Protocol.Security.MixedContentType.OptionallyBlockable: {
|
|
1009
|
+
const filterKey = NetworkForward.UIFilter.MixedContentFilterValues.DISPLAYED;
|
|
1010
|
+
mixedContent = {filterKey, count: this.#filterRequestCounts.get(filterKey) ?? 0};
|
|
1011
|
+
break;
|
|
1012
|
+
}
|
|
1013
|
+
default:
|
|
1014
|
+
break;
|
|
1015
|
+
}
|
|
1016
|
+
mainExplanations.push({
|
|
1017
|
+
securityState: explanation.securityState,
|
|
1018
|
+
title: explanation.title,
|
|
1019
|
+
summary: explanation.summary,
|
|
1020
|
+
description: explanation.description,
|
|
1021
|
+
certificate: explanation.certificate ?? [],
|
|
1022
|
+
recommendations: explanation.recommendations,
|
|
1023
|
+
mixedContent,
|
|
1024
|
+
});
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
958
1027
|
}
|
|
959
1028
|
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
1029
|
+
const blockedCount = this.#filterRequestCounts.get(NetworkForward.UIFilter.MixedContentFilterValues.BLOCKED) ?? 0;
|
|
1030
|
+
if (blockedCount > 0) {
|
|
1031
|
+
mainExplanations.push({
|
|
1032
|
+
securityState: Protocol.Security.SecurityState.Info,
|
|
1033
|
+
summary: i18nString(UIStrings.blockedMixedContent),
|
|
1034
|
+
description: i18nString(UIStrings.yourPageRequestedNonsecure),
|
|
1035
|
+
certificate: [],
|
|
1036
|
+
mixedContent: {
|
|
1037
|
+
filterKey: NetworkForward.UIFilter.MixedContentFilterValues.BLOCKED,
|
|
1038
|
+
count: blockedCount,
|
|
1039
|
+
},
|
|
1040
|
+
});
|
|
965
1041
|
}
|
|
966
|
-
|
|
1042
|
+
|
|
1043
|
+
this.#view(
|
|
1044
|
+
{
|
|
1045
|
+
securityState: this.#securityState,
|
|
1046
|
+
summaryText: this.#summaryText,
|
|
1047
|
+
mainExplanations,
|
|
1048
|
+
extraExplanations,
|
|
1049
|
+
onShowCertificateViewer: this.#showCertificateViewer,
|
|
1050
|
+
onShowNetworkFilter: this.#showNetworkFilter,
|
|
1051
|
+
},
|
|
1052
|
+
undefined,
|
|
1053
|
+
this.contentElement,
|
|
1054
|
+
);
|
|
967
1055
|
}
|
|
968
1056
|
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
this.#summarySection.classList.remove('security-summary-' + this.#securityState);
|
|
973
|
-
|
|
974
|
-
// Add new state.
|
|
975
|
-
this.#securityState = visibleSecurityState.securityState;
|
|
976
|
-
this.#summarySection.classList.add('security-summary-' + this.#securityState);
|
|
977
|
-
|
|
978
|
-
// Update the color and title of the triangle icon in the lock spectrum to
|
|
979
|
-
// match the security state.
|
|
980
|
-
if (this.#securityState === Protocol.Security.SecurityState.Insecure) {
|
|
981
|
-
this.#getLockSpectrumDiv(Protocol.Security.SecurityState.Insecure).classList.add('lock-icon-insecure');
|
|
982
|
-
this.#getLockSpectrumDiv(Protocol.Security.SecurityState.Insecure).classList.remove('lock-icon-insecure-broken');
|
|
983
|
-
UI.Tooltip.Tooltip.install(this.#getLockSpectrumDiv(Protocol.Security.SecurityState.Insecure),
|
|
984
|
-
i18nString(UIStrings.notSecure));
|
|
985
|
-
} else if (this.#securityState === Protocol.Security.SecurityState.InsecureBroken) {
|
|
986
|
-
this.#getLockSpectrumDiv(Protocol.Security.SecurityState.Insecure).classList.add('lock-icon-insecure-broken');
|
|
987
|
-
this.#getLockSpectrumDiv(Protocol.Security.SecurityState.Insecure).classList.remove('lock-icon-insecure');
|
|
988
|
-
UI.Tooltip.Tooltip.install(this.#getLockSpectrumDiv(Protocol.Security.SecurityState.Insecure),
|
|
989
|
-
i18nString(UIStrings.notSecureBroken));
|
|
1057
|
+
set filterRequestCounts(filterRequestCounts: ReadonlyMap<string, number>) {
|
|
1058
|
+
if (this.#filterRequestCounts === filterRequestCounts) {
|
|
1059
|
+
return;
|
|
990
1060
|
}
|
|
1061
|
+
this.#filterRequestCounts = filterRequestCounts;
|
|
1062
|
+
this.requestUpdate();
|
|
1063
|
+
}
|
|
991
1064
|
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
1065
|
+
get filterRequestCounts(): ReadonlyMap<string, number> {
|
|
1066
|
+
return this.#filterRequestCounts;
|
|
1067
|
+
}
|
|
995
1068
|
|
|
996
|
-
|
|
1069
|
+
set visibleSecurityState(visibleSecurityState: PageVisibleSecurityState|null) {
|
|
1070
|
+
if (this.#visibleSecurityState === visibleSecurityState) {
|
|
1071
|
+
return;
|
|
1072
|
+
}
|
|
1073
|
+
this.#visibleSecurityState = visibleSecurityState;
|
|
1074
|
+
if (visibleSecurityState) {
|
|
1075
|
+
this.#securityState = visibleSecurityState.securityState;
|
|
1076
|
+
const {summary, explanations} = this.#getSecuritySummaryAndExplanations(visibleSecurityState);
|
|
1077
|
+
this.#summaryText = summary || SummaryMessages[this.#securityState]();
|
|
1078
|
+
this.#explanations = this.#orderExplanations(explanations);
|
|
1079
|
+
} else {
|
|
1080
|
+
this.#securityState = null;
|
|
1081
|
+
this.#summaryText = '';
|
|
1082
|
+
this.#explanations = null;
|
|
1083
|
+
}
|
|
1084
|
+
this.requestUpdate();
|
|
1085
|
+
}
|
|
997
1086
|
|
|
998
|
-
|
|
1087
|
+
get visibleSecurityState(): PageVisibleSecurityState|null {
|
|
1088
|
+
return this.#visibleSecurityState;
|
|
999
1089
|
}
|
|
1000
1090
|
|
|
1001
1091
|
#getSecuritySummaryAndExplanations(visibleSecurityState: PageVisibleSecurityState):
|
|
@@ -1236,81 +1326,6 @@ export class SecurityMainView extends UI.Widget.VBox {
|
|
|
1236
1326
|
}
|
|
1237
1327
|
return orderedExplanations;
|
|
1238
1328
|
}
|
|
1239
|
-
|
|
1240
|
-
refreshExplanations(): void {
|
|
1241
|
-
this.#refreshExplanations();
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1244
|
-
#refreshExplanations(): void {
|
|
1245
|
-
this.#securityExplanationsMain.removeChildren();
|
|
1246
|
-
this.#securityExplanationsExtra.removeChildren();
|
|
1247
|
-
if (!this.#explanations) {
|
|
1248
|
-
return;
|
|
1249
|
-
}
|
|
1250
|
-
for (const explanation of this.#explanations) {
|
|
1251
|
-
if (explanation.securityState === Protocol.Security.SecurityState.Info) {
|
|
1252
|
-
this.#addExplanation(this.#securityExplanationsExtra, explanation);
|
|
1253
|
-
} else {
|
|
1254
|
-
switch (explanation.mixedContentType) {
|
|
1255
|
-
case Protocol.Security.MixedContentType.Blockable:
|
|
1256
|
-
this.#addMixedContentExplanation(this.#securityExplanationsMain, explanation,
|
|
1257
|
-
NetworkForward.UIFilter.MixedContentFilterValues.BLOCK_OVERRIDDEN);
|
|
1258
|
-
break;
|
|
1259
|
-
case Protocol.Security.MixedContentType.OptionallyBlockable:
|
|
1260
|
-
this.#addMixedContentExplanation(this.#securityExplanationsMain, explanation,
|
|
1261
|
-
NetworkForward.UIFilter.MixedContentFilterValues.DISPLAYED);
|
|
1262
|
-
break;
|
|
1263
|
-
default:
|
|
1264
|
-
this.#addExplanation(this.#securityExplanationsMain, explanation);
|
|
1265
|
-
break;
|
|
1266
|
-
}
|
|
1267
|
-
}
|
|
1268
|
-
}
|
|
1269
|
-
|
|
1270
|
-
if ((this.#filterRequestCounts.get(NetworkForward.UIFilter.MixedContentFilterValues.BLOCKED) ?? 0) > 0) {
|
|
1271
|
-
const explanation = {
|
|
1272
|
-
securityState: Protocol.Security.SecurityState.Info,
|
|
1273
|
-
summary: i18nString(UIStrings.blockedMixedContent),
|
|
1274
|
-
description: i18nString(UIStrings.yourPageRequestedNonsecure),
|
|
1275
|
-
mixedContentType: Protocol.Security.MixedContentType.Blockable,
|
|
1276
|
-
certificate: [],
|
|
1277
|
-
title: '',
|
|
1278
|
-
} as Protocol.Security.SecurityStateExplanation;
|
|
1279
|
-
this.#addMixedContentExplanation(this.#securityExplanationsMain, explanation,
|
|
1280
|
-
NetworkForward.UIFilter.MixedContentFilterValues.BLOCKED);
|
|
1281
|
-
}
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
|
-
#addMixedContentExplanation(parent: Element,
|
|
1285
|
-
explanation: Protocol.Security.SecurityStateExplanation|SecurityStyleExplanation,
|
|
1286
|
-
filterKey: string): void {
|
|
1287
|
-
const element = this.#addExplanation(parent, explanation);
|
|
1288
|
-
|
|
1289
|
-
const filterRequestCount = this.#filterRequestCounts.get(filterKey) ?? 0;
|
|
1290
|
-
if (!filterRequestCount) {
|
|
1291
|
-
// Network instrumentation might not have been enabled for the page
|
|
1292
|
-
// load, so the security panel does not necessarily know a count of
|
|
1293
|
-
// individual mixed requests at this point. Prompt them to refresh
|
|
1294
|
-
// instead of pointing them to the Network panel to get prompted
|
|
1295
|
-
// to refresh.
|
|
1296
|
-
const refreshPrompt = element.createChild('div', 'security-mixed-content');
|
|
1297
|
-
refreshPrompt.textContent = i18nString(UIStrings.reloadThePageToRecordRequestsFor);
|
|
1298
|
-
return;
|
|
1299
|
-
}
|
|
1300
|
-
|
|
1301
|
-
const requestsAnchor = element.createChild('button', 'security-mixed-content devtools-link text-button link-style');
|
|
1302
|
-
UI.ARIAUtils.markAsLink(requestsAnchor);
|
|
1303
|
-
requestsAnchor.tabIndex = 0;
|
|
1304
|
-
requestsAnchor.textContent = i18nString(UIStrings.viewDRequestsInNetworkPanel, {n: filterRequestCount});
|
|
1305
|
-
|
|
1306
|
-
requestsAnchor.addEventListener('click', this.#showNetworkFilter.bind(this, filterKey));
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
#showNetworkFilter(filterKey: string, e: Event): void {
|
|
1310
|
-
e.consume();
|
|
1311
|
-
void Common.Revealer.reveal(NetworkForward.UIFilter.UIRequestFilter.filters(
|
|
1312
|
-
[{filterType: NetworkForward.UIFilter.FilterType.MixedContent, filterValue: filterKey}]));
|
|
1313
|
-
}
|
|
1314
1329
|
}
|
|
1315
1330
|
|
|
1316
1331
|
const SAN_NUM_SHOWN_WHEN_TRUNCATED = 2;
|
|
@@ -1677,46 +1692,95 @@ export const DEFAULT_SECURITY_ORIGIN_VIEW: SecurityOriginViewFunction = (input,
|
|
|
1677
1692
|
<div class="title-section">
|
|
1678
1693
|
${renderTitleSection(input.origin, input.securityState, input.onRevealInNetwork)}
|
|
1679
1694
|
</div>
|
|
1680
|
-
${renderSecurityDetails(input)}`,
|
|
1695
|
+
${renderSecurityDetails(input)}`,
|
|
1681
1696
|
target, {
|
|
1682
1697
|
container: {
|
|
1683
1698
|
classes: ['security-origin-view'],
|
|
1684
1699
|
attributes: {jslog: `${VisualLogging.pane('security.origin-view')}`},
|
|
1685
1700
|
},
|
|
1686
1701
|
});
|
|
1702
|
+
// clang-format on
|
|
1687
1703
|
};
|
|
1688
1704
|
|
|
1689
1705
|
export class SecurityOriginView extends UI.Widget.VBox {
|
|
1690
1706
|
readonly #view: SecurityOriginViewFunction;
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
#securityState
|
|
1694
|
-
#securityDetails: Protocol.Network.SecurityDetails|null;
|
|
1695
|
-
#isSanListTruncated
|
|
1707
|
+
#origin: Platform.DevToolsPath.UrlString = Platform.DevToolsPath.EmptyUrlString;
|
|
1708
|
+
#loadedFromCache = false;
|
|
1709
|
+
#securityState = Protocol.Security.SecurityState.Unknown;
|
|
1710
|
+
#securityDetails: Protocol.Network.SecurityDetails|null = null;
|
|
1711
|
+
#isSanListTruncated = false;
|
|
1696
1712
|
#isCertificateTransparencyDetailsShown = false;
|
|
1697
1713
|
|
|
1698
|
-
constructor(
|
|
1699
|
-
|
|
1700
|
-
super();
|
|
1714
|
+
constructor(element?: HTMLElement, view: SecurityOriginViewFunction = DEFAULT_SECURITY_ORIGIN_VIEW) {
|
|
1715
|
+
super(element);
|
|
1701
1716
|
this.#view = view;
|
|
1702
1717
|
this.setMinimumSize(200, 100);
|
|
1718
|
+
}
|
|
1719
|
+
|
|
1720
|
+
override wasShown(): void {
|
|
1721
|
+
super.wasShown();
|
|
1722
|
+
this.requestUpdate();
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
set origin(origin: Platform.DevToolsPath.UrlString) {
|
|
1726
|
+
if (this.#origin === origin) {
|
|
1727
|
+
return;
|
|
1728
|
+
}
|
|
1703
1729
|
this.#origin = origin;
|
|
1704
|
-
this.#securityState = originState.securityState;
|
|
1705
|
-
this.#securityDetails = originState.securityDetails;
|
|
1706
|
-
this.#loadedFromCache = originState.loadedFromCache;
|
|
1707
1730
|
this.#isSanListTruncated = isSanListTruncatable(this.#securityDetails?.sanList ?? []);
|
|
1731
|
+
this.#isCertificateTransparencyDetailsShown = false;
|
|
1732
|
+
this.requestUpdate();
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1735
|
+
get origin(): Platform.DevToolsPath.UrlString {
|
|
1736
|
+
return this.#origin;
|
|
1737
|
+
}
|
|
1738
|
+
|
|
1739
|
+
set securityState(securityState: Protocol.Security.SecurityState) {
|
|
1740
|
+
if (this.#securityState === securityState) {
|
|
1741
|
+
return;
|
|
1742
|
+
}
|
|
1743
|
+
this.#securityState = securityState;
|
|
1744
|
+
this.requestUpdate();
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
get securityState(): Protocol.Security.SecurityState {
|
|
1748
|
+
return this.#securityState;
|
|
1749
|
+
}
|
|
1708
1750
|
|
|
1709
|
-
|
|
1751
|
+
set securityDetails(securityDetails: Protocol.Network.SecurityDetails|null) {
|
|
1752
|
+
if (this.#securityDetails === securityDetails) {
|
|
1753
|
+
return;
|
|
1754
|
+
}
|
|
1755
|
+
this.#securityDetails = securityDetails;
|
|
1756
|
+
this.#isSanListTruncated = isSanListTruncatable(securityDetails?.sanList ?? []);
|
|
1757
|
+
this.requestUpdate();
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
get securityDetails(): Protocol.Network.SecurityDetails|null {
|
|
1761
|
+
return this.#securityDetails;
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1764
|
+
set loadedFromCache(loadedFromCache: boolean) {
|
|
1765
|
+
if (this.#loadedFromCache === loadedFromCache) {
|
|
1766
|
+
return;
|
|
1767
|
+
}
|
|
1768
|
+
this.#loadedFromCache = loadedFromCache;
|
|
1769
|
+
this.requestUpdate();
|
|
1770
|
+
}
|
|
1771
|
+
|
|
1772
|
+
get loadedFromCache(): boolean {
|
|
1773
|
+
return this.#loadedFromCache;
|
|
1710
1774
|
}
|
|
1711
1775
|
|
|
1712
1776
|
#toggleSanTruncation = (): void => {
|
|
1713
1777
|
this.#isSanListTruncated = !this.#isSanListTruncated;
|
|
1714
|
-
this
|
|
1778
|
+
this.requestUpdate();
|
|
1715
1779
|
};
|
|
1716
1780
|
|
|
1717
1781
|
#toggleCertificateTransparencyDetails = (): void => {
|
|
1718
1782
|
this.#isCertificateTransparencyDetailsShown = !this.#isCertificateTransparencyDetailsShown;
|
|
1719
|
-
this
|
|
1783
|
+
this.requestUpdate();
|
|
1720
1784
|
};
|
|
1721
1785
|
|
|
1722
1786
|
#showCertificateViewer = async(): Promise<void> => {
|
|
@@ -1726,32 +1790,6 @@ export class SecurityOriginView extends UI.Widget.VBox {
|
|
|
1726
1790
|
}
|
|
1727
1791
|
};
|
|
1728
1792
|
|
|
1729
|
-
setSecurityState(newSecurityState: Protocol.Security.SecurityState,
|
|
1730
|
-
securityDetails: Protocol.Network.SecurityDetails|null): void {
|
|
1731
|
-
if (this.#securityDetails !== securityDetails) {
|
|
1732
|
-
this.#isSanListTruncated = isSanListTruncatable(securityDetails?.sanList ?? []);
|
|
1733
|
-
}
|
|
1734
|
-
this.#securityState = newSecurityState;
|
|
1735
|
-
this.#securityDetails = securityDetails;
|
|
1736
|
-
this.#renderView();
|
|
1737
|
-
}
|
|
1738
|
-
|
|
1739
|
-
#renderView(): void {
|
|
1740
|
-
this.#view({
|
|
1741
|
-
origin: this.#origin,
|
|
1742
|
-
securityState: this.#securityState,
|
|
1743
|
-
securityDetails: this.#securityDetails,
|
|
1744
|
-
loadedFromCache: this.#loadedFromCache,
|
|
1745
|
-
isSanListTruncated: this.#isSanListTruncated,
|
|
1746
|
-
isCertificateTransparencyDetailsShown: this.#isCertificateTransparencyDetailsShown,
|
|
1747
|
-
onRevealInNetwork: this.#revealInNetwork,
|
|
1748
|
-
onToggleSanTruncation: this.#toggleSanTruncation,
|
|
1749
|
-
onToggleCertificateTransparencyDetails: this.#toggleCertificateTransparencyDetails,
|
|
1750
|
-
onViewCertificate: this.#showCertificateViewer,
|
|
1751
|
-
},
|
|
1752
|
-
undefined, this.contentElement);
|
|
1753
|
-
}
|
|
1754
|
-
|
|
1755
1793
|
#revealInNetwork = (): void => {
|
|
1756
1794
|
const parsedURL = new Common.ParsedURL.ParsedURL(this.#origin);
|
|
1757
1795
|
void Common.Revealer.reveal(NetworkForward.UIFilter.UIRequestFilter.filters([
|
|
@@ -1759,13 +1797,31 @@ export class SecurityOriginView extends UI.Widget.VBox {
|
|
|
1759
1797
|
{filterType: NetworkForward.UIFilter.FilterType.Scheme, filterValue: parsedURL.scheme},
|
|
1760
1798
|
]));
|
|
1761
1799
|
};
|
|
1800
|
+
|
|
1801
|
+
override performUpdate(): void {
|
|
1802
|
+
this.#view(
|
|
1803
|
+
{
|
|
1804
|
+
origin: this.#origin,
|
|
1805
|
+
securityState: this.#securityState,
|
|
1806
|
+
securityDetails: this.#securityDetails,
|
|
1807
|
+
loadedFromCache: this.#loadedFromCache,
|
|
1808
|
+
isSanListTruncated: this.#isSanListTruncated,
|
|
1809
|
+
isCertificateTransparencyDetailsShown: this.#isCertificateTransparencyDetailsShown,
|
|
1810
|
+
onRevealInNetwork: this.#revealInNetwork,
|
|
1811
|
+
onToggleSanTruncation: this.#toggleSanTruncation,
|
|
1812
|
+
onToggleCertificateTransparencyDetails: this.#toggleCertificateTransparencyDetails,
|
|
1813
|
+
onViewCertificate: this.#showCertificateViewer,
|
|
1814
|
+
},
|
|
1815
|
+
undefined,
|
|
1816
|
+
this.contentElement,
|
|
1817
|
+
);
|
|
1818
|
+
}
|
|
1762
1819
|
}
|
|
1763
1820
|
|
|
1764
1821
|
export interface OriginState {
|
|
1765
1822
|
securityState: Protocol.Security.SecurityState;
|
|
1766
1823
|
securityDetails: Protocol.Network.SecurityDetails|null;
|
|
1767
1824
|
loadedFromCache: boolean;
|
|
1768
|
-
originView?: SecurityOriginView|null;
|
|
1769
1825
|
}
|
|
1770
1826
|
|
|
1771
1827
|
export type Origin = Platform.DevToolsPath.UrlString;
|