 Chromium Code Reviews
 Chromium Code Reviews Issue 1383503003:
  [DevTools] Show a explanation when all resources in the page have been requested securely (no-mixed…  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 1383503003:
  [DevTools] Show a explanation when all resources in the page have been requested securely (no-mixed…  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| 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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 583 if (!this._schemeIsCryptographic) | 583 if (!this._schemeIsCryptographic) | 
| 584 return; | 584 return; | 
| 585 | 585 | 
| 586 if (this._mixedContentStatus && (this._mixedContentStatus.ranInsecureCon tent || this._mixedContentStatus.displayedInsecureContent)) { | 586 if (this._mixedContentStatus && (this._mixedContentStatus.ranInsecureCon tent || this._mixedContentStatus.displayedInsecureContent)) { | 
| 587 if (this._mixedContentStatus.ranInsecureContent) | 587 if (this._mixedContentStatus.ranInsecureContent) | 
| 588 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); | 588 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); | 
| 589 if (this._mixedContentStatus.displayedInsecureContent) | 589 if (this._mixedContentStatus.displayedInsecureContent) | 
| 590 this._addMixedContentExplanation(this._mixedContentStatus.displa yedInsecureContentStyle, WebInspector.UIString("Mixed Content"), WebInspector.UI String("The site includes HTTP resources."), WebInspector.NetworkLogView.MixedCo ntentFilterValues.Displayed, showDisplayedMixedContentInNetworkPanel); | 590 this._addMixedContentExplanation(this._mixedContentStatus.displa yedInsecureContentStyle, WebInspector.UIString("Mixed Content"), WebInspector.UI String("The site includes HTTP resources."), WebInspector.NetworkLogView.MixedCo ntentFilterValues.Displayed, showDisplayedMixedContentInNetworkPanel); | 
| 591 } | 591 } | 
| 592 | 592 | 
| 593 if (this._mixedContentStatus && (!this._mixedContentStatus.displayedInse cureContent && !this._mixedContentStatus.ranInsecureContent)) { | |
| 594 this._addExplanation(/** @type {!SecurityAgent.SecurityStateExpl anation} */ ({ | |
| 595 "securityState": SecurityAgent.SecurityState.Secure, | |
| 596 "summary": WebInspector.UIString("Secure Resources"), | |
| 597 "description": WebInspector.UIString("All resources on this page are served securely.") | |
| 598 })); | |
| 599 } | |
| 600 | |
| 593 if (this._panel.filterRequestCount(WebInspector.NetworkLogView.MixedCont entFilterValues.Blocked) > 0) | 601 if (this._panel.filterRequestCount(WebInspector.NetworkLogView.MixedCont entFilterValues.Blocked) > 0) | 
| 594 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); | 602 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); | 
| 595 | 603 | 
| 596 /** | 604 /** | 
| 597 * @param {!Event} e | 605 * @param {!Event} e | 
| 598 */ | 606 */ | 
| 599 function showDisplayedMixedContentInNetworkPanel(e) | 607 function showDisplayedMixedContentInNetworkPanel(e) | 
| 600 { | 608 { | 
| 601 e.consume(); | 609 e.consume(); | 
| 602 WebInspector.NetworkPanel.revealAndFilter(WebInspector.NetworkLogVie w.FilterType.MixedContent, WebInspector.NetworkLogView.MixedContentFilterValues. Displayed); | 610 WebInspector.NetworkPanel.revealAndFilter(WebInspector.NetworkLogVie w.FilterType.MixedContent, WebInspector.NetworkLogView.MixedContentFilterValues. Displayed); | 
| (...skipping 15 matching lines...) Expand all Loading... | |
| 618 { | 626 { | 
| 619 e.consume(); | 627 e.consume(); | 
| 620 WebInspector.NetworkPanel.revealAndFilter(WebInspector.NetworkLogVie w.FilterType.MixedContent, WebInspector.NetworkLogView.MixedContentFilterValues. Blocked); | 628 WebInspector.NetworkPanel.revealAndFilter(WebInspector.NetworkLogVie w.FilterType.MixedContent, WebInspector.NetworkLogView.MixedContentFilterValues. Blocked); | 
| 621 } | 629 } | 
| 622 }, | 630 }, | 
| 623 | 631 | 
| 624 /** | 632 /** | 
| 625 * @param {!SecurityAgent.SecurityState} securityState | 633 * @param {!SecurityAgent.SecurityState} securityState | 
| 626 * @param {string} summary | 634 * @param {string} summary | 
| 627 * @param {string} description | 635 * @param {string} description | 
| 628 * @param {!WebInspector.NetworkLogView.MixedContentFilterValues} filterKey | 636 * @param {!WebInspector.NetworkLogView.MixedContentFilterValues=} filterKey | 
| 629 * @param {!Function} networkFilterFn | 637 * @param {!Function=} networkFilterFn | 
| 630 */ | 638 */ | 
| 631 _addMixedContentExplanation: function(securityState, summary, description, f ilterKey, networkFilterFn) | 639 _addMixedContentExplanation: function(securityState, summary, description, f ilterKey, networkFilterFn) | 
| 632 { | 640 { | 
| 633 var mixedContentExplanation = /** @type {!SecurityAgent.SecurityStateExp lanation} */ ({ | 641 var mixedContentExplanation = /** @type {!SecurityAgent.SecurityStateExp lanation} */ ({ | 
| 634 "securityState": securityState, | 642 "securityState": securityState, | 
| 635 "summary": summary, | 643 "summary": summary, | 
| 636 "description": description | 644 "description": description | 
| 637 }); | 645 }); | 
| 638 | 646 | 
| 647 var explanation = this._addExplanation(mixedContentExplanation); | |
| 
dgozman
2015/10/09 18:11:34
Revert all the changes here?
 | |
| 648 | |
| 649 if (!filterKey || !networkFilterFn) | |
| 650 return; | |
| 651 | |
| 639 var filterRequestCount = this._panel.filterRequestCount(filterKey); | 652 var filterRequestCount = this._panel.filterRequestCount(filterKey); | 
| 640 var requestsAnchor = this._addExplanation(mixedContentExplanation).creat eChild("div", "security-mixed-content link"); | 653 var requestsAnchor = explanation.createChild("div", "security-mixed-cont ent link"); | 
| 641 if (filterRequestCount > 0) { | 654 if (filterRequestCount > 0) { | 
| 642 requestsAnchor.textContent = WebInspector.UIString("View %d request% s in Network Panel", filterRequestCount, (filterRequestCount > 1 ? "s" : "")); | 655 requestsAnchor.textContent = WebInspector.UIString("View %d request% s in Network Panel", filterRequestCount, (filterRequestCount > 1 ? "s" : "")); | 
| 643 } else { | 656 } else { | 
| 644 // 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. | 657 // 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. | 
| 645 requestsAnchor.textContent = WebInspector.UIString("View requests in Network Panel"); | 658 requestsAnchor.textContent = WebInspector.UIString("View requests in Network Panel"); | 
| 646 } | 659 } | 
| 647 requestsAnchor.href = ""; | 660 requestsAnchor.href = ""; | 
| 648 requestsAnchor.addEventListener("click", networkFilterFn); | 661 requestsAnchor.addEventListener("click", networkFilterFn); | 
| 649 }, | 662 }, | 
| 650 | 663 | 
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 816 row.createChild("div").textContent = WebInspector.UIString(key); | 829 row.createChild("div").textContent = WebInspector.UIString(key); | 
| 817 | 830 | 
| 818 var valueDiv = row.createChild("div"); | 831 var valueDiv = row.createChild("div"); | 
| 819 if (value instanceof HTMLDivElement) { | 832 if (value instanceof HTMLDivElement) { | 
| 820 valueDiv.appendChild(value); | 833 valueDiv.appendChild(value); | 
| 821 } else { | 834 } else { | 
| 822 valueDiv.textContent = value; | 835 valueDiv.textContent = value; | 
| 823 } | 836 } | 
| 824 } | 837 } | 
| 825 } | 838 } | 
| OLD | NEW |