Commit b5c71127 authored by estark@chromium.org's avatar estark@chromium.org

Link to the mixed content filter from security panel

BUG=504537

Review URL: https://codereview.chromium.org/1327593005

git-svn-id: svn://svn.chromium.org/blink/trunk@202002 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent a4f7bdd4
...@@ -1034,6 +1034,15 @@ WebInspector.NetworkLogView.prototype = { ...@@ -1034,6 +1034,15 @@ WebInspector.NetworkLogView.prototype = {
} }
}, },
/**
* @param {!WebInspector.NetworkLogView.FilterType} filterType
* @param {string} filterValue
*/
setTextFilterValue: function(filterType, filterValue)
{
this._textFilterUI.setValue(filterType + ":" + filterValue);
},
/** /**
* @param {!WebInspector.Event} event * @param {!WebInspector.Event} event
*/ */
......
...@@ -638,6 +638,17 @@ WebInspector.NetworkPanel.show = function() ...@@ -638,6 +638,17 @@ WebInspector.NetworkPanel.show = function()
WebInspector.inspectorView.setCurrentPanel(WebInspector.NetworkPanel._instance()); WebInspector.inspectorView.setCurrentPanel(WebInspector.NetworkPanel._instance());
} }
/**
* @param {!WebInspector.NetworkLogView.FilterType} filterType
* @param {string} filterValue
*/
WebInspector.NetworkPanel.revealAndFilter = function(filterType, filterValue)
{
var panel = WebInspector.NetworkPanel._instance();
panel._networkLogView.setTextFilterValue(filterType, filterValue);
WebInspector.inspectorView.setCurrentPanel(panel);
}
/** /**
* @return {!WebInspector.NetworkPanel} * @return {!WebInspector.NetworkPanel}
*/ */
......
...@@ -46,6 +46,20 @@ WebInspector.SecurityModel.fromTarget = function(target) ...@@ -46,6 +46,20 @@ WebInspector.SecurityModel.fromTarget = function(target)
return model; return model;
} }
/**
* @constructor
* @param {!SecurityAgent.SecurityState} securityState
* @param {!Array<!SecurityAgent.SecurityStateExplanation>} explanations
* @param {?SecurityAgent.MixedContentStatus} mixedContentStatus
* @param {boolean} schemeIsCryptographic
*/
WebInspector.PageSecurityState = function (securityState, explanations, mixedContentStatus, schemeIsCryptographic) {
this.securityState = securityState;
this.explanations = explanations;
this.mixedContentStatus = mixedContentStatus;
this.schemeIsCryptographic = schemeIsCryptographic;
}
/** /**
* @constructor * @constructor
* @implements {SecurityAgent.Dispatcher} * @implements {SecurityAgent.Dispatcher}
...@@ -65,22 +79,7 @@ WebInspector.SecurityDispatcher.prototype = { ...@@ -65,22 +79,7 @@ WebInspector.SecurityDispatcher.prototype = {
*/ */
securityStateChanged: function(securityState, explanations, mixedContentStatus, schemeIsCryptographic) securityStateChanged: function(securityState, explanations, mixedContentStatus, schemeIsCryptographic)
{ {
var data = {"securityState": securityState, "explanations": explanations || []}; var pageSecurityState = new WebInspector.PageSecurityState(securityState, explanations || [], mixedContentStatus || null, schemeIsCryptographic || false);
if (schemeIsCryptographic && mixedContentStatus) { this._model.dispatchEventToListeners(WebInspector.SecurityModel.EventTypes.SecurityStateChanged, pageSecurityState);
if (mixedContentStatus.ranInsecureContent) {
explanations.push({
"securityState": mixedContentStatus.ranInsecureContentStyle,
"summary": WebInspector.UIString("Active Mixed Content"),
"description": WebInspector.UIString("You have recently allowed insecure content (such as scripts or iframes) to run on this site.")
});
} else if (mixedContentStatus.displayedInsecureContent) {
explanations.push({
"securityState": mixedContentStatus.displayedInsecureContentStyle,
"summary": WebInspector.UIString("Mixed Content"),
"description": WebInspector.UIString("The site includes HTTP resources.")
});
}
}
this._model.dispatchEventToListeners(WebInspector.SecurityModel.EventTypes.SecurityStateChanged, data);
} }
} }
\ No newline at end of file
...@@ -57,11 +57,13 @@ WebInspector.SecurityPanel.prototype = { ...@@ -57,11 +57,13 @@ WebInspector.SecurityPanel.prototype = {
/** /**
* @param {!SecurityAgent.SecurityState} newSecurityState * @param {!SecurityAgent.SecurityState} newSecurityState
* @param {!Array<!SecurityAgent.SecurityStateExplanation>} explanations * @param {!Array<!SecurityAgent.SecurityStateExplanation>} explanations
* @param {?SecurityAgent.MixedContentStatus} mixedContentStatus
* @param {boolean} schemeIsCryptographic
*/ */
_updateSecurityState: function(newSecurityState, explanations) _updateSecurityState: function(newSecurityState, explanations, mixedContentStatus, schemeIsCryptographic)
{ {
this._sidebarMainViewElement.setSecurityState(newSecurityState); this._sidebarMainViewElement.setSecurityState(newSecurityState);
this._mainView.updateSecurityState(newSecurityState, explanations); this._mainView.updateSecurityState(newSecurityState, explanations, mixedContentStatus, schemeIsCryptographic);
}, },
/** /**
...@@ -69,9 +71,12 @@ WebInspector.SecurityPanel.prototype = { ...@@ -69,9 +71,12 @@ WebInspector.SecurityPanel.prototype = {
*/ */
_onSecurityStateChanged: function(event) _onSecurityStateChanged: function(event)
{ {
var securityState = /** @type {!SecurityAgent.SecurityState} */ (event.data.securityState); var data = /** @type {!WebInspector.PageSecurityState} */ (event.data);
var explanations = /** @type {!Array<!SecurityAgent.SecurityStateExplanation>} */ (event.data.explanations); var securityState = /** @type {!SecurityAgent.SecurityState} */ (data.securityState);
this._updateSecurityState(securityState, explanations); var explanations = /** @type {!Array<!SecurityAgent.SecurityStateExplanation>} */ (data.explanations);
var mixedContentStatus = /** @type {?SecurityAgent.MixedContentStatus} */ (data.mixedContentStatus);
var schemeIsCryptographic = /** @type {boolean} */ (data.schemeIsCryptographic);
this._updateSecurityState(securityState, explanations, mixedContentStatus, schemeIsCryptographic);
}, },
showMainView: function() showMainView: function()
...@@ -180,7 +185,7 @@ WebInspector.SecurityPanel.prototype = { ...@@ -180,7 +185,7 @@ WebInspector.SecurityPanel.prototype = {
_clear: function() _clear: function()
{ {
this._updateSecurityState(SecurityAgent.SecurityState.Unknown, []); this._updateSecurityState(SecurityAgent.SecurityState.Unknown, [], null, false);
this._sidebarMainViewElement.select(); this._sidebarMainViewElement.select();
this._sidebarOriginSection.removeChildren(); this._sidebarOriginSection.removeChildren();
this._origins.clear(); this._origins.clear();
...@@ -332,6 +337,7 @@ WebInspector.SecurityMainView = function() ...@@ -332,6 +337,7 @@ WebInspector.SecurityMainView = function()
WebInspector.SecurityMainView.prototype = { WebInspector.SecurityMainView.prototype = {
/** /**
* @param {!SecurityAgent.SecurityStateExplanation} explanation * @param {!SecurityAgent.SecurityStateExplanation} explanation
* @return {!Element}
*/ */
_addExplanation: function(explanation) _addExplanation: function(explanation)
{ {
...@@ -348,6 +354,9 @@ WebInspector.SecurityMainView.prototype = { ...@@ -348,6 +354,9 @@ WebInspector.SecurityMainView.prototype = {
certificateAnchor.href = ""; certificateAnchor.href = "";
certificateAnchor.addEventListener("click", showCertificateViewer, false); certificateAnchor.addEventListener("click", showCertificateViewer, false);
} }
return text;
/** /**
* @param {!Event} e * @param {!Event} e
*/ */
...@@ -361,8 +370,10 @@ WebInspector.SecurityMainView.prototype = { ...@@ -361,8 +370,10 @@ WebInspector.SecurityMainView.prototype = {
/** /**
* @param {!SecurityAgent.SecurityState} newSecurityState * @param {!SecurityAgent.SecurityState} newSecurityState
* @param {!Array<!SecurityAgent.SecurityStateExplanation>} explanations * @param {!Array<!SecurityAgent.SecurityStateExplanation>} explanations
* @param {?SecurityAgent.MixedContentStatus} mixedContentStatus
* @param {boolean} schemeIsCryptographic
*/ */
updateSecurityState: function(newSecurityState, explanations) updateSecurityState: function(newSecurityState, explanations, mixedContentStatus, schemeIsCryptographic)
{ {
// Remove old state. // Remove old state.
// It's safe to call this even when this._securityState is undefined. // It's safe to call this even when this._securityState is undefined.
...@@ -384,6 +395,47 @@ WebInspector.SecurityMainView.prototype = { ...@@ -384,6 +395,47 @@ WebInspector.SecurityMainView.prototype = {
this._securityExplanations.removeChildren(); this._securityExplanations.removeChildren();
for (var explanation of explanations) for (var explanation of explanations)
this._addExplanation(explanation); this._addExplanation(explanation);
if (schemeIsCryptographic && mixedContentStatus && (mixedContentStatus.ranInsecureContent || mixedContentStatus.displayedInsecureContent)) {
/** @type {!SecurityAgent.SecurityStateExplanation} */
var mixedContentExplanation;
if (mixedContentStatus.ranInsecureContent) {
mixedContentExplanation = /** @type {!SecurityAgent.SecurityStateExplanation} */ ({
"securityState": mixedContentStatus.ranInsecureContentStyle,
"summary": WebInspector.UIString("Active Mixed Content"),
"description": WebInspector.UIString("You have recently allowed insecure content (such as scripts or iframes) to run on this site.")
});
} else if (mixedContentStatus.displayedInsecureContent) {
mixedContentExplanation = /** @type {!SecurityAgent.SecurityStateExplanation} */ ({
"securityState": mixedContentStatus.displayedInsecureContentStyle,
"summary": WebInspector.UIString("Mixed Content"),
"description": WebInspector.UIString("The site includes HTTP resources.")
});
}
var requestsAnchor = this._addExplanation(mixedContentExplanation).createChild("div", "security-mixed-content link");
requestsAnchor.textContent = WebInspector.UIString("View requests in Network Panel");
requestsAnchor.href = "";
requestsAnchor.addEventListener("click", mixedContentStatus.ranInsecureContent ? showBlockOverriddenMixedContentInNetworkPanel : showDisplayedMixedContentInNetworkPanel, false);
}
/**
* @param {!Event} e
*/
function showDisplayedMixedContentInNetworkPanel(e)
{
e.consume();
WebInspector.NetworkPanel.revealAndFilter(WebInspector.NetworkLogView.FilterType.MixedContent, "displayed");
}
/**
* @param {!Event} e
*/
function showBlockOverriddenMixedContentInNetworkPanel(e)
{
e.consume();
WebInspector.NetworkPanel.revealAndFilter(WebInspector.NetworkLogView.FilterType.MixedContent, "block-overridden");
}
}, },
__proto__: WebInspector.VBox.prototype __proto__: WebInspector.VBox.prototype
......
...@@ -59,4 +59,8 @@ ...@@ -59,4 +59,8 @@
.security-main-view .security-section-title { .security-main-view .security-section-title {
color: rgb(90, 90, 90); color: rgb(90, 90, 90);
margin-bottom: 8px; margin-bottom: 8px;
}
.security-main-view .security-mixed-content {
margin-top: 8px;
} }
\ No newline at end of file
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
"className": "WebInspector.SecurityPanelFactory" "className": "WebInspector.SecurityPanelFactory"
} }
], ],
"dependencies": ["platform", "ui", "sdk"], "dependencies": ["network", "platform", "ui", "sdk"],
"experiment": "securityPanel", "experiment": "securityPanel",
"scripts": [ "scripts": [
"SecurityModel.js", "SecurityModel.js",
......
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