Bug 1521582 - Only simulate onContentBlockingEvent from onLocationChange for top-level non-samedocument notifications; r=johannh
authorEhsan Akhgari <ehsan@mozilla.com>
Mon, 21 Jan 2019 13:31:25 -0500
changeset 514787 d02c0a90a085a4f75fab25dba9fa305bd97d7532
parent 514786 8ad35cea96d9c6c64c7f6c5e9e8f57a6b04f161a
child 514788 4b841cc68f4d4ad817412290a95290915649773b
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohannh
bugs1521582
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1521582 - Only simulate onContentBlockingEvent from onLocationChange for top-level non-samedocument notifications; r=johannh Differential Revision: https://phabricator.services.mozilla.com/D17145
browser/base/content/tabbrowser.js
--- a/browser/base/content/tabbrowser.js
+++ b/browser/base/content/tabbrowser.js
@@ -5095,18 +5095,18 @@ class TabProgressListener {
   }
   /* eslint-enable complexity */
 
   onLocationChange(aWebProgress, aRequest, aLocation, aFlags) {
     // OnLocationChange is called for both the top-level content
     // and the subframes.
     let topLevel = aWebProgress.isTopLevel;
 
+    let isSameDocument = !!(aFlags & Ci.nsIWebProgressListener.LOCATION_CHANGE_SAME_DOCUMENT);
     if (topLevel) {
-      let isSameDocument = !!(aFlags & Ci.nsIWebProgressListener.LOCATION_CHANGE_SAME_DOCUMENT);
       let isReload = !!(aFlags & Ci.nsIWebProgressListener.LOCATION_CHANGE_RELOAD);
       let isErrorPage = !!(aFlags & Ci.nsIWebProgressListener.LOCATION_CHANGE_ERROR_PAGE);
 
       // We need to clear the typed value
       // if the document failed to load, to make sure the urlbar reflects the
       // failed URI (particularly for SSL errors). However, don't clear the value
       // if the error page's URI is about:blank, because that causes complete
       // loss of urlbar contents for invalid URI errors (see bug 867957).
@@ -5194,20 +5194,22 @@ class TabProgressListener {
           gBrowser._getSwitcher().cleanUpTabAfterEviction(this.mTab);
         }
       }
     }
 
     if (!this.mBlank) {
       this._callProgressListeners("onLocationChange",
                                   [aWebProgress, aRequest, aLocation, aFlags]);
-      // Include the true final argument to indicate that this event is
-      // simulated (instead of being observed by the webProgressListener).
-      this._callProgressListeners("onContentBlockingEvent",
-                                  [aWebProgress, null, 0, true]);
+      if (topLevel && !isSameDocument) {
+        // Include the true final argument to indicate that this event is
+        // simulated (instead of being observed by the webProgressListener).
+        this._callProgressListeners("onContentBlockingEvent",
+                                    [aWebProgress, null, 0, true]);
+      }
     }
 
     if (topLevel) {
       this.mBrowser.lastURI = aLocation;
       this.mBrowser.lastLocationChange = Date.now();
     }
   }