OLD | NEW |
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 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 WebInspector.VBox.call(this, true); | 540 WebInspector.VBox.call(this, true); |
541 this.registerRequiredCSS("security/mainView.css"); | 541 this.registerRequiredCSS("security/mainView.css"); |
542 this.registerRequiredCSS("security/lockIcon.css"); | 542 this.registerRequiredCSS("security/lockIcon.css"); |
543 this.setMinimumSize(200, 100); | 543 this.setMinimumSize(200, 100); |
544 | 544 |
545 this.contentElement.classList.add("security-main-view"); | 545 this.contentElement.classList.add("security-main-view"); |
546 | 546 |
547 this._panel = panel; | 547 this._panel = panel; |
548 | 548 |
549 this._summarySection = this.contentElement.createChild("div", "security-summ
ary"); | 549 this._summarySection = this.contentElement.createChild("div", "security-summ
ary"); |
550 this._securityExplanations = this.contentElement.createChild("div", "securit
y-explanation-list"); | 550 |
| 551 // Info explanations should appear after all others. |
| 552 this._securityExplanationsMain = this.contentElement.createChild("div", "sec
urity-explanation-list"); |
| 553 this._securityExplanationsExtra = this.contentElement.createChild("div", "se
curity-explanation-list security-explanations-extra"); |
551 | 554 |
552 // Fill the security summary section. | 555 // Fill the security summary section. |
553 this._summarySection.createChild("div", "security-summary-section-title").te
xtContent = WebInspector.UIString("Security Overview"); | 556 this._summarySection.createChild("div", "security-summary-section-title").te
xtContent = WebInspector.UIString("Security Overview"); |
554 | 557 |
555 var lockSpectrum = this._summarySection.createChild("div", "lock-spectrum"); | 558 var lockSpectrum = this._summarySection.createChild("div", "lock-spectrum"); |
556 lockSpectrum.createChild("div", "lock-icon lock-icon-secure").title = WebIns
pector.UIString("Secure"); | 559 lockSpectrum.createChild("div", "lock-icon lock-icon-secure").title = WebIns
pector.UIString("Secure"); |
557 lockSpectrum.createChild("div", "security-summary-lock-spacer"); | 560 lockSpectrum.createChild("div", "security-summary-lock-spacer"); |
558 lockSpectrum.createChild("div", "lock-icon lock-icon-neutral").title = WebIn
spector.UIString("Not Secure"); | 561 lockSpectrum.createChild("div", "lock-icon lock-icon-neutral").title = WebIn
spector.UIString("Not Secure"); |
559 lockSpectrum.createChild("div", "security-summary-lock-spacer"); | 562 lockSpectrum.createChild("div", "security-summary-lock-spacer"); |
560 lockSpectrum.createChild("div", "lock-icon lock-icon-insecure").title = WebI
nspector.UIString("Insecure (Broken)"); | 563 lockSpectrum.createChild("div", "lock-icon lock-icon-insecure").title = WebI
nspector.UIString("Insecure (Broken)"); |
561 | 564 |
562 this._summarySection.createChild("div", "triangle-pointer-container").create
Child("div", "triangle-pointer-wrapper").createChild("div", "triangle-pointer"); | 565 this._summarySection.createChild("div", "triangle-pointer-container").create
Child("div", "triangle-pointer-wrapper").createChild("div", "triangle-pointer"); |
563 | 566 |
564 this._summaryText = this._summarySection.createChild("div", "security-summar
y-text"); | 567 this._summaryText = this._summarySection.createChild("div", "security-summar
y-text"); |
565 } | 568 } |
566 | 569 |
567 WebInspector.SecurityMainView.prototype = { | 570 WebInspector.SecurityMainView.prototype = { |
568 /** | 571 /** |
| 572 * @param {!Element} parent |
569 * @param {!SecurityAgent.SecurityStateExplanation} explanation | 573 * @param {!SecurityAgent.SecurityStateExplanation} explanation |
570 * @return {!Element} | 574 * @return {!Element} |
571 */ | 575 */ |
572 _addExplanation: function(explanation) | 576 _addExplanation: function(parent, explanation) |
573 { | 577 { |
574 var explanationSection = this._securityExplanations.createChild("div", "
security-explanation"); | 578 var explanationSection = parent.createChild("div", "security-explanation
"); |
575 explanationSection.classList.add("security-explanation-" + explanation.s
ecurityState); | 579 explanationSection.classList.add("security-explanation-" + explanation.s
ecurityState); |
576 | 580 |
577 explanationSection.createChild("div", "security-property").classList.add
("security-property-" + explanation.securityState); | 581 explanationSection.createChild("div", "security-property").classList.add
("security-property-" + explanation.securityState); |
578 var text = explanationSection.createChild("div", "security-explanation-t
ext"); | 582 var text = explanationSection.createChild("div", "security-explanation-t
ext"); |
579 text.createChild("div", "security-explanation-title").textContent = expl
anation.summary; | 583 text.createChild("div", "security-explanation-title").textContent = expl
anation.summary; |
580 text.createChild("div").textContent = explanation.description; | 584 text.createChild("div").textContent = explanation.description; |
581 | 585 |
582 if (explanation.certificateId) { | 586 if (explanation.certificateId) { |
583 text.appendChild(WebInspector.SecurityPanel.createCertificateViewerB
utton(WebInspector.UIString("View certificate"), explanation.certificateId)); | 587 text.appendChild(WebInspector.SecurityPanel.createCertificateViewerB
utton(WebInspector.UIString("View certificate"), explanation.certificateId)); |
584 } | 588 } |
(...skipping 29 matching lines...) Expand all Loading... |
614 this._schemeIsCryptographic = schemeIsCryptographic; | 618 this._schemeIsCryptographic = schemeIsCryptographic; |
615 | 619 |
616 this._panel.setRanInsecureContentStyle(mixedContentStatus.ranInsecureCon
tentStyle); | 620 this._panel.setRanInsecureContentStyle(mixedContentStatus.ranInsecureCon
tentStyle); |
617 this._panel.setDisplayedInsecureContentStyle(mixedContentStatus.displaye
dInsecureContentStyle); | 621 this._panel.setDisplayedInsecureContentStyle(mixedContentStatus.displaye
dInsecureContentStyle); |
618 | 622 |
619 this.refreshExplanations(); | 623 this.refreshExplanations(); |
620 }, | 624 }, |
621 | 625 |
622 refreshExplanations: function() | 626 refreshExplanations: function() |
623 { | 627 { |
624 this._securityExplanations.removeChildren(); | 628 this._securityExplanationsMain.removeChildren(); |
| 629 this._securityExplanationsExtra.removeChildren(); |
625 for (var explanation of this._explanations) | 630 for (var explanation of this._explanations) |
626 this._addExplanation(explanation); | 631 this._addExplanation(this._securityExplanationsMain, explanation); |
627 | 632 |
628 this._addMixedContentExplanations(); | 633 this._addMixedContentExplanations(); |
629 }, | 634 }, |
630 | 635 |
631 _addMixedContentExplanations: function() | 636 _addMixedContentExplanations: function() |
632 { | 637 { |
633 if (!this._schemeIsCryptographic) | 638 if (!this._schemeIsCryptographic) |
634 return; | 639 return; |
635 | 640 |
636 if (this._mixedContentStatus && (this._mixedContentStatus.ranInsecureCon
tent || this._mixedContentStatus.displayedInsecureContent)) { | 641 if (this._mixedContentStatus && (this._mixedContentStatus.ranInsecureCon
tent || this._mixedContentStatus.displayedInsecureContent)) { |
637 if (this._mixedContentStatus.ranInsecureContent) | 642 if (this._mixedContentStatus.ranInsecureContent) |
638 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); | 643 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); |
639 if (this._mixedContentStatus.displayedInsecureContent) | 644 if (this._mixedContentStatus.displayedInsecureContent) |
640 this._addMixedContentExplanation(this._mixedContentStatus.displa
yedInsecureContentStyle, WebInspector.UIString("Mixed Content"), WebInspector.UI
String("The site includes HTTP resources."), WebInspector.NetworkLogView.MixedCo
ntentFilterValues.Displayed, showDisplayedMixedContentInNetworkPanel); | 645 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); |
641 } | 646 } |
642 | 647 |
643 if (this._mixedContentStatus && (!this._mixedContentStatus.displayedInse
cureContent && !this._mixedContentStatus.ranInsecureContent)) { | 648 if (this._mixedContentStatus && (!this._mixedContentStatus.displayedInse
cureContent && !this._mixedContentStatus.ranInsecureContent)) { |
644 this._addExplanation(/** @type {!SecurityAgent.SecurityStateExpl
anation} */ ({ | 649 this._addExplanation(this._securityExplanationsMain, /** @type {
!SecurityAgent.SecurityStateExplanation} */ ({ |
645 "securityState": SecurityAgent.SecurityState.Secure, | 650 "securityState": SecurityAgent.SecurityState.Secure, |
646 "summary": WebInspector.UIString("Secure Resources"), | 651 "summary": WebInspector.UIString("Secure Resources"), |
647 "description": WebInspector.UIString("All resources on this
page are served securely.") | 652 "description": WebInspector.UIString("All resources on this
page are served securely.") |
648 })); | 653 })); |
649 } | 654 } |
650 | 655 |
651 if (this._panel.filterRequestCount(WebInspector.NetworkLogView.MixedCont
entFilterValues.Blocked) > 0) | 656 if (this._panel.filterRequestCount(WebInspector.NetworkLogView.MixedCont
entFilterValues.Blocked) > 0) |
652 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); | 657 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); |
653 | 658 |
654 /** | 659 /** |
655 * @param {!Event} e | 660 * @param {!Event} e |
656 */ | 661 */ |
657 function showDisplayedMixedContentInNetworkPanel(e) | 662 function showDisplayedMixedContentInNetworkPanel(e) |
658 { | 663 { |
659 e.consume(); | 664 e.consume(); |
660 WebInspector.NetworkPanel.revealAndFilter([ | 665 WebInspector.NetworkPanel.revealAndFilter([ |
661 { | 666 { |
662 filterType: WebInspector.NetworkLogView.FilterType.MixedCont
ent, | 667 filterType: WebInspector.NetworkLogView.FilterType.MixedCont
ent, |
(...skipping 25 matching lines...) Expand all Loading... |
688 WebInspector.NetworkPanel.revealAndFilter([ | 693 WebInspector.NetworkPanel.revealAndFilter([ |
689 { | 694 { |
690 filterType: WebInspector.NetworkLogView.FilterType.MixedCont
ent, | 695 filterType: WebInspector.NetworkLogView.FilterType.MixedCont
ent, |
691 filterValue: WebInspector.NetworkLogView.MixedContentFilterV
alues.Blocked | 696 filterValue: WebInspector.NetworkLogView.MixedContentFilterV
alues.Blocked |
692 } | 697 } |
693 ]); | 698 ]); |
694 } | 699 } |
695 }, | 700 }, |
696 | 701 |
697 /** | 702 /** |
| 703 * @param {!Element} parent |
698 * @param {!SecurityAgent.SecurityState} securityState | 704 * @param {!SecurityAgent.SecurityState} securityState |
699 * @param {string} summary | 705 * @param {string} summary |
700 * @param {string} description | 706 * @param {string} description |
701 * @param {!WebInspector.NetworkLogView.MixedContentFilterValues} filterKey | 707 * @param {!WebInspector.NetworkLogView.MixedContentFilterValues} filterKey |
702 * @param {!Function} networkFilterFn | 708 * @param {!Function} networkFilterFn |
703 */ | 709 */ |
704 _addMixedContentExplanation: function(securityState, summary, description, f
ilterKey, networkFilterFn) | 710 _addMixedContentExplanation: function(parent, securityState, summary, descri
ption, filterKey, networkFilterFn) |
705 { | 711 { |
706 var mixedContentExplanation = /** @type {!SecurityAgent.SecurityStateExp
lanation} */ ({ | 712 var mixedContentExplanation = /** @type {!SecurityAgent.SecurityStateExp
lanation} */ ({ |
707 "securityState": securityState, | 713 "securityState": securityState, |
708 "summary": summary, | 714 "summary": summary, |
709 "description": description | 715 "description": description |
710 }); | 716 }); |
711 | 717 |
712 var filterRequestCount = this._panel.filterRequestCount(filterKey); | 718 var filterRequestCount = this._panel.filterRequestCount(filterKey); |
713 var requestsAnchor = this._addExplanation(mixedContentExplanation).creat
eChild("div", "security-mixed-content link"); | 719 var requestsAnchor = this._addExplanation(parent, mixedContentExplanatio
n).createChild("div", "security-mixed-content link"); |
714 if (filterRequestCount > 0) { | 720 if (filterRequestCount > 0) { |
715 requestsAnchor.textContent = WebInspector.UIString("View %d request%
s in Network Panel", filterRequestCount, (filterRequestCount > 1 ? "s" : "")); | 721 requestsAnchor.textContent = WebInspector.UIString("View %d request%
s in Network Panel", filterRequestCount, (filterRequestCount > 1 ? "s" : "")); |
716 } else { | 722 } else { |
717 // 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. | 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. |
718 requestsAnchor.textContent = WebInspector.UIString("View requests in
Network Panel"); | 724 requestsAnchor.textContent = WebInspector.UIString("View requests in
Network Panel"); |
719 } | 725 } |
720 requestsAnchor.href = ""; | 726 requestsAnchor.href = ""; |
721 requestsAnchor.addEventListener("click", networkFilterFn); | 727 requestsAnchor.addEventListener("click", networkFilterFn); |
722 }, | 728 }, |
723 | 729 |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 row.createChild("div").textContent = key; | 937 row.createChild("div").textContent = key; |
932 | 938 |
933 var valueDiv = row.createChild("div"); | 939 var valueDiv = row.createChild("div"); |
934 if (typeof value === "string") { | 940 if (typeof value === "string") { |
935 valueDiv.textContent = value; | 941 valueDiv.textContent = value; |
936 } else { | 942 } else { |
937 valueDiv.appendChild(value); | 943 valueDiv.appendChild(value); |
938 } | 944 } |
939 } | 945 } |
940 } | 946 } |
OLD | NEW |