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 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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(); |
631 for (var explanation of this._explanations) | 635 this._securityExplanationsExtra.removeChildren(); |
632 this._addExplanation(explanation); | 636 for (var explanation of this._explanations) { |
| 637 if (explanation.securityState === SecurityAgent.SecurityState.Info)
{ |
| 638 this._addExplanation(this._securityExplanationsExtra, explanatio
n); |
| 639 } else { |
| 640 this._addExplanation(this._securityExplanationsMain, explanation
); |
| 641 } |
| 642 } |
633 | 643 |
634 this._addMixedContentExplanations(); | 644 this._addMixedContentExplanations(); |
635 }, | 645 }, |
636 | 646 |
637 _addMixedContentExplanations: function() | 647 _addMixedContentExplanations: function() |
638 { | 648 { |
639 if (!this._schemeIsCryptographic) | 649 if (!this._schemeIsCryptographic) |
640 return; | 650 return; |
641 | 651 |
642 if (this._mixedContentStatus && (this._mixedContentStatus.ranInsecureCon
tent || this._mixedContentStatus.displayedInsecureContent)) { | 652 if (this._mixedContentStatus && (this._mixedContentStatus.ranInsecureCon
tent || this._mixedContentStatus.displayedInsecureContent)) { |
643 if (this._mixedContentStatus.ranInsecureContent) | 653 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); | 654 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) | 655 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); | 656 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 } | 657 } |
648 | 658 |
649 if (this._mixedContentStatus && (!this._mixedContentStatus.displayedInse
cureContent && !this._mixedContentStatus.ranInsecureContent)) { | 659 if (this._mixedContentStatus && (!this._mixedContentStatus.displayedInse
cureContent && !this._mixedContentStatus.ranInsecureContent)) { |
650 this._addExplanation(/** @type {!SecurityAgent.SecurityStateExplanat
ion} */ ({ | 660 this._addExplanation(this._securityExplanationsMain, /** @type {!Sec
urityAgent.SecurityStateExplanation} */ ({ |
651 "securityState": SecurityAgent.SecurityState.Secure, | 661 "securityState": SecurityAgent.SecurityState.Secure, |
652 "summary": WebInspector.UIString("Secure Resources"), | 662 "summary": WebInspector.UIString("Secure Resources"), |
653 "description": WebInspector.UIString("All resources on this page
are served securely.") | 663 "description": WebInspector.UIString("All resources on this page
are served securely.") |
654 })); | 664 })); |
655 } | 665 } |
656 | 666 |
657 if (this._panel.filterRequestCount(WebInspector.NetworkLogView.MixedCont
entFilterValues.Blocked) > 0) | 667 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); | 668 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 | 669 |
660 /** | 670 /** |
661 * @param {!Event} e | 671 * @param {!Event} e |
662 */ | 672 */ |
663 function showDisplayedMixedContentInNetworkPanel(e) | 673 function showDisplayedMixedContentInNetworkPanel(e) |
664 { | 674 { |
665 e.consume(); | 675 e.consume(); |
666 WebInspector.NetworkPanel.revealAndFilter([ | 676 WebInspector.NetworkPanel.revealAndFilter([ |
667 { | 677 { |
668 filterType: WebInspector.NetworkLogView.FilterType.MixedCont
ent, | 678 filterType: WebInspector.NetworkLogView.FilterType.MixedCont
ent, |
(...skipping 25 matching lines...) Expand all Loading... |
694 WebInspector.NetworkPanel.revealAndFilter([ | 704 WebInspector.NetworkPanel.revealAndFilter([ |
695 { | 705 { |
696 filterType: WebInspector.NetworkLogView.FilterType.MixedCont
ent, | 706 filterType: WebInspector.NetworkLogView.FilterType.MixedCont
ent, |
697 filterValue: WebInspector.NetworkLogView.MixedContentFilterV
alues.Blocked | 707 filterValue: WebInspector.NetworkLogView.MixedContentFilterV
alues.Blocked |
698 } | 708 } |
699 ]); | 709 ]); |
700 } | 710 } |
701 }, | 711 }, |
702 | 712 |
703 /** | 713 /** |
| 714 * @param {!Element} parent |
704 * @param {!SecurityAgent.SecurityState} securityState | 715 * @param {!SecurityAgent.SecurityState} securityState |
705 * @param {string} summary | 716 * @param {string} summary |
706 * @param {string} description | 717 * @param {string} description |
707 * @param {!WebInspector.NetworkLogView.MixedContentFilterValues} filterKey | 718 * @param {!WebInspector.NetworkLogView.MixedContentFilterValues} filterKey |
708 * @param {!Function} networkFilterFn | 719 * @param {!Function} networkFilterFn |
709 */ | 720 */ |
710 _addMixedContentExplanation: function(securityState, summary, description, f
ilterKey, networkFilterFn) | 721 _addMixedContentExplanation: function(parent, securityState, summary, descri
ption, filterKey, networkFilterFn) |
711 { | 722 { |
712 var mixedContentExplanation = /** @type {!SecurityAgent.SecurityStateExp
lanation} */ ({ | 723 var mixedContentExplanation = /** @type {!SecurityAgent.SecurityStateExp
lanation} */ ({ |
713 "securityState": securityState, | 724 "securityState": securityState, |
714 "summary": summary, | 725 "summary": summary, |
715 "description": description | 726 "description": description |
716 }); | 727 }); |
717 | 728 |
718 var filterRequestCount = this._panel.filterRequestCount(filterKey); | 729 var filterRequestCount = this._panel.filterRequestCount(filterKey); |
719 var requestsAnchor = this._addExplanation(mixedContentExplanation).creat
eChild("div", "security-mixed-content link"); | 730 var requestsAnchor = this._addExplanation(parent, mixedContentExplanatio
n).createChild("div", "security-mixed-content link"); |
720 if (filterRequestCount > 0) { | 731 if (filterRequestCount > 0) { |
721 requestsAnchor.textContent = WebInspector.UIString("View %d request%
s in Network Panel", filterRequestCount, (filterRequestCount > 1 ? "s" : "")); | 732 requestsAnchor.textContent = WebInspector.UIString("View %d request%
s in Network Panel", filterRequestCount, (filterRequestCount > 1 ? "s" : "")); |
722 } else { | 733 } 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. | 734 // 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"); | 735 requestsAnchor.textContent = WebInspector.UIString("View requests in
Network Panel"); |
725 } | 736 } |
726 requestsAnchor.href = ""; | 737 requestsAnchor.href = ""; |
727 requestsAnchor.addEventListener("click", networkFilterFn); | 738 requestsAnchor.addEventListener("click", networkFilterFn); |
728 }, | 739 }, |
729 | 740 |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
989 row.createChild("div").textContent = key; | 1000 row.createChild("div").textContent = key; |
990 | 1001 |
991 var valueDiv = row.createChild("div"); | 1002 var valueDiv = row.createChild("div"); |
992 if (typeof value === "string") { | 1003 if (typeof value === "string") { |
993 valueDiv.textContent = value; | 1004 valueDiv.textContent = value; |
994 } else { | 1005 } else { |
995 valueDiv.appendChild(value); | 1006 valueDiv.appendChild(value); |
996 } | 1007 } |
997 } | 1008 } |
998 } | 1009 } |
OLD | NEW |