Commit 06c60d09 authored by estark's avatar estark Committed by Commit bot

DevTools security panel: refresh explanations when clearing origins

When the main frame navigates, the security panel clears the filtered
request counts (the counts of blocked and allowed mixed
content). Previously, we weren't refreshing the explanations after doing
so, meaning that some of the mixed content explanations persisted across
navigations.

BUG=601944

Review-Url: https://codereview.chromium.org/2211413005
Cr-Commit-Position: refs/heads/master@{#410408}
parent 1ade62df
......@@ -27,4 +27,16 @@ View 1 request in Network Panel
</DIV>
</DIV>
</DIV>
<DIV class=security-explanation security-explanation-secure >
<DIV class=security-property security-property-secure >
</DIV>
<DIV class=security-explanation-text >
<DIV class=security-explanation-title >
Secure Resources
</DIV>
<DIV >
All resources on this page are served securely.
</DIV>
</DIV>
</DIV>
......@@ -17,6 +17,13 @@ function test()
var explanations = WebInspector.SecurityPanel._instance()._mainView.contentElement.getElementsByClassName("security-explanation");
for (var i = 0; i < explanations.length; i++)
InspectorTest.dumpDeepInnerHTML(explanations[i]);
// Test that the explanations are cleared on navigation. Regression test for https://crbug.com/601944.
InspectorTest.mainTarget.model(WebInspector.ResourceTreeModel).dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated, InspectorTest.resourceTreeModel.mainFrame);
explanations = WebInspector.SecurityPanel._instance()._mainView.contentElement.getElementsByClassName("security-explanation");
for (var i = 0; i < explanations.length; i++)
InspectorTest.dumpDeepInnerHTML(explanations[i]);
InspectorTest.completeTest();
}
</script>
......
......@@ -267,24 +267,23 @@ WebInspector.SecurityPanel.prototype = {
{
},
_clearOrigins: function()
{
this.selectAndSwitchToMainView();
this._sidebarTree.clearOrigins();
this._origins.clear();
this._lastResponseReceivedForLoaderId.clear();
this._filterRequestCounts.clear();
},
/**
* @param {!WebInspector.Event} event
*/
_onMainFrameNavigated: function(event) {
_onMainFrameNavigated: function(event)
{
var frame = /** type {!PageAgent.Frame}*/ (event.data);
var request = this._lastResponseReceivedForLoaderId.get(frame.loaderId);
this._clearOrigins();
// Clear the origins list.
this.selectAndSwitchToMainView();
this._sidebarTree.clearOrigins();
this._origins.clear();
this._lastResponseReceivedForLoaderId.clear();
this._filterRequestCounts.clear();
// After clearing the filtered request counts, refresh the
// explanations to reflect the new counts.
this._mainView.refreshExplanations();
if (request) {
var origin = WebInspector.ParsedURL.extractOrigin(request.url);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment