Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js

Issue 1727133002: Expose TLS settings in the Security panel overview, and call out individual obsolete settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add some tests. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @extends {WebInspector.PanelWithSidebar} 7 * @extends {WebInspector.PanelWithSidebar}
8 * @implements {WebInspector.TargetManager.Observer} 8 * @implements {WebInspector.TargetManager.Observer}
9 */ 9 */
10 WebInspector.SecurityPanel = function() 10 WebInspector.SecurityPanel = function()
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 WebInspector.VBox.call(this, true); 546 WebInspector.VBox.call(this, true);
547 this.registerRequiredCSS("security/mainView.css"); 547 this.registerRequiredCSS("security/mainView.css");
548 this.registerRequiredCSS("security/lockIcon.css"); 548 this.registerRequiredCSS("security/lockIcon.css");
549 this.setMinimumSize(200, 100); 549 this.setMinimumSize(200, 100);
550 550
551 this.contentElement.classList.add("security-main-view"); 551 this.contentElement.classList.add("security-main-view");
552 552
553 this._panel = panel; 553 this._panel = panel;
554 554
555 this._summarySection = this.contentElement.createChild("div", "security-summ ary"); 555 this._summarySection = this.contentElement.createChild("div", "security-summ ary");
556 this._securityExplanations = this.contentElement.createChild("div", "securit y-explanation-list"); 556
557 // Info explanations should appear after all others.
558 this._securityExplanationsMain = this.contentElement.createChild("div", "sec urity-explanation-list");
559 this._securityExplanationsExtra = this.contentElement.createChild("div", "se curity-explanation-list security-explanations-extra");
557 560
558 // Fill the security summary section. 561 // Fill the security summary section.
559 this._summarySection.createChild("div", "security-summary-section-title").te xtContent = WebInspector.UIString("Security Overview"); 562 this._summarySection.createChild("div", "security-summary-section-title").te xtContent = WebInspector.UIString("Security Overview");
560 563
561 var lockSpectrum = this._summarySection.createChild("div", "lock-spectrum"); 564 var lockSpectrum = this._summarySection.createChild("div", "lock-spectrum");
562 lockSpectrum.createChild("div", "lock-icon lock-icon-secure").title = WebIns pector.UIString("Secure"); 565 lockSpectrum.createChild("div", "lock-icon lock-icon-secure").title = WebIns pector.UIString("Secure");
563 lockSpectrum.createChild("div", "security-summary-lock-spacer"); 566 lockSpectrum.createChild("div", "security-summary-lock-spacer");
564 lockSpectrum.createChild("div", "lock-icon lock-icon-neutral").title = WebIn spector.UIString("Not Secure"); 567 lockSpectrum.createChild("div", "lock-icon lock-icon-neutral").title = WebIn spector.UIString("Not Secure");
565 lockSpectrum.createChild("div", "security-summary-lock-spacer"); 568 lockSpectrum.createChild("div", "security-summary-lock-spacer");
566 lockSpectrum.createChild("div", "lock-icon lock-icon-insecure").title = WebI nspector.UIString("Insecure (Broken)"); 569 lockSpectrum.createChild("div", "lock-icon lock-icon-insecure").title = WebI nspector.UIString("Insecure (Broken)");
567 570
568 this._summarySection.createChild("div", "triangle-pointer-container").create Child("div", "triangle-pointer-wrapper").createChild("div", "triangle-pointer"); 571 this._summarySection.createChild("div", "triangle-pointer-container").create Child("div", "triangle-pointer-wrapper").createChild("div", "triangle-pointer");
569 572
570 this._summaryText = this._summarySection.createChild("div", "security-summar y-text"); 573 this._summaryText = this._summarySection.createChild("div", "security-summar y-text");
571 } 574 }
572 575
573 WebInspector.SecurityMainView.prototype = { 576 WebInspector.SecurityMainView.prototype = {
574 /** 577 /**
578 * @param {!Element} parent
575 * @param {!SecurityAgent.SecurityStateExplanation} explanation 579 * @param {!SecurityAgent.SecurityStateExplanation} explanation
576 * @return {!Element} 580 * @return {!Element}
577 */ 581 */
578 _addExplanation: function(explanation) 582 _addExplanation: function(parent, explanation)
579 { 583 {
580 var explanationSection = this._securityExplanations.createChild("div", " security-explanation"); 584 var explanationSection = parent.createChild("div", "security-explanation ");
581 explanationSection.classList.add("security-explanation-" + explanation.s ecurityState); 585 explanationSection.classList.add("security-explanation-" + explanation.s ecurityState);
582 586
583 explanationSection.createChild("div", "security-property").classList.add ("security-property-" + explanation.securityState); 587 explanationSection.createChild("div", "security-property").classList.add ("security-property-" + explanation.securityState);
584 var text = explanationSection.createChild("div", "security-explanation-t ext"); 588 var text = explanationSection.createChild("div", "security-explanation-t ext");
585 text.createChild("div", "security-explanation-title").textContent = expl anation.summary; 589 text.createChild("div", "security-explanation-title").textContent = expl anation.summary;
586 text.createChild("div").textContent = explanation.description; 590 text.createChild("div").textContent = explanation.description;
587 591
588 if (explanation.certificateId) { 592 if (explanation.certificateId) {
589 text.appendChild(WebInspector.SecurityPanel.createCertificateViewerB utton(WebInspector.UIString("View certificate"), explanation.certificateId)); 593 text.appendChild(WebInspector.SecurityPanel.createCertificateViewerB utton(WebInspector.UIString("View certificate"), explanation.certificateId));
590 } 594 }
(...skipping 29 matching lines...) Expand all
620 this._schemeIsCryptographic = schemeIsCryptographic; 624 this._schemeIsCryptographic = schemeIsCryptographic;
621 625
622 this._panel.setRanInsecureContentStyle(mixedContentStatus.ranInsecureCon tentStyle); 626 this._panel.setRanInsecureContentStyle(mixedContentStatus.ranInsecureCon tentStyle);
623 this._panel.setDisplayedInsecureContentStyle(mixedContentStatus.displaye dInsecureContentStyle); 627 this._panel.setDisplayedInsecureContentStyle(mixedContentStatus.displaye dInsecureContentStyle);
624 628
625 this.refreshExplanations(); 629 this.refreshExplanations();
626 }, 630 },
627 631
628 refreshExplanations: function() 632 refreshExplanations: function()
629 { 633 {
630 this._securityExplanations.removeChildren(); 634 this._securityExplanationsMain.removeChildren();
635 this._securityExplanationsExtra.removeChildren();
631 for (var explanation of this._explanations) 636 for (var explanation of this._explanations)
632 this._addExplanation(explanation); 637 this._addExplanation(this._securityExplanationsMain, explanation);
633 638
634 this._addMixedContentExplanations(); 639 this._addMixedContentExplanations();
635 }, 640 },
636 641
637 _addMixedContentExplanations: function() 642 _addMixedContentExplanations: function()
638 { 643 {
639 if (!this._schemeIsCryptographic) 644 if (!this._schemeIsCryptographic)
640 return; 645 return;
641 646
642 if (this._mixedContentStatus && (this._mixedContentStatus.ranInsecureCon tent || this._mixedContentStatus.displayedInsecureContent)) { 647 if (this._mixedContentStatus && (this._mixedContentStatus.ranInsecureCon tent || this._mixedContentStatus.displayedInsecureContent)) {
643 if (this._mixedContentStatus.ranInsecureContent) 648 if (this._mixedContentStatus.ranInsecureContent)
644 this._addMixedContentExplanation(this._mixedContentStatus.ranIns ecureContentStyle, WebInspector.UIString("Active Mixed Content"), WebInspector.U IString("You have recently allowed insecure content (such as scripts or iframes) to run on this site."), WebInspector.NetworkLogView.MixedContentFilterValues.Bl ockOverridden, showBlockOverriddenMixedContentInNetworkPanel); 649 this._addMixedContentExplanation(this._securityExplanationsMain, this._mixedContentStatus.ranInsecureContentStyle, WebInspector.UIString("Active Mixed Content"), WebInspector.UIString("You have recently allowed insecure cont ent (such as scripts or iframes) to run on this site."), WebInspector.NetworkLog View.MixedContentFilterValues.BlockOverridden, showBlockOverriddenMixedContentIn NetworkPanel);
645 if (this._mixedContentStatus.displayedInsecureContent) 650 if (this._mixedContentStatus.displayedInsecureContent)
646 this._addMixedContentExplanation(this._mixedContentStatus.displa yedInsecureContentStyle, WebInspector.UIString("Mixed Content"), WebInspector.UI String("The site includes HTTP resources."), WebInspector.NetworkLogView.MixedCo ntentFilterValues.Displayed, showDisplayedMixedContentInNetworkPanel); 651 this._addMixedContentExplanation(this._securityExplanationsMain, this._mixedContentStatus.displayedInsecureContentStyle, WebInspector.UIString(" Mixed Content"), WebInspector.UIString("The site includes HTTP resources."), Web Inspector.NetworkLogView.MixedContentFilterValues.Displayed, showDisplayedMixedC ontentInNetworkPanel);
647 } 652 }
648 653
649 if (this._mixedContentStatus && (!this._mixedContentStatus.displayedInse cureContent && !this._mixedContentStatus.ranInsecureContent)) { 654 if (this._mixedContentStatus && (!this._mixedContentStatus.displayedInse cureContent && !this._mixedContentStatus.ranInsecureContent)) {
650 this._addExplanation(/** @type {!SecurityAgent.SecurityStateExplanat ion} */ ({ 655 this._addExplanation(this._securityExplanationsMain, /** @type {!Sec urityAgent.SecurityStateExplanation} */ ({
651 "securityState": SecurityAgent.SecurityState.Secure, 656 "securityState": SecurityAgent.SecurityState.Secure,
652 "summary": WebInspector.UIString("Secure Resources"), 657 "summary": WebInspector.UIString("Secure Resources"),
653 "description": WebInspector.UIString("All resources on this page are served securely.") 658 "description": WebInspector.UIString("All resources on this page are served securely.")
654 })); 659 }));
655 } 660 }
656 661
657 if (this._panel.filterRequestCount(WebInspector.NetworkLogView.MixedCont entFilterValues.Blocked) > 0) 662 if (this._panel.filterRequestCount(WebInspector.NetworkLogView.MixedCont entFilterValues.Blocked) > 0)
658 this._addMixedContentExplanation(SecurityAgent.SecurityState.Info, W ebInspector.UIString("Blocked mixed content"), WebInspector.UIString("Your page requested insecure resources that were blocked."), WebInspector.NetworkLogView.M ixedContentFilterValues.Blocked, showBlockedMixedContentInNetworkPanel); 663 this._addMixedContentExplanation(this._securityExplanationsExtra, Se curityAgent.SecurityState.Info, WebInspector.UIString("Blocked mixed content"), WebInspector.UIString("Your page requested insecure resources that were blocked. "), WebInspector.NetworkLogView.MixedContentFilterValues.Blocked, showBlockedMix edContentInNetworkPanel);
659 664
660 /** 665 /**
661 * @param {!Event} e 666 * @param {!Event} e
662 */ 667 */
663 function showDisplayedMixedContentInNetworkPanel(e) 668 function showDisplayedMixedContentInNetworkPanel(e)
664 { 669 {
665 e.consume(); 670 e.consume();
666 WebInspector.NetworkPanel.revealAndFilter([ 671 WebInspector.NetworkPanel.revealAndFilter([
667 { 672 {
668 filterType: WebInspector.NetworkLogView.FilterType.MixedCont ent, 673 filterType: WebInspector.NetworkLogView.FilterType.MixedCont ent,
(...skipping 25 matching lines...) Expand all
694 WebInspector.NetworkPanel.revealAndFilter([ 699 WebInspector.NetworkPanel.revealAndFilter([
695 { 700 {
696 filterType: WebInspector.NetworkLogView.FilterType.MixedCont ent, 701 filterType: WebInspector.NetworkLogView.FilterType.MixedCont ent,
697 filterValue: WebInspector.NetworkLogView.MixedContentFilterV alues.Blocked 702 filterValue: WebInspector.NetworkLogView.MixedContentFilterV alues.Blocked
698 } 703 }
699 ]); 704 ]);
700 } 705 }
701 }, 706 },
702 707
703 /** 708 /**
709 * @param {!Element} parent
704 * @param {!SecurityAgent.SecurityState} securityState 710 * @param {!SecurityAgent.SecurityState} securityState
705 * @param {string} summary 711 * @param {string} summary
706 * @param {string} description 712 * @param {string} description
707 * @param {!WebInspector.NetworkLogView.MixedContentFilterValues} filterKey 713 * @param {!WebInspector.NetworkLogView.MixedContentFilterValues} filterKey
708 * @param {!Function} networkFilterFn 714 * @param {!Function} networkFilterFn
709 */ 715 */
710 _addMixedContentExplanation: function(securityState, summary, description, f ilterKey, networkFilterFn) 716 _addMixedContentExplanation: function(parent, securityState, summary, descri ption, filterKey, networkFilterFn)
711 { 717 {
712 var mixedContentExplanation = /** @type {!SecurityAgent.SecurityStateExp lanation} */ ({ 718 var mixedContentExplanation = /** @type {!SecurityAgent.SecurityStateExp lanation} */ ({
713 "securityState": securityState, 719 "securityState": securityState,
714 "summary": summary, 720 "summary": summary,
715 "description": description 721 "description": description
716 }); 722 });
717 723
718 var filterRequestCount = this._panel.filterRequestCount(filterKey); 724 var filterRequestCount = this._panel.filterRequestCount(filterKey);
719 var requestsAnchor = this._addExplanation(mixedContentExplanation).creat eChild("div", "security-mixed-content link"); 725 var requestsAnchor = this._addExplanation(parent, mixedContentExplanatio n).createChild("div", "security-mixed-content link");
720 if (filterRequestCount > 0) { 726 if (filterRequestCount > 0) {
721 requestsAnchor.textContent = WebInspector.UIString("View %d request% s in Network Panel", filterRequestCount, (filterRequestCount > 1 ? "s" : "")); 727 requestsAnchor.textContent = WebInspector.UIString("View %d request% s in Network Panel", filterRequestCount, (filterRequestCount > 1 ? "s" : ""));
722 } else { 728 } else {
723 // Network instrumentation might not have been enabled for the page load, so the security panel does not necessarily know a count of individual mixe d requests at this point. Point the user at the Network Panel which prompts them to refresh. 729 // Network instrumentation might not have been enabled for the page load, so the security panel does not necessarily know a count of individual mixe d requests at this point. Point the user at the Network Panel which prompts them to refresh.
724 requestsAnchor.textContent = WebInspector.UIString("View requests in Network Panel"); 730 requestsAnchor.textContent = WebInspector.UIString("View requests in Network Panel");
725 } 731 }
726 requestsAnchor.href = ""; 732 requestsAnchor.href = "";
727 requestsAnchor.addEventListener("click", networkFilterFn); 733 requestsAnchor.addEventListener("click", networkFilterFn);
728 }, 734 },
729 735
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 row.createChild("div").textContent = key; 942 row.createChild("div").textContent = key;
937 943
938 var valueDiv = row.createChild("div"); 944 var valueDiv = row.createChild("div");
939 if (typeof value === "string") { 945 if (typeof value === "string") {
940 valueDiv.textContent = value; 946 valueDiv.textContent = value;
941 } else { 947 } else {
942 valueDiv.appendChild(value); 948 valueDiv.appendChild(value);
943 } 949 }
944 } 950 }
945 } 951 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698