Bug 1281493 - Add another selector for identity popup main view as XBL bindings sometimes have a race condition. Removing surplus identity-popup-security-content selector. draft
authorJonathan Kingston <jkt@mozilla.com>
Tue, 28 Jun 2016 14:18:02 +0100
changeset 381982 5c84f0e3feb50511236739725b0a47e206927e7e
parent 381119 939ecc4e9d055c263633cbe276bfb634a68fe4c5
child 524068 9af40d67641a74f7d4c7a62b912420d0e5950d51
push id21591
push userjkingston@mozilla.com
push dateTue, 28 Jun 2016 15:33:21 +0000
bugs1281493
milestone50.0a1
Bug 1281493 - Add another selector for identity popup main view as XBL bindings sometimes have a race condition. Removing surplus identity-popup-security-content selector. MozReview-Commit-ID: DxAX18vGXHN
browser/base/content/browser.js
browser/base/content/test/general/head.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -6582,23 +6582,35 @@ var gIdentityHandler = {
   get _identityPopup () {
     delete this._identityPopup;
     return this._identityPopup = document.getElementById("identity-popup");
   },
   get _identityBox () {
     delete this._identityBox;
     return this._identityBox = document.getElementById("identity-box");
   },
+  get _identityPopupMultiView () {
+    delete _identityPopupMultiView;
+    return document.getElementById("identity-popup-multiView");
+  },
   get _identityPopupContentHosts () {
     delete this._identityPopupContentHosts;
-    return this._identityPopupContentHosts = [...document.querySelectorAll(".identity-popup-headline.host")];
+    let selector = ".identity-popup-headline.host";
+    return this._identityPopupContentHosts = [
+      ...this._identityPopupMultiView._mainView.querySelectorAll(selector),
+      ...document.querySelectorAll(selector)
+    ];
   },
   get _identityPopupContentHostless () {
     delete this._identityPopupContentHostless;
-    return this._identityPopupContentHostless = [...document.querySelectorAll(".identity-popup-headline.hostless")];
+    let selector = ".identity-popup-headline.hostless";
+    return this._identityPopupContentHostless = [
+      ...this._identityPopupMultiView._mainView.querySelectorAll(selector),
+      ...document.querySelectorAll(selector)
+    ];
   },
   get _identityPopupContentOwner () {
     delete this._identityPopupContentOwner;
     return this._identityPopupContentOwner =
       document.getElementById("identity-popup-content-owner");
   },
   get _identityPopupContentSupp () {
     delete this._identityPopupContentSupp;
@@ -6648,17 +6660,17 @@ var gIdentityHandler = {
    */
   handleMoreInfoClick : function(event) {
     displaySecurityInfo();
     event.stopPropagation();
     this._identityPopup.hidePopup();
   },
 
   toggleSubView(name, anchor) {
-    let view = document.getElementById("identity-popup-multiView");
+    let view = this._identityPopupMultiView;
     if (view.showingSubView) {
       view.showMainView();
     } else {
       view.showSubView(`identity-popup-${name}View`, anchor);
     }
 
     // If an element is focused that's not the anchor, clear the focus.
     // Elements of hidden views have -moz-user-focus:ignore but setting that
--- a/browser/base/content/test/general/head.js
+++ b/browser/base/content/test/general/head.js
@@ -875,17 +875,16 @@ function assertMixedContentBlockingState
   is(popupAttr.includes("passive-loaded"), passiveLoaded,
       "identity-popup has expected attr for passiveLoaded");
   is(bodyAttr.includes("passive-loaded"), passiveLoaded,
       "securityView-body has expected attr for passiveLoaded");
 
   // Make sure the correct icon is visible in the Control Center.
   // This logic is controlled with CSS, so this helps prevent regressions there.
   let securityView = doc.getElementById("identity-popup-securityView");
-  let securityContent = doc.getElementById("identity-popup-security-content");
   let securityViewBG = tabbrowser.ownerGlobal.getComputedStyle(securityView, "").
                        getPropertyValue("background-image");
   let securityContentBG = tabbrowser.ownerGlobal.getComputedStyle(securityView, "").
                           getPropertyValue("background-image");
 
   if (stateInsecure) {
     is(securityViewBG, "url(\"chrome://browser/skin/controlcenter/conn-not-secure.svg\")",
       "CC using 'not secure' icon");