Bug 884132 - Make use of .isTopLevel now fix to bug 666801 has landed. r=Neil
authorEdmund Wong <ewong@pw-wspx.org>
Tue, 16 Jul 2013 14:42:17 -0400
changeset 12574 e6997dbb9d67b89ff8e82bc8a529426b7bdd0a59
parent 12573 5528186da5a0a185010949852ea6f5ff56595854
child 12575 bb45585aa2f5dfa8c2e7bfde957c39157c659a55
push id1000
push userbugzilla@standard8.plus.com
push dateMon, 16 Sep 2013 20:21:48 +0000
treeherdercomm-esr52@5d0fb1691835 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersNeil
bugs884132, 666801
Bug 884132 - Make use of .isTopLevel now fix to bug 666801 has landed. r=Neil
suite/browser/nsBrowserStatusHandler.js
suite/browser/tabbrowser.xml
suite/common/src/nsSuiteGlue.js
--- a/suite/browser/nsBrowserStatusHandler.js
+++ b/suite/browser/nsBrowserStatusHandler.js
@@ -187,17 +187,17 @@ nsBrowserStatusHandler.prototype =
     var ctype;
     if (aStateFlags & nsIWebProgressListener.STATE_START) {
       // This (thanks to the filter) is a network start or the first
       // stray request (the first request outside of the document load),
       // initialize the throbber and his friends.
 
       // Call start document load listeners (only if this is a network load)
       if (aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK &&
-          aRequest && aWebProgress.DOMWindow == content)
+          aRequest && aWebProgress.isTopLevel)
         this.startDocumentLoad(aRequest);
 
       if (!(aStateFlags & nsIWebProgressListener.STATE_RESTORING)) {
         // Show the progress meter
         this.statusPanel.collapsed = false;
         // Turn the throbber on.
         this.throbberElement.setAttribute("busy", "true");
       }
@@ -205,17 +205,17 @@ nsBrowserStatusHandler.prototype =
       // XXX: These need to be based on window activity...
       this.stopButton.disabled = false;
       this.stopMenu.removeAttribute('disabled');
       this.stopContext.removeAttribute('disabled');
     }
     else if (aStateFlags & nsIWebProgressListener.STATE_STOP) {
       if (aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
         if (aRequest) {
-          if (aWebProgress.DOMWindow == content)
+          if (aWebProgress.isTopLevel)
             this.endDocumentLoad(aRequest, aStatus);
         }
       }
 
       // This (thanks to the filter) is a network stop or the last
       // request stop outside of loading the document, stop throbbers
       // and progress bars and such
       if (aRequest) {
@@ -262,33 +262,33 @@ nsBrowserStatusHandler.prototype =
     }
   },
 
   onLocationChange : function(aWebProgress, aRequest, aLocation, aFlags)
   {
     const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
     if (gContextMenu) {
       // Optimise for the common case
-      if (aWebProgress.DOMWindow == content)
+      if (aWebProgress.isTopLevel)
         document.getElementById("contentAreaContextMenu").hidePopup();
       else {
         for (var contextWindow = gContextMenu.target.ownerDocument.defaultView;
              contextWindow != contextWindow.parent;
              contextWindow = contextWindow.parent) {
           if (contextWindow == aWebProgress.DOMWindow) {
             document.getElementById("contentAreaContextMenu").hidePopup();
             break;
           }
         }
       }
     }
 
    if (document.tooltipNode) {
      // Optimise for the common case
-     if (aWebProgress.DOMWindow == content) {
+     if (aWebProgress.isTopLevel) {
        document.getElementById("aHTMLTooltip").hidePopup();
        document.tooltipNode = null;
      } else {
        for (var tooltipWindow = document.tooltipNode.ownerDocument.defaultView;
             tooltipWindow != tooltipWindow.parent;
             tooltipWindow = tooltipWindow.parent) {
          if (tooltipWindow == aWebProgress.DOMWindow) {
            document.getElementById("aHTMLTooltip").hidePopup();
@@ -318,17 +318,17 @@ nsBrowserStatusHandler.prototype =
       this.isImage.setAttribute('disabled', 'true');
 
     // We should probably not do this if the value has changed since the user
     // searched
     // Update urlbar only if a new page was loaded on the primary content area
     // Do not update urlbar if there was a subframe navigation
 
     var browser = getBrowser().selectedBrowser;
-    if (aWebProgress.DOMWindow == content) {
+    if (aWebProgress.isTopLevel) {
       var userTypedValue = browser.userTypedValue;
       if (userTypedValue === null) {
         URLBarSetURI(aLocation, true);
       } else {
         this.urlBar.value = userTypedValue;
         SetPageProxyState("invalid", null);
       }
 
--- a/suite/browser/tabbrowser.xml
+++ b/suite/browser/tabbrowser.xml
@@ -454,31 +454,31 @@
                 // It's okay to clear what the user typed when we start
                 // loading a document. If the user types, this flag gets
                 // set to false, if the document load ends without an
                 // onLocationChange, this flag also gets set to false
                 // (so we keep it while switching tabs after a failed load).
                 // We need to add 2 because loadURIWithFlags may have
                 // cancelled a pending load which would have cleared
                 // its anchor scroll detection temporary increment.
-                if (aWebProgress.DOMWindow == this.mBrowser.contentWindow)
+                if (aWebProgress.isTopLevel)
                   this.mBrowser.userTypedClear += 2;
 
                 if (!this.mBlank && !(aStateFlags & nsIWebProgressListener.STATE_RESTORING)) {
                   this.mTab.removeAttribute("progress");
                   this.mTab.setAttribute("busy", "true");
                   this.mTab.label = this.mTabBrowser.mStringBundle.getString("tabs.loading");
                   this.mTab.removeAttribute("image");
                 }
               }
               else if (aStateFlags & nsIWebProgressListener.STATE_STOP &&
                        aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
                 // The document is done loading, it's okay to clear
                 // the value again.
-                if (aWebProgress.DOMWindow == this.mBrowser.contentWindow)
+                if (aWebProgress.isTopLevel)
                   if (this.mBrowser.userTypedClear > 1)
                     this.mBrowser.userTypedClear -= 2;
                   else if (this.mBrowser.userTypedClear > 0)
                     this.mBrowser.userTypedClear--;
 
                 if (this.mBlank)
                   this.mBlank = false;
 
@@ -536,17 +536,17 @@
             },
 
             // The first location change is gotoIndex called from mInstallSH,
             // the second one is considered a user action.
             mLocationChangeCount : 0,
 
             onLocationChange: function(aWebProgress, aRequest, aLocation, aFlags) {
               const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
-              if (aWebProgress.DOMWindow == this.mBrowser.contentWindow) {
+              if (aWebProgress.isTopLevel) {
                 if (!(aFlags & nsIWebProgressListener.LOCATION_CHANGE_SAME_DOCUMENT)) {
                   this.mBrowser.mIconURL = "";
                   this.mFeeds = [];
                 }
 
                 if (this.mLocationChangeCount > 0 ||
                     aLocation.spec != "about:blank")
                   ++this.mLocationChangeCount;
@@ -841,17 +841,17 @@
               function notifyUrlBar(element) {
                 try {
                   if ("onLocationChange" in element)
                     element.onLocationChange(aWebProgress, aRequest, aLocation, aFlags);
                   // If switching tabs, the security may have changed.
                   if (aSecurityUI && "onSecurityChange" in element)
                     element.onSecurityChange(aWebProgress, null, aSecurityUI.state);
                   // If the document already exists, just resend cached data.
-                  if (!aRequest && aWebProgress.DOMWindow == aBrowser.contentWindow) {
+                  if (!aRequest && aWebProgress.isTopLevel) {
                     if (aBrowser.mIconURL && "onLinkIconAvailable" in element)
                       element.onLinkIconAvailable(aBrowser.mIconURL);
                     if ("onFeedAvailable" in element) {
                       aFeeds.forEach(
                         function notifyFeedAvailable(feed) {
                           element.onFeedAvailable(feed);
                         }
                       );
--- a/suite/common/src/nsSuiteGlue.js
+++ b/suite/common/src/nsSuiteGlue.js
@@ -230,17 +230,17 @@ SuiteGlue.prototype = {
           ss.currentEngine = ss.defaultEngine;
         break;
     }
   },
 
   // nsIWebProgressListener partial implementation
   onLocationChange: function(aWebProgress, aRequest, aLocation, aFlags)
   {
-    if (aWebProgress.DOMWindow.top == aWebProgress.DOMWindow &&
+    if (aWebProgress.isTopLevel &&
         aWebProgress instanceof Components.interfaces.nsIDocShell &&
         aWebProgress.loadType & Components.interfaces.nsIDocShell.LOAD_CMD_NORMAL &&
         aWebProgress.useGlobalHistory &&
         aWebProgress instanceof Components.interfaces.nsILoadContext &&
         !aWebProgress.usePrivateBrowsing) {
       switch (aLocation.scheme) {
         case "about":
         case "imap":