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 console.log(parent); |
estark
2016/04/18 11:46:45
remove
lgarron
2016/04/25 23:56:54
Done.
| |
579 var explanationSection = parent.createChild("div", "security-explanation "); | |
575 explanationSection.classList.add("security-explanation-" + explanation.s ecurityState); | 580 explanationSection.classList.add("security-explanation-" + explanation.s ecurityState); |
576 | 581 |
577 explanationSection.createChild("div", "security-property").classList.add ("security-property-" + explanation.securityState); | 582 explanationSection.createChild("div", "security-property").classList.add ("security-property-" + explanation.securityState); |
578 var text = explanationSection.createChild("div", "security-explanation-t ext"); | 583 var text = explanationSection.createChild("div", "security-explanation-t ext"); |
579 text.createChild("div", "security-explanation-title").textContent = expl anation.summary; | 584 text.createChild("div", "security-explanation-title").textContent = expl anation.summary; |
580 text.createChild("div").textContent = explanation.description; | 585 text.createChild("div").textContent = explanation.description; |
581 | 586 |
582 if (explanation.certificateId) { | 587 if (explanation.certificateId) { |
583 text.appendChild(WebInspector.SecurityPanel.createCertificateViewerB utton(WebInspector.UIString("View certificate"), explanation.certificateId)); | 588 text.appendChild(WebInspector.SecurityPanel.createCertificateViewerB utton(WebInspector.UIString("View certificate"), explanation.certificateId)); |
584 } | 589 } |
(...skipping 29 matching lines...) Expand all Loading... | |
614 this._schemeIsCryptographic = schemeIsCryptographic; | 619 this._schemeIsCryptographic = schemeIsCryptographic; |
615 | 620 |
616 this._panel.setRanInsecureContentStyle(mixedContentStatus.ranInsecureCon tentStyle); | 621 this._panel.setRanInsecureContentStyle(mixedContentStatus.ranInsecureCon tentStyle); |
617 this._panel.setDisplayedInsecureContentStyle(mixedContentStatus.displaye dInsecureContentStyle); | 622 this._panel.setDisplayedInsecureContentStyle(mixedContentStatus.displaye dInsecureContentStyle); |
618 | 623 |
619 this.refreshExplanations(); | 624 this.refreshExplanations(); |
620 }, | 625 }, |
621 | 626 |
622 refreshExplanations: function () | 627 refreshExplanations: function () |
623 { | 628 { |
624 this._securityExplanations.removeChildren(); | 629 this._securityExplanationsMain.removeChildren(); |
630 this._securityExplanationsExtra.removeChildren(); | |
625 for (var explanation of this._explanations) | 631 for (var explanation of this._explanations) |
626 this._addExplanation(explanation); | 632 this._addExplanation(this._securityExplanationsMain, explanation); |
627 | 633 |
628 this._addMixedContentExplanations(); | 634 this._addMixedContentExplanations(); |
629 }, | 635 }, |
630 | 636 |
631 _addMixedContentExplanations: function () | 637 _addMixedContentExplanations: function () |
632 { | 638 { |
633 if (!this._schemeIsCryptographic) | 639 if (!this._schemeIsCryptographic) |
634 return; | 640 return; |
635 | 641 |
636 if (this._mixedContentStatus && (this._mixedContentStatus.ranInsecureCon tent || this._mixedContentStatus.displayedInsecureContent)) { | 642 if (this._mixedContentStatus && (this._mixedContentStatus.ranInsecureCon tent || this._mixedContentStatus.displayedInsecureContent)) { |
637 if (this._mixedContentStatus.ranInsecureContent) | 643 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); | 644 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) | 645 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); | 646 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 } | 647 } |
642 | 648 |
643 if (this._mixedContentStatus && (!this._mixedContentStatus.displayedInse cureContent && !this._mixedContentStatus.ranInsecureContent)) { | 649 if (this._mixedContentStatus && (!this._mixedContentStatus.displayedInse cureContent && !this._mixedContentStatus.ranInsecureContent)) { |
644 this._addExplanation(/** @type {!SecurityAgent.SecurityStateExpl anation} */ ({ | 650 this._addExplanation(this._securityExplanationsMain, /** @type { !SecurityAgent.SecurityStateExplanation} */ ({ |
645 "securityState": SecurityAgent.SecurityState.Secure, | 651 "securityState": SecurityAgent.SecurityState.Secure, |
646 "summary": WebInspector.UIString("Secure Resources"), | 652 "summary": WebInspector.UIString("Secure Resources"), |
647 "description": WebInspector.UIString("All resources on this page are served securely.") | 653 "description": WebInspector.UIString("All resources on this page are served securely.") |
648 })); | 654 })); |
649 } | 655 } |
650 | 656 |
651 if (this._panel.filterRequestCount(WebInspector.NetworkLogView.MixedCont entFilterValues.Blocked) > 0) | 657 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); | 658 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 | 659 |
654 /** | 660 /** |
655 * @param {!Event} e | 661 * @param {!Event} e |
656 */ | 662 */ |
657 function showDisplayedMixedContentInNetworkPanel(e) | 663 function showDisplayedMixedContentInNetworkPanel(e) |
658 { | 664 { |
659 e.consume(); | 665 e.consume(); |
660 WebInspector.NetworkPanel.revealAndFilter([ | 666 WebInspector.NetworkPanel.revealAndFilter([ |
661 { | 667 { |
662 filterType: WebInspector.NetworkLogView.FilterType.MixedCont ent, | 668 filterType: WebInspector.NetworkLogView.FilterType.MixedCont ent, |
(...skipping 25 matching lines...) Expand all Loading... | |
688 WebInspector.NetworkPanel.revealAndFilter([ | 694 WebInspector.NetworkPanel.revealAndFilter([ |
689 { | 695 { |
690 filterType: WebInspector.NetworkLogView.FilterType.MixedCont ent, | 696 filterType: WebInspector.NetworkLogView.FilterType.MixedCont ent, |
691 filterValue: WebInspector.NetworkLogView.MixedContentFilterV alues.Blocked | 697 filterValue: WebInspector.NetworkLogView.MixedContentFilterV alues.Blocked |
692 } | 698 } |
693 ]); | 699 ]); |
694 } | 700 } |
695 }, | 701 }, |
696 | 702 |
697 /** | 703 /** |
704 * @param {!Element} parent | |
698 * @param {!SecurityAgent.SecurityState} securityState | 705 * @param {!SecurityAgent.SecurityState} securityState |
699 * @param {string} summary | 706 * @param {string} summary |
700 * @param {string} description | 707 * @param {string} description |
701 * @param {!WebInspector.NetworkLogView.MixedContentFilterValues} filterKey | 708 * @param {!WebInspector.NetworkLogView.MixedContentFilterValues} filterKey |
702 * @param {!Function} networkFilterFn | 709 * @param {!Function} networkFilterFn |
703 */ | 710 */ |
704 _addMixedContentExplanation: function(securityState, summary, description, f ilterKey, networkFilterFn) | 711 _addMixedContentExplanation: function(parent, securityState, summary, descri ption, filterKey, networkFilterFn) |
705 { | 712 { |
706 var mixedContentExplanation = /** @type {!SecurityAgent.SecurityStateExp lanation} */ ({ | 713 var mixedContentExplanation = /** @type {!SecurityAgent.SecurityStateExp lanation} */ ({ |
707 "securityState": securityState, | 714 "securityState": securityState, |
708 "summary": summary, | 715 "summary": summary, |
709 "description": description | 716 "description": description |
710 }); | 717 }); |
711 | 718 |
712 var filterRequestCount = this._panel.filterRequestCount(filterKey); | 719 var filterRequestCount = this._panel.filterRequestCount(filterKey); |
713 var requestsAnchor = this._addExplanation(mixedContentExplanation).creat eChild("div", "security-mixed-content link"); | 720 var requestsAnchor = this._addExplanation(parent, mixedContentExplanatio n).createChild("div", "security-mixed-content link"); |
714 if (filterRequestCount > 0) { | 721 if (filterRequestCount > 0) { |
715 requestsAnchor.textContent = WebInspector.UIString("View %d request% s in Network Panel", filterRequestCount, (filterRequestCount > 1 ? "s" : "")); | 722 requestsAnchor.textContent = WebInspector.UIString("View %d request% s in Network Panel", filterRequestCount, (filterRequestCount > 1 ? "s" : "")); |
716 } else { | 723 } 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. | 724 // 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"); | 725 requestsAnchor.textContent = WebInspector.UIString("View requests in Network Panel"); |
719 } | 726 } |
720 requestsAnchor.href = ""; | 727 requestsAnchor.href = ""; |
721 requestsAnchor.addEventListener("click", networkFilterFn); | 728 requestsAnchor.addEventListener("click", networkFilterFn); |
722 }, | 729 }, |
723 | 730 |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
931 row.createChild("div").textContent = key; | 938 row.createChild("div").textContent = key; |
932 | 939 |
933 var valueDiv = row.createChild("div"); | 940 var valueDiv = row.createChild("div"); |
934 if (typeof value === "string") { | 941 if (typeof value === "string") { |
935 valueDiv.textContent = value; | 942 valueDiv.textContent = value; |
936 } else { | 943 } else { |
937 valueDiv.appendChild(value); | 944 valueDiv.appendChild(value); |
938 } | 945 } |
939 } | 946 } |
940 } | 947 } |
OLD | NEW |