| 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 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 /** @type {!Map<!WebInspector.SecurityPanel.Origin, !WebInspector.SecurityPa
nel.OriginState>} */ | 23 /** @type {!Map<!WebInspector.SecurityPanel.Origin, !WebInspector.SecurityPa
nel.OriginState>} */ |
| 24 this._origins = new Map(); | 24 this._origins = new Map(); |
| 25 | 25 |
| 26 /** @type {!Map<!WebInspector.NetworkLogView.MixedContentFilterValues, numbe
r>} */ | 26 /** @type {!Map<!WebInspector.NetworkLogView.MixedContentFilterValues, numbe
r>} */ |
| 27 this._filterRequestCounts = new Map(); | 27 this._filterRequestCounts = new Map(); |
| 28 | 28 |
| 29 /** @type {!Map<!WebInspector.Target, !Array<!WebInspector.EventTarget.Event
Descriptor>>}*/ | 29 /** @type {!Map<!WebInspector.Target, !Array<!WebInspector.EventTarget.Event
Descriptor>>}*/ |
| 30 this._eventListeners = new Map(); | 30 this._eventListeners = new Map(); |
| 31 WebInspector.targetManager.observeTargets(this, WebInspector.Target.Capabili
ty.Network); | 31 WebInspector.targetManager.observeTargets(this, WebInspector.Target.Capabili
ty.Network); |
| 32 } | 32 }; |
| 33 | 33 |
| 34 /** @typedef {string} */ | 34 /** @typedef {string} */ |
| 35 WebInspector.SecurityPanel.Origin; | 35 WebInspector.SecurityPanel.Origin; |
| 36 | 36 |
| 37 /** | 37 /** |
| 38 * @typedef {Object} | 38 * @typedef {Object} |
| 39 * @property {!SecurityAgent.SecurityState} securityState - Current security sta
te of the origin. | 39 * @property {!SecurityAgent.SecurityState} securityState - Current security sta
te of the origin. |
| 40 * @property {?NetworkAgent.SecurityDetails} securityDetails - Security details
of the origin, if available. | 40 * @property {?NetworkAgent.SecurityDetails} securityDetails - Security details
of the origin, if available. |
| 41 * @property {?Promise<>} certificateDetailsPromise - Certificate details of the
origin. | 41 * @property {?Promise<>} certificateDetailsPromise - Certificate details of the
origin. |
| 42 * @property {?WebInspector.SecurityOriginView} originView - Current SecurityOri
ginView corresponding to origin. | 42 * @property {?WebInspector.SecurityOriginView} originView - Current SecurityOri
ginView corresponding to origin. |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 this.selectAndSwitchToMainView(); | 335 this.selectAndSwitchToMainView(); |
| 336 this._sidebarTree.toggleOriginsList(true /* hidden */); | 336 this._sidebarTree.toggleOriginsList(true /* hidden */); |
| 337 }, | 337 }, |
| 338 | 338 |
| 339 _onInterstitialHidden: function() | 339 _onInterstitialHidden: function() |
| 340 { | 340 { |
| 341 this._sidebarTree.toggleOriginsList(false /* hidden */); | 341 this._sidebarTree.toggleOriginsList(false /* hidden */); |
| 342 }, | 342 }, |
| 343 | 343 |
| 344 __proto__: WebInspector.PanelWithSidebar.prototype | 344 __proto__: WebInspector.PanelWithSidebar.prototype |
| 345 } | 345 }; |
| 346 | 346 |
| 347 /** | 347 /** |
| 348 * @return {!WebInspector.SecurityPanel} | 348 * @return {!WebInspector.SecurityPanel} |
| 349 */ | 349 */ |
| 350 WebInspector.SecurityPanel._instance = function() | 350 WebInspector.SecurityPanel._instance = function() |
| 351 { | 351 { |
| 352 return /** @type {!WebInspector.SecurityPanel} */ (self.runtime.sharedInstan
ce(WebInspector.SecurityPanel)); | 352 return /** @type {!WebInspector.SecurityPanel} */ (self.runtime.sharedInstan
ce(WebInspector.SecurityPanel)); |
| 353 } | 353 }; |
| 354 | 354 |
| 355 /** | 355 /** |
| 356 * @param {string} text | 356 * @param {string} text |
| 357 * @param {!WebInspector.SecurityPanel} panel | 357 * @param {!WebInspector.SecurityPanel} panel |
| 358 * @return {!Element} | 358 * @return {!Element} |
| 359 */ | 359 */ |
| 360 WebInspector.SecurityPanel.createCertificateViewerButton = function(text, panel) | 360 WebInspector.SecurityPanel.createCertificateViewerButton = function(text, panel) |
| 361 { | 361 { |
| 362 /** | 362 /** |
| 363 * @param {!Event} e | 363 * @param {!Event} e |
| 364 */ | 364 */ |
| 365 function showCertificateViewer(e) | 365 function showCertificateViewer(e) |
| 366 { | 366 { |
| 367 e.consume(); | 367 e.consume(); |
| 368 panel.showCertificateViewer(); | 368 panel.showCertificateViewer(); |
| 369 } | 369 } |
| 370 | 370 |
| 371 return createTextButton(text, showCertificateViewer, "security-certificate-b
utton"); | 371 return createTextButton(text, showCertificateViewer, "security-certificate-b
utton"); |
| 372 } | 372 }; |
| 373 | 373 |
| 374 /** | 374 /** |
| 375 * @param {string} text | 375 * @param {string} text |
| 376 * @param {string} origin | 376 * @param {string} origin |
| 377 * @return {!Element} | 377 * @return {!Element} |
| 378 */ | 378 */ |
| 379 WebInspector.SecurityPanel.createCertificateViewerButton2 = function(text, origi
n) | 379 WebInspector.SecurityPanel.createCertificateViewerButton2 = function(text, origi
n) |
| 380 { | 380 { |
| 381 /** | 381 /** |
| 382 * @param {!Event} e | 382 * @param {!Event} e |
| 383 */ | 383 */ |
| 384 function showCertificateViewer(e) | 384 function showCertificateViewer(e) |
| 385 { | 385 { |
| 386 function certificateCallback(names) | 386 function certificateCallback(names) |
| 387 { | 387 { |
| 388 InspectorFrontendHost.showCertificateViewer(names); | 388 InspectorFrontendHost.showCertificateViewer(names); |
| 389 } | 389 } |
| 390 | 390 |
| 391 e.consume(); | 391 e.consume(); |
| 392 WebInspector.multitargetNetworkManager.getCertificate(origin, certificat
eCallback); | 392 WebInspector.multitargetNetworkManager.getCertificate(origin, certificat
eCallback); |
| 393 } | 393 } |
| 394 | 394 |
| 395 return createTextButton(text, showCertificateViewer, "security-certificate-b
utton"); | 395 return createTextButton(text, showCertificateViewer, "security-certificate-b
utton"); |
| 396 } | 396 }; |
| 397 | 397 |
| 398 /** | 398 /** |
| 399 * @constructor | 399 * @constructor |
| 400 * @extends {TreeOutlineInShadow} | 400 * @extends {TreeOutlineInShadow} |
| 401 * @param {!WebInspector.SecurityPanelSidebarTreeElement} mainViewElement | 401 * @param {!WebInspector.SecurityPanelSidebarTreeElement} mainViewElement |
| 402 * @param {function(!WebInspector.SecurityPanel.Origin)} showOriginInPanel | 402 * @param {function(!WebInspector.SecurityPanel.Origin)} showOriginInPanel |
| 403 */ | 403 */ |
| 404 WebInspector.SecurityPanelSidebarTree = function(mainViewElement, showOriginInPa
nel) | 404 WebInspector.SecurityPanelSidebarTree = function(mainViewElement, showOriginInPa
nel) |
| 405 { | 405 { |
| 406 this._showOriginInPanel = showOriginInPanel; | 406 this._showOriginInPanel = showOriginInPanel; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 428 this._clearOriginGroups(); | 428 this._clearOriginGroups(); |
| 429 | 429 |
| 430 // This message will be removed by clearOrigins() during the first new page
load after the panel was opened. | 430 // This message will be removed by clearOrigins() during the first new page
load after the panel was opened. |
| 431 var mainViewReloadMessage = new TreeElement(WebInspector.UIString("Reload to
view details")); | 431 var mainViewReloadMessage = new TreeElement(WebInspector.UIString("Reload to
view details")); |
| 432 mainViewReloadMessage.selectable = false; | 432 mainViewReloadMessage.selectable = false; |
| 433 mainViewReloadMessage.listItemElement.classList.add("security-main-view-relo
ad-message"); | 433 mainViewReloadMessage.listItemElement.classList.add("security-main-view-relo
ad-message"); |
| 434 this._originGroups.get(WebInspector.SecurityPanelSidebarTree.OriginGroupName
.MainOrigin).appendChild(mainViewReloadMessage); | 434 this._originGroups.get(WebInspector.SecurityPanelSidebarTree.OriginGroupName
.MainOrigin).appendChild(mainViewReloadMessage); |
| 435 | 435 |
| 436 /** @type {!Map<!WebInspector.SecurityPanel.Origin, !WebInspector.SecurityPa
nelSidebarTreeElement>} */ | 436 /** @type {!Map<!WebInspector.SecurityPanel.Origin, !WebInspector.SecurityPa
nelSidebarTreeElement>} */ |
| 437 this._elementsByOrigin = new Map(); | 437 this._elementsByOrigin = new Map(); |
| 438 } | 438 }; |
| 439 | 439 |
| 440 WebInspector.SecurityPanelSidebarTree.prototype = { | 440 WebInspector.SecurityPanelSidebarTree.prototype = { |
| 441 /** | 441 /** |
| 442 * @param {boolean} hidden | 442 * @param {boolean} hidden |
| 443 */ | 443 */ |
| 444 toggleOriginsList: function(hidden) | 444 toggleOriginsList: function(hidden) |
| 445 { | 445 { |
| 446 for (var key in WebInspector.SecurityPanelSidebarTree.OriginGroupName) { | 446 for (var key in WebInspector.SecurityPanelSidebarTree.OriginGroupName) { |
| 447 var originGroupName = WebInspector.SecurityPanelSidebarTree.OriginGr
oupName[key]; | 447 var originGroupName = WebInspector.SecurityPanelSidebarTree.OriginGr
oupName[key]; |
| 448 var group = this._originGroups.get(originGroupName); | 448 var group = this._originGroups.get(originGroupName); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 this._originGroups.get(WebInspector.SecurityPanelSidebarTree.OriginGroup
Name.MainOrigin).hidden = false; | 519 this._originGroups.get(WebInspector.SecurityPanelSidebarTree.OriginGroup
Name.MainOrigin).hidden = false; |
| 520 }, | 520 }, |
| 521 | 521 |
| 522 clearOrigins: function() | 522 clearOrigins: function() |
| 523 { | 523 { |
| 524 this._clearOriginGroups(); | 524 this._clearOriginGroups(); |
| 525 this._elementsByOrigin.clear(); | 525 this._elementsByOrigin.clear(); |
| 526 }, | 526 }, |
| 527 | 527 |
| 528 __proto__: TreeOutlineInShadow.prototype | 528 __proto__: TreeOutlineInShadow.prototype |
| 529 } | 529 }; |
| 530 | 530 |
| 531 | 531 |
| 532 /** | 532 /** |
| 533 * A mapping from Javascript key IDs to names (sidebar section titles). | 533 * A mapping from Javascript key IDs to names (sidebar section titles). |
| 534 * Note: The names are used as keys into a map, so they must be distinct from ea
ch other. | 534 * Note: The names are used as keys into a map, so they must be distinct from ea
ch other. |
| 535 * @enum {string} | 535 * @enum {string} |
| 536 */ | 536 */ |
| 537 WebInspector.SecurityPanelSidebarTree.OriginGroupName = { | 537 WebInspector.SecurityPanelSidebarTree.OriginGroupName = { |
| 538 MainOrigin: WebInspector.UIString("Main Origin"), | 538 MainOrigin: WebInspector.UIString("Main Origin"), |
| 539 NonSecure: WebInspector.UIString("Non-Secure Origins"), | 539 NonSecure: WebInspector.UIString("Non-Secure Origins"), |
| 540 Secure: WebInspector.UIString("Secure Origins"), | 540 Secure: WebInspector.UIString("Secure Origins"), |
| 541 Unknown: WebInspector.UIString("Unknown / Canceled") | 541 Unknown: WebInspector.UIString("Unknown / Canceled") |
| 542 } | 542 }; |
| 543 | 543 |
| 544 | 544 |
| 545 /** | 545 /** |
| 546 * @constructor | 546 * @constructor |
| 547 * @extends {TreeElement} | 547 * @extends {TreeElement} |
| 548 * @param {string} text | 548 * @param {string} text |
| 549 * @param {function()} selectCallback | 549 * @param {function()} selectCallback |
| 550 * @param {string} className | 550 * @param {string} className |
| 551 * @param {string} cssPrefix | 551 * @param {string} cssPrefix |
| 552 */ | 552 */ |
| 553 WebInspector.SecurityPanelSidebarTreeElement = function(text, selectCallback, cl
assName, cssPrefix) | 553 WebInspector.SecurityPanelSidebarTreeElement = function(text, selectCallback, cl
assName, cssPrefix) |
| 554 { | 554 { |
| 555 TreeElement.call(this, "", false); | 555 TreeElement.call(this, "", false); |
| 556 this._selectCallback = selectCallback; | 556 this._selectCallback = selectCallback; |
| 557 this._cssPrefix = cssPrefix; | 557 this._cssPrefix = cssPrefix; |
| 558 this.listItemElement.classList.add(className); | 558 this.listItemElement.classList.add(className); |
| 559 this._iconElement = this.listItemElement.createChild("div", "icon"); | 559 this._iconElement = this.listItemElement.createChild("div", "icon"); |
| 560 this._iconElement.classList.add(this._cssPrefix); | 560 this._iconElement.classList.add(this._cssPrefix); |
| 561 this.listItemElement.createChild("span", "title").textContent = text; | 561 this.listItemElement.createChild("span", "title").textContent = text; |
| 562 this.setSecurityState(SecurityAgent.SecurityState.Unknown); | 562 this.setSecurityState(SecurityAgent.SecurityState.Unknown); |
| 563 } | 563 }; |
| 564 | 564 |
| 565 WebInspector.SecurityPanelSidebarTreeElement.prototype = { | 565 WebInspector.SecurityPanelSidebarTreeElement.prototype = { |
| 566 /** | 566 /** |
| 567 * @param {!SecurityAgent.SecurityState} newSecurityState | 567 * @param {!SecurityAgent.SecurityState} newSecurityState |
| 568 */ | 568 */ |
| 569 setSecurityState: function(newSecurityState) | 569 setSecurityState: function(newSecurityState) |
| 570 { | 570 { |
| 571 if (this._securityState) | 571 if (this._securityState) |
| 572 this._iconElement.classList.remove(this._cssPrefix + "-" + this._sec
urityState); | 572 this._iconElement.classList.remove(this._cssPrefix + "-" + this._sec
urityState); |
| 573 | 573 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 587 * @override | 587 * @override |
| 588 * @return {boolean} | 588 * @return {boolean} |
| 589 */ | 589 */ |
| 590 onselect: function() | 590 onselect: function() |
| 591 { | 591 { |
| 592 this._selectCallback(); | 592 this._selectCallback(); |
| 593 return true; | 593 return true; |
| 594 }, | 594 }, |
| 595 | 595 |
| 596 __proto__: TreeElement.prototype | 596 __proto__: TreeElement.prototype |
| 597 } | 597 }; |
| 598 | 598 |
| 599 /** | 599 /** |
| 600 * @param {!WebInspector.SecurityPanelSidebarTreeElement} a | 600 * @param {!WebInspector.SecurityPanelSidebarTreeElement} a |
| 601 * @param {!WebInspector.SecurityPanelSidebarTreeElement} b | 601 * @param {!WebInspector.SecurityPanelSidebarTreeElement} b |
| 602 * @return {number} | 602 * @return {number} |
| 603 */ | 603 */ |
| 604 WebInspector.SecurityPanelSidebarTreeElement.SecurityStateComparator = function(
a, b) | 604 WebInspector.SecurityPanelSidebarTreeElement.SecurityStateComparator = function(
a, b) |
| 605 { | 605 { |
| 606 return WebInspector.SecurityModel.SecurityStateComparator(a.securityState(),
b.securityState()); | 606 return WebInspector.SecurityModel.SecurityStateComparator(a.securityState(),
b.securityState()); |
| 607 } | 607 }; |
| 608 | 608 |
| 609 /** | 609 /** |
| 610 * @constructor | 610 * @constructor |
| 611 * @extends {WebInspector.VBox} | 611 * @extends {WebInspector.VBox} |
| 612 * @param {!WebInspector.SecurityPanel} panel | 612 * @param {!WebInspector.SecurityPanel} panel |
| 613 */ | 613 */ |
| 614 WebInspector.SecurityMainView = function(panel) | 614 WebInspector.SecurityMainView = function(panel) |
| 615 { | 615 { |
| 616 WebInspector.VBox.call(this, true); | 616 WebInspector.VBox.call(this, true); |
| 617 this.registerRequiredCSS("security/mainView.css"); | 617 this.registerRequiredCSS("security/mainView.css"); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 632 this._summarySection.createChild("div", "security-summary-section-title").te
xtContent = WebInspector.UIString("Security Overview"); | 632 this._summarySection.createChild("div", "security-summary-section-title").te
xtContent = WebInspector.UIString("Security Overview"); |
| 633 | 633 |
| 634 var lockSpectrum = this._summarySection.createChild("div", "lock-spectrum"); | 634 var lockSpectrum = this._summarySection.createChild("div", "lock-spectrum"); |
| 635 lockSpectrum.createChild("div", "lock-icon lock-icon-secure").title = WebIns
pector.UIString("Secure"); | 635 lockSpectrum.createChild("div", "lock-icon lock-icon-secure").title = WebIns
pector.UIString("Secure"); |
| 636 lockSpectrum.createChild("div", "lock-icon lock-icon-neutral").title = WebIn
spector.UIString("Not Secure"); | 636 lockSpectrum.createChild("div", "lock-icon lock-icon-neutral").title = WebIn
spector.UIString("Not Secure"); |
| 637 lockSpectrum.createChild("div", "lock-icon lock-icon-insecure").title = WebI
nspector.UIString("Not Secure (Broken)"); | 637 lockSpectrum.createChild("div", "lock-icon lock-icon-insecure").title = WebI
nspector.UIString("Not Secure (Broken)"); |
| 638 | 638 |
| 639 this._summarySection.createChild("div", "triangle-pointer-container").create
Child("div", "triangle-pointer-wrapper").createChild("div", "triangle-pointer"); | 639 this._summarySection.createChild("div", "triangle-pointer-container").create
Child("div", "triangle-pointer-wrapper").createChild("div", "triangle-pointer"); |
| 640 | 640 |
| 641 this._summaryText = this._summarySection.createChild("div", "security-summar
y-text"); | 641 this._summaryText = this._summarySection.createChild("div", "security-summar
y-text"); |
| 642 } | 642 }; |
| 643 | 643 |
| 644 WebInspector.SecurityMainView.prototype = { | 644 WebInspector.SecurityMainView.prototype = { |
| 645 /** | 645 /** |
| 646 * @param {!Element} parent | 646 * @param {!Element} parent |
| 647 * @param {!SecurityAgent.SecurityStateExplanation} explanation | 647 * @param {!SecurityAgent.SecurityStateExplanation} explanation |
| 648 * @return {!Element} | 648 * @return {!Element} |
| 649 */ | 649 */ |
| 650 _addExplanation: function(parent, explanation) | 650 _addExplanation: function(parent, explanation) |
| 651 { | 651 { |
| 652 var explanationSection = parent.createChild("div", "security-explanation
"); | 652 var explanationSection = parent.createChild("div", "security-explanation
"); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 677 this._summarySection.classList.remove("security-summary-" + this._securi
tyState); | 677 this._summarySection.classList.remove("security-summary-" + this._securi
tyState); |
| 678 | 678 |
| 679 // Add new state. | 679 // Add new state. |
| 680 this._securityState = newSecurityState; | 680 this._securityState = newSecurityState; |
| 681 this._summarySection.classList.add("security-summary-" + this._securityS
tate); | 681 this._summarySection.classList.add("security-summary-" + this._securityS
tate); |
| 682 var summaryExplanationStrings = { | 682 var summaryExplanationStrings = { |
| 683 "unknown": WebInspector.UIString("The security of this page is unkn
own."), | 683 "unknown": WebInspector.UIString("The security of this page is unkn
own."), |
| 684 "insecure": WebInspector.UIString("This page is not secure (broken H
TTPS)."), | 684 "insecure": WebInspector.UIString("This page is not secure (broken H
TTPS)."), |
| 685 "neutral": WebInspector.UIString("This page is not secure."), | 685 "neutral": WebInspector.UIString("This page is not secure."), |
| 686 "secure": WebInspector.UIString("This page is secure (valid HTTPS)
.") | 686 "secure": WebInspector.UIString("This page is secure (valid HTTPS)
.") |
| 687 } | 687 }; |
| 688 this._summaryText.textContent = summaryExplanationStrings[this._security
State]; | 688 this._summaryText.textContent = summaryExplanationStrings[this._security
State]; |
| 689 | 689 |
| 690 this._explanations = explanations, | 690 this._explanations = explanations, |
| 691 this._insecureContentStatus = insecureContentStatus; | 691 this._insecureContentStatus = insecureContentStatus; |
| 692 this._schemeIsCryptographic = schemeIsCryptographic; | 692 this._schemeIsCryptographic = schemeIsCryptographic; |
| 693 | 693 |
| 694 this._panel.setRanInsecureContentStyle(insecureContentStatus.ranInsecure
ContentStyle); | 694 this._panel.setRanInsecureContentStyle(insecureContentStatus.ranInsecure
ContentStyle); |
| 695 this._panel.setDisplayedInsecureContentStyle(insecureContentStatus.displ
ayedInsecureContentStyle); | 695 this._panel.setDisplayedInsecureContentStyle(insecureContentStatus.displ
ayedInsecureContentStyle); |
| 696 | 696 |
| 697 this.refreshExplanations(); | 697 this.refreshExplanations(); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 this._addExplanation(this._securityExplanationsMain, /** @type {!Sec
urityAgent.SecurityStateExplanation} */ ({ | 828 this._addExplanation(this._securityExplanationsMain, /** @type {!Sec
urityAgent.SecurityStateExplanation} */ ({ |
| 829 "securityState": this._insecureContentStatus.displayedInsecureCo
ntentStyle, | 829 "securityState": this._insecureContentStatus.displayedInsecureCo
ntentStyle, |
| 830 "summary": WebInspector.UIString("Content with certificate error
s"), | 830 "summary": WebInspector.UIString("Content with certificate error
s"), |
| 831 "description": WebInspector.UIString("This site includes resourc
es that were loaded with certificate errors.") | 831 "description": WebInspector.UIString("This site includes resourc
es that were loaded with certificate errors.") |
| 832 })); | 832 })); |
| 833 } | 833 } |
| 834 }, | 834 }, |
| 835 | 835 |
| 836 | 836 |
| 837 __proto__: WebInspector.VBox.prototype | 837 __proto__: WebInspector.VBox.prototype |
| 838 } | 838 }; |
| 839 | 839 |
| 840 /** | 840 /** |
| 841 * @constructor | 841 * @constructor |
| 842 * @extends {WebInspector.VBox} | 842 * @extends {WebInspector.VBox} |
| 843 * @param {!WebInspector.SecurityPanel} panel | 843 * @param {!WebInspector.SecurityPanel} panel |
| 844 * @param {!WebInspector.SecurityPanel.Origin} origin | 844 * @param {!WebInspector.SecurityPanel.Origin} origin |
| 845 * @param {!WebInspector.SecurityPanel.OriginState} originState | 845 * @param {!WebInspector.SecurityPanel.OriginState} originState |
| 846 */ | 846 */ |
| 847 WebInspector.SecurityOriginView = function(panel, origin, originState) | 847 WebInspector.SecurityOriginView = function(panel, origin, originState) |
| 848 { | 848 { |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 967 noteSection.createChild("div").textContent = WebInspector.UIString("The
security details above are from the first inspected response."); | 967 noteSection.createChild("div").textContent = WebInspector.UIString("The
security details above are from the first inspected response."); |
| 968 } else if (originState.securityState !== SecurityAgent.SecurityState.Unknown
) { | 968 } else if (originState.securityState !== SecurityAgent.SecurityState.Unknown
) { |
| 969 var notSecureSection = this.element.createChild("div", "origin-view-sect
ion"); | 969 var notSecureSection = this.element.createChild("div", "origin-view-sect
ion"); |
| 970 notSecureSection.createChild("div", "origin-view-section-title").textCon
tent = WebInspector.UIString("Not Secure"); | 970 notSecureSection.createChild("div", "origin-view-section-title").textCon
tent = WebInspector.UIString("Not Secure"); |
| 971 notSecureSection.createChild("div").textContent = WebInspector.UIString(
"Your connection to this origin is not secure."); | 971 notSecureSection.createChild("div").textContent = WebInspector.UIString(
"Your connection to this origin is not secure."); |
| 972 } else { | 972 } else { |
| 973 var noInfoSection = this.element.createChild("div", "origin-view-section
"); | 973 var noInfoSection = this.element.createChild("div", "origin-view-section
"); |
| 974 noInfoSection.createChild("div", "origin-view-section-title").textConten
t = WebInspector.UIString("No Security Information"); | 974 noInfoSection.createChild("div", "origin-view-section-title").textConten
t = WebInspector.UIString("No Security Information"); |
| 975 noInfoSection.createChild("div").textContent = WebInspector.UIString("No
security details are available for this origin."); | 975 noInfoSection.createChild("div").textContent = WebInspector.UIString("No
security details are available for this origin."); |
| 976 } | 976 } |
| 977 } | 977 }; |
| 978 | 978 |
| 979 WebInspector.SecurityOriginView.prototype = { | 979 WebInspector.SecurityOriginView.prototype = { |
| 980 | 980 |
| 981 /** | 981 /** |
| 982 * @param {!Array<string>} sanList | 982 * @param {!Array<string>} sanList |
| 983 * *return {!Element} | 983 * *return {!Element} |
| 984 */ | 984 */ |
| 985 _createSanDiv: function(sanList) | 985 _createSanDiv: function(sanList) |
| 986 { | 986 { |
| 987 var sanDiv = createElement("div"); | 987 var sanDiv = createElement("div"); |
| 988 if (sanList.length === 0) { | 988 if (sanList.length === 0) { |
| 989 sanDiv.textContent = WebInspector.UIString("(N/A)"); | 989 sanDiv.textContent = WebInspector.UIString("(N/A)"); |
| 990 sanDiv.classList.add("empty-san"); | 990 sanDiv.classList.add("empty-san"); |
| 991 } else { | 991 } else { |
| 992 var truncatedNumToShow = 2; | 992 var truncatedNumToShow = 2; |
| 993 var listIsTruncated = sanList.length > truncatedNumToShow + 1; | 993 var listIsTruncated = sanList.length > truncatedNumToShow + 1; |
| 994 for (var i = 0; i < sanList.length; i++) { | 994 for (var i = 0; i < sanList.length; i++) { |
| 995 var span = sanDiv.createChild("span", "san-entry"); | 995 var span = sanDiv.createChild("span", "san-entry"); |
| 996 span.textContent = sanList[i]; | 996 span.textContent = sanList[i]; |
| 997 if (listIsTruncated && i >= truncatedNumToShow) | 997 if (listIsTruncated && i >= truncatedNumToShow) |
| 998 span.classList.add("truncated-entry"); | 998 span.classList.add("truncated-entry"); |
| 999 } | 999 } |
| 1000 if (listIsTruncated) { | 1000 if (listIsTruncated) { |
| 1001 var truncatedSANToggle = sanDiv.createChild("div", "link"); | 1001 var truncatedSANToggle = sanDiv.createChild("div", "link"); |
| 1002 truncatedSANToggle.href = ""; | 1002 truncatedSANToggle.href = ""; |
| 1003 | 1003 |
| 1004 function toggleSANTruncation() | 1004 function toggleSANTruncation() |
| 1005 { | 1005 { |
| 1006 if (sanDiv.classList.contains("truncated-san")) { | 1006 if (sanDiv.classList.contains("truncated-san")) { |
| 1007 sanDiv.classList.remove("truncated-san") | 1007 sanDiv.classList.remove("truncated-san"); |
| 1008 truncatedSANToggle.textContent = WebInspector.UIString("
Show less"); | 1008 truncatedSANToggle.textContent = WebInspector.UIString("
Show less"); |
| 1009 } else { | 1009 } else { |
| 1010 sanDiv.classList.add("truncated-san"); | 1010 sanDiv.classList.add("truncated-san"); |
| 1011 truncatedSANToggle.textContent = WebInspector.UIString("
Show more (%d total)", sanList.length); | 1011 truncatedSANToggle.textContent = WebInspector.UIString("
Show more (%d total)", sanList.length); |
| 1012 } | 1012 } |
| 1013 } | 1013 } |
| 1014 truncatedSANToggle.addEventListener("click", toggleSANTruncation
, false); | 1014 truncatedSANToggle.addEventListener("click", toggleSANTruncation
, false); |
| 1015 toggleSANTruncation(); | 1015 toggleSANTruncation(); |
| 1016 } | 1016 } |
| 1017 } | 1017 } |
| 1018 return sanDiv; | 1018 return sanDiv; |
| 1019 }, | 1019 }, |
| 1020 | 1020 |
| 1021 /** | 1021 /** |
| 1022 * @param {!SecurityAgent.SecurityState} newSecurityState | 1022 * @param {!SecurityAgent.SecurityState} newSecurityState |
| 1023 */ | 1023 */ |
| 1024 setSecurityState: function(newSecurityState) | 1024 setSecurityState: function(newSecurityState) |
| 1025 { | 1025 { |
| 1026 for (var className of Array.prototype.slice.call(this._originLockIcon.cl
assList)) { | 1026 for (var className of Array.prototype.slice.call(this._originLockIcon.cl
assList)) { |
| 1027 if (className.startsWith("security-property-")) | 1027 if (className.startsWith("security-property-")) |
| 1028 this._originLockIcon.classList.remove(className); | 1028 this._originLockIcon.classList.remove(className); |
| 1029 } | 1029 } |
| 1030 | 1030 |
| 1031 this._originLockIcon.classList.add("security-property-" + newSecuritySta
te); | 1031 this._originLockIcon.classList.add("security-property-" + newSecuritySta
te); |
| 1032 }, | 1032 }, |
| 1033 | 1033 |
| 1034 __proto__: WebInspector.VBox.prototype | 1034 __proto__: WebInspector.VBox.prototype |
| 1035 } | 1035 }; |
| 1036 | 1036 |
| 1037 /** | 1037 /** |
| 1038 * @constructor | 1038 * @constructor |
| 1039 */ | 1039 */ |
| 1040 WebInspector.SecurityDetailsTable = function() | 1040 WebInspector.SecurityDetailsTable = function() |
| 1041 { | 1041 { |
| 1042 this._element = createElement("table"); | 1042 this._element = createElement("table"); |
| 1043 this._element.classList.add("details-table"); | 1043 this._element.classList.add("details-table"); |
| 1044 } | 1044 }; |
| 1045 | 1045 |
| 1046 WebInspector.SecurityDetailsTable.prototype = { | 1046 WebInspector.SecurityDetailsTable.prototype = { |
| 1047 | 1047 |
| 1048 /** | 1048 /** |
| 1049 * @return: {!Element} | 1049 * @return: {!Element} |
| 1050 */ | 1050 */ |
| 1051 element: function() | 1051 element: function() |
| 1052 { | 1052 { |
| 1053 return this._element; | 1053 return this._element; |
| 1054 }, | 1054 }, |
| 1055 | 1055 |
| 1056 /** | 1056 /** |
| 1057 * @param {string} key | 1057 * @param {string} key |
| 1058 * @param {string|!Node} value | 1058 * @param {string|!Node} value |
| 1059 */ | 1059 */ |
| 1060 addRow: function(key, value) | 1060 addRow: function(key, value) |
| 1061 { | 1061 { |
| 1062 var row = this._element.createChild("div", "details-table-row"); | 1062 var row = this._element.createChild("div", "details-table-row"); |
| 1063 row.createChild("div").textContent = key; | 1063 row.createChild("div").textContent = key; |
| 1064 | 1064 |
| 1065 var valueDiv = row.createChild("div"); | 1065 var valueDiv = row.createChild("div"); |
| 1066 if (typeof value === "string") { | 1066 if (typeof value === "string") { |
| 1067 valueDiv.textContent = value; | 1067 valueDiv.textContent = value; |
| 1068 } else { | 1068 } else { |
| 1069 valueDiv.appendChild(value); | 1069 valueDiv.appendChild(value); |
| 1070 } | 1070 } |
| 1071 } | 1071 } |
| 1072 } | 1072 }; |
| OLD | NEW |