Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Side by Side Diff: Source/devtools/front_end/security/SecurityPanel.js

Issue 1327593005: Link to the mixed content filter from security panel (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 * @property {?NetworkAgent.CertificateDetails} securityDetails.certificateDetai ls - Certificate details of the origin (attached to security details), if availa ble. 50 * @property {?NetworkAgent.CertificateDetails} securityDetails.certificateDetai ls - Certificate details of the origin (attached to security details), if availa ble.
51 * @property {?WebInspector.SecurityOriginView} originView - Current SecurityOri ginView corresponding to origin. 51 * @property {?WebInspector.SecurityOriginView} originView - Current SecurityOri ginView corresponding to origin.
52 */ 52 */
53 WebInspector.SecurityPanel.OriginState; 53 WebInspector.SecurityPanel.OriginState;
54 54
55 WebInspector.SecurityPanel.prototype = { 55 WebInspector.SecurityPanel.prototype = {
56 56
57 /** 57 /**
58 * @param {!SecurityAgent.SecurityState} newSecurityState 58 * @param {!SecurityAgent.SecurityState} newSecurityState
59 * @param {!Array<!SecurityAgent.SecurityStateExplanation>} explanations 59 * @param {!Array<!SecurityAgent.SecurityStateExplanation>} explanations
60 * @param {!SecurityAgent.MixedContentStatus=} mixedContentStatus
lgarron 2015/09/04 00:44:35 @param {?SecurityAgent.MixedContentStatus} mixedCo
estark 2015/09/04 02:45:30 Done.
61 * @param {boolean=} schemeIsCryptographic
lgarron 2015/09/04 00:44:35 Hmm, so, I believe JSDoc won't allow an nullable b
estark 2015/09/04 02:45:30 Converted schemeIsCryptographic to a boolean in Se
60 */ 62 */
61 _updateSecurityState: function(newSecurityState, explanations) 63 _updateSecurityState: function(newSecurityState, explanations, mixedContentS tatus, schemeIsCryptographic)
62 { 64 {
63 this._sidebarMainViewElement.setSecurityState(newSecurityState); 65 this._sidebarMainViewElement.setSecurityState(newSecurityState);
64 this._mainView.updateSecurityState(newSecurityState, explanations); 66 this._mainView.updateSecurityState(newSecurityState, explanations, mixed ContentStatus, schemeIsCryptographic);
65 }, 67 },
66 68
67 /** 69 /**
68 * @param {!WebInspector.Event} event 70 * @param {!WebInspector.Event} event
69 */ 71 */
70 _onSecurityStateChanged: function(event) 72 _onSecurityStateChanged: function(event)
71 { 73 {
72 var securityState = /** @type {!SecurityAgent.SecurityState} */ (event.d ata.securityState); 74 var securityState = /** @type {!SecurityAgent.SecurityState} */ (event.d ata.securityState);
73 var explanations = /** @type {!Array<!SecurityAgent.SecurityStateExplana tion>} */ (event.data.explanations); 75 var explanations = /** @type {!Array<!SecurityAgent.SecurityStateExplana tion>} */ (event.data.explanations);
74 this._updateSecurityState(securityState, explanations); 76 this._updateSecurityState(securityState, explanations, event.data.mixedC ontentStatus, event.data.schemeIsCryptographic);
lgarron 2015/09/04 00:44:35 I believe DevTools convention is to cast these (li
estark 2015/09/04 02:45:31 Done.
75 }, 77 },
76 78
77 showMainView: function() 79 showMainView: function()
78 { 80 {
79 this._setVisibleView(this._mainView); 81 this._setVisibleView(this._mainView);
80 }, 82 },
81 83
82 /** 84 /**
83 * @param {!WebInspector.SecurityPanel.Origin} origin 85 * @param {!WebInspector.SecurityPanel.Origin} origin
84 */ 86 */
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 text.createChild("div", "security-summary-section-title").textContent = WebI nspector.UIString("Security Overview"); 327 text.createChild("div", "security-summary-section-title").textContent = WebI nspector.UIString("Security Overview");
326 this._summaryExplanation = text.createChild("div", "security-explanation"); 328 this._summaryExplanation = text.createChild("div", "security-explanation");
327 329
328 this._securityExplanations = this.element.createChild("div", "security-expla nation-list"); 330 this._securityExplanations = this.element.createChild("div", "security-expla nation-list");
329 331
330 } 332 }
331 333
332 WebInspector.SecurityMainView.prototype = { 334 WebInspector.SecurityMainView.prototype = {
333 /** 335 /**
334 * @param {!SecurityAgent.SecurityStateExplanation} explanation 336 * @param {!SecurityAgent.SecurityStateExplanation} explanation
337 * @return {!Element}
335 */ 338 */
336 _addExplanation: function(explanation) 339 _addExplanation: function(explanation)
337 { 340 {
338 var explanationSection = this._securityExplanations.createChild("div", " security-section"); 341 var explanationSection = this._securityExplanations.createChild("div", " security-section");
339 explanationSection.classList.add("security-explanation"); 342 explanationSection.classList.add("security-explanation");
340 343
341 explanationSection.createChild("div", "lock-icon").classList.add("lock-i con-" + explanation.securityState); 344 explanationSection.createChild("div", "lock-icon").classList.add("lock-i con-" + explanation.securityState);
342 var text = explanationSection.createChild("div", "security-section-text" ); 345 var text = explanationSection.createChild("div", "security-section-text" );
343 text.createChild("div", "security-section-title").textContent = explanat ion.summary; 346 text.createChild("div", "security-section-title").textContent = explanat ion.summary;
344 text.createChild("div", "security-explanation").textContent = explanatio n.description; 347 text.createChild("div", "security-explanation").textContent = explanatio n.description;
348 return text;
345 }, 349 },
346 350
347 /** 351 /**
348 * @param {!SecurityAgent.SecurityState} newSecurityState 352 * @param {!SecurityAgent.SecurityState} newSecurityState
349 * @param {!Array<!SecurityAgent.SecurityStateExplanation>} explanations 353 * @param {!Array<!SecurityAgent.SecurityStateExplanation>} explanations
354 * @param {!SecurityAgent.MixedContentStatus=} mixedContentStatus
355 * @param {boolean=} schemeIsCryptographic
350 */ 356 */
351 updateSecurityState: function(newSecurityState, explanations) 357 updateSecurityState: function(newSecurityState, explanations, mixedContentSt atus, schemeIsCryptographic)
352 { 358 {
353 // Remove old state. 359 // Remove old state.
354 // It's safe to call this even when this._securityState is undefined. 360 // It's safe to call this even when this._securityState is undefined.
355 this._summarylockIcon.classList.remove("lock-icon-" + this._securityStat e); 361 this._summarylockIcon.classList.remove("lock-icon-" + this._securityStat e);
356 this._summaryExplanation.classList.remove("security-state-" + this._secu rityState); 362 this._summaryExplanation.classList.remove("security-state-" + this._secu rityState);
357 363
358 // Add new state. 364 // Add new state.
359 this._securityState = newSecurityState; 365 this._securityState = newSecurityState;
360 this._summarylockIcon.classList.add("lock-icon-" + this._securityState); 366 this._summarylockIcon.classList.add("lock-icon-" + this._securityState);
361 this._summaryExplanation.classList.add("security-state-" + this._securit yState); 367 this._summaryExplanation.classList.add("security-state-" + this._securit yState);
362 var summaryExplanationStrings = { 368 var summaryExplanationStrings = {
363 "unknown": WebInspector.UIString("This security of this page is unk nown."), 369 "unknown": WebInspector.UIString("This security of this page is unk nown."),
364 "insecure": WebInspector.UIString("This page is insecure (broken HTT PS)."), 370 "insecure": WebInspector.UIString("This page is insecure (broken HTT PS)."),
365 "neutral": WebInspector.UIString("This page is not secure."), 371 "neutral": WebInspector.UIString("This page is not secure."),
366 "secure": WebInspector.UIString("This page is secure (valid HTTPS) .") 372 "secure": WebInspector.UIString("This page is secure (valid HTTPS) .")
367 } 373 }
368 this._summaryExplanation.textContent = summaryExplanationStrings[this._s ecurityState]; 374 this._summaryExplanation.textContent = summaryExplanationStrings[this._s ecurityState];
369 375
370 this._securityExplanations.removeChildren(); 376 this._securityExplanations.removeChildren();
371 for (var explanation of explanations) 377 for (var explanation of explanations)
372 this._addExplanation(explanation); 378 this._addExplanation(explanation);
379
380 if (schemeIsCryptographic && mixedContentStatus) {
381 var mixedContentExplanation;
pfeldman 2015/09/03 23:48:48 4 space indent.
estark 2015/09/04 02:45:30 Done.
382 if (mixedContentStatus.ranInsecureContent) {
383 mixedContentExplanation = {
pfeldman 2015/09/03 23:48:48 These plain JS objects are always compiler-unfrien
lgarron 2015/09/04 00:44:35 estark@: It seems I forgot to do this when I added
estark 2015/09/04 02:45:30 Not sure if I did this right, PTAL.
384 "securityState": mixedContentStatus.ranInsecureContentStyle,
385 "summary": WebInspector.UIString("Active Mixed Content"),
386 "description": WebInspector.UIString("You have recently allowed in secure content (such as scripts or iframes) to run on this site.")
387 }
388 } else if (mixedContentStatus.displayedInsecureContent) {
389 mixedContentExplanation = {
390 "securityState": mixedContentStatus.displayedInsecureContentStyle,
391 "summary": WebInspector.UIString("Mixed Content"),
392 "description": WebInspector.UIString("The site includes HTTP resou rces.")
393 }
394 }
395 if (mixedContentExplanation) {
lgarron 2015/09/04 00:44:35 I don't know if if's done anywhere in DevTools, bu
estark 2015/09/04 02:45:30 Done (conditioned the whole block around displayed
396 var requestsAnchor = this._addExplanation(mixedContentExplanation).c reateChild("div", "security-mixed-content link");
397 requestsAnchor.textContent = WebInspector.UIString("View requests in Network Panel");
398 requestsAnchor.href = "";
399 requestsAnchor.addEventListener("click", mixedContentStatus.ranInsec ureContent ? showBlockOverriddenMixedContentInNetworkPanel : showDisplayedMixedC ontentInNetworkPanel, false);
400 }
401 }
402
403 function showDisplayedMixedContentInNetworkPanel(e) {
pfeldman 2015/09/03 23:48:48 { goes next line, missing annotation.
estark 2015/09/04 02:45:30 Done.
404 e.consume();
405 WebInspector.NetworkPanel.revealAndFilter(WebInspector.NetworkLogView. FilterType.MixedContent, "displayed");
406 }
407
408 function showBlockOverriddenMixedContentInNetworkPanel(e) {
pfeldman 2015/09/03 23:48:48 ditto
estark 2015/09/04 02:45:30 Done.
409 e.consume();
410 WebInspector.NetworkPanel.revealAndFilter(WebInspector.NetworkLogView. FilterType.MixedContent, "block-overridden");
411 }
373 }, 412 },
374 413
375 __proto__: WebInspector.VBox.prototype 414 __proto__: WebInspector.VBox.prototype
376 } 415 }
377 416
378 /** 417 /**
379 * @constructor 418 * @constructor
380 * @extends {WebInspector.VBox} 419 * @extends {WebInspector.VBox}
381 * @param {!WebInspector.SecurityPanel} panel 420 * @param {!WebInspector.SecurityPanel} panel
382 * @param {!WebInspector.SecurityPanel.Origin} origin 421 * @param {!WebInspector.SecurityPanel.Origin} origin
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 row.createChild("div").textContent = WebInspector.UIString(key); 550 row.createChild("div").textContent = WebInspector.UIString(key);
512 551
513 var valueDiv = row.createChild("div"); 552 var valueDiv = row.createChild("div");
514 if (value instanceof HTMLDivElement) { 553 if (value instanceof HTMLDivElement) {
515 valueDiv.appendChild(value); 554 valueDiv.appendChild(value);
516 } else { 555 } else {
517 valueDiv.textContent = value; 556 valueDiv.textContent = value;
518 } 557 }
519 } 558 }
520 } 559 }
521
lgarron 2015/09/04 00:44:35 Nit: unnecessary whitespace change.
estark 2015/09/04 02:45:30 Done.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698