Backed out changeset d8cec61d53e8 (bug 1508944) for failures in browser_trackingUI_trackers_subview.js
authorNoemi Erli <nerli@mozilla.com>
Fri, 23 Nov 2018 01:05:18 +0200
changeset 504202 77623171e512127f109569942fd4ae8468d2cf60
parent 504201 c8e66d503efd9abe025e5217198d06f6655e7b6b
child 504203 dc904523f5a381ed77904a2b4db577160a2a4e03
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1508944
milestone65.0a1
backs outd8cec61d53e80441e8b44eb02c0c914595d4c8ab
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
Backed out changeset d8cec61d53e8 (bug 1508944) for failures in browser_trackingUI_trackers_subview.js
browser/base/content/test/trackingUI/browser_trackingUI_animation_2.js
browser/base/content/test/trackingUI/browser_trackingUI_trackers_subview.js
dom/base/nsGlobalWindowOuter.cpp
--- a/browser/base/content/test/trackingUI/browser_trackingUI_animation_2.js
+++ b/browser/base/content/test/trackingUI/browser_trackingUI_animation_2.js
@@ -1,9 +1,8 @@
-/* eslint-disable mozilla/no-arbitrary-setTimeout */
 /*
  * Test that the Content Blocking icon is properly animated in the identity
  * block when loading tabs and switching between tabs.
  * See also Bug 1175858.
  */
 
 const TP_PREF = "privacy.trackingprotection.enabled";
 const TP_PB_PREF = "privacy.trackingprotection.enabled";
@@ -26,17 +25,17 @@ function waitForSecurityChange(tabbrowse
   return new Promise(resolve => {
     let n = 0;
     let listener = {
       onSecurityChange() {
         n = n + 1;
         info("Received onSecurityChange event " + n + " of " + numChanges);
         if (n >= numChanges) {
           tabbrowser.removeProgressListener(listener);
-          resolve(n);
+          resolve();
         }
       },
     };
     tabbrowser.addProgressListener(listener);
   });
 }
 
 async function testTrackingProtectionAnimation(tabbrowser) {
@@ -81,84 +80,76 @@ async function testTrackingProtectionAni
   securityChanged = waitForSecurityChange(tabbrowser);
   tabbrowser.selectedTab = trackingCookiesTab;
   await securityChanged;
 
   ok(ContentBlocking.iconBox.hasAttribute("active"), "iconBox active");
   ok(!ContentBlocking.iconBox.hasAttribute("animate"), "iconBox not animating");
 
   info("Reload tracking cookies tab");
-  securityChanged = waitForSecurityChange(tabbrowser, 3);
+  securityChanged = waitForSecurityChange(tabbrowser, 4);
   tabbrowser.reload();
   await securityChanged;
 
   ok(ContentBlocking.iconBox.hasAttribute("active"), "iconBox active");
   ok(ContentBlocking.iconBox.hasAttribute("animate"), "iconBox animating");
   await BrowserTestUtils.waitForEvent(ContentBlocking.animatedIcon, "animationend");
 
   info("Reload tracking tab");
-  securityChanged = waitForSecurityChange(tabbrowser, 4);
+  securityChanged = waitForSecurityChange(tabbrowser, 5);
   tabbrowser.selectedTab = trackingTab;
   tabbrowser.reload();
   await securityChanged;
 
   ok(ContentBlocking.iconBox.hasAttribute("active"), "iconBox active");
   ok(ContentBlocking.iconBox.hasAttribute("animate"), "iconBox animating");
   await BrowserTestUtils.waitForEvent(ContentBlocking.animatedIcon, "animationend");
 
   info("Inject tracking cookie inside tracking tab");
-  securityChanged = waitForSecurityChange(tabbrowser);
-  let timeoutPromise = new Promise(resolve => setTimeout(resolve, 500));
+  securityChanged = waitForSecurityChange(tabbrowser, 2);
   await ContentTask.spawn(tabbrowser.selectedBrowser, {},
                           function() {
     content.postMessage("cookie", "*");
   });
-  let result = await Promise.race([securityChanged, timeoutPromise]);
-  is(result, undefined, "No securityChange events should be received");
+  await securityChanged;
 
   ok(ContentBlocking.iconBox.hasAttribute("active"), "iconBox active");
   ok(!ContentBlocking.iconBox.hasAttribute("animate"), "iconBox not animating");
 
   info("Inject tracking element inside tracking tab");
   securityChanged = waitForSecurityChange(tabbrowser);
-  timeoutPromise = new Promise(resolve => setTimeout(resolve, 500));
   await ContentTask.spawn(tabbrowser.selectedBrowser, {},
                           function() {
     content.postMessage("tracking", "*");
   });
-  result = await Promise.race([securityChanged, timeoutPromise]);
-  is(result, undefined, "No securityChange events should be received");
+  await securityChanged;
 
   ok(ContentBlocking.iconBox.hasAttribute("active"), "iconBox active");
   ok(!ContentBlocking.iconBox.hasAttribute("animate"), "iconBox not animating");
 
   tabbrowser.selectedTab = trackingCookiesTab;
 
   info("Inject tracking cookie inside tracking cookies tab");
-  securityChanged = waitForSecurityChange(tabbrowser);
-  timeoutPromise = new Promise(resolve => setTimeout(resolve, 500));
+  securityChanged = waitForSecurityChange(tabbrowser, 2);
   await ContentTask.spawn(tabbrowser.selectedBrowser, {},
                           function() {
     content.postMessage("cookie", "*");
   });
-  result = await Promise.race([securityChanged, timeoutPromise]);
-  is(result, undefined, "No securityChange events should be received");
+  await securityChanged;
 
   ok(ContentBlocking.iconBox.hasAttribute("active"), "iconBox active");
   ok(!ContentBlocking.iconBox.hasAttribute("animate"), "iconBox not animating");
 
   info("Inject tracking element inside tracking cookies tab");
-  securityChanged = waitForSecurityChange(tabbrowser);
-  timeoutPromise = new Promise(resolve => setTimeout(resolve, 500));
+  securityChanged = waitForSecurityChange(tabbrowser, 2);
   await ContentTask.spawn(tabbrowser.selectedBrowser, {},
                           function() {
     content.postMessage("tracking", "*");
   });
-  result = await Promise.race([securityChanged, timeoutPromise]);
-  is(result, undefined, "No securityChange events should be received");
+  await securityChanged;
 
   ok(ContentBlocking.iconBox.hasAttribute("active"), "iconBox active");
   ok(!ContentBlocking.iconBox.hasAttribute("animate"), "iconBox not animating");
 
   while (tabbrowser.tabs.length > 1) {
     tabbrowser.removeCurrentTab();
   }
 }
--- a/browser/base/content/test/trackingUI/browser_trackingUI_trackers_subview.js
+++ b/browser/base/content/test/trackingUI/browser_trackingUI_trackers_subview.js
@@ -1,9 +1,8 @@
-/* eslint-disable mozilla/no-arbitrary-setTimeout */
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/trackingUI/trackingPage.html";
 
 const TP_PREF = "privacy.trackingprotection.enabled";
@@ -23,17 +22,17 @@ function waitForSecurityChange(counter) 
   return new Promise(resolve => {
     let webProgressListener = {
       onStateChange: () => {},
       onStatusChange: () => {},
       onLocationChange: () => {},
       onSecurityChange: (webProgress, request, oldState, state) => {
         if (--counter == 0) {
           gBrowser.removeProgressListener(webProgressListener);
-          resolve(counter);
+          resolve();
         }
       },
       onProgressChange: () => {},
       QueryInterface: ChromeUtils.generateQI([Ci.nsIWebProgressListener]),
     };
 
     gBrowser.addProgressListener(webProgressListener);
   });
@@ -63,25 +62,23 @@ async function assertSitesListed(blocked
     let mainView = document.getElementById("identity-popup-mainView");
     viewShown = BrowserTestUtils.waitForEvent(mainView, "ViewShown");
     let backButton = trackersView.querySelector(".subviewbutton-back");
     backButton.click();
     await viewShown;
 
     ok(true, "Main view was shown");
 
-    let change = waitForSecurityChange(1);
-    let timeoutPromise = new Promise(resolve => setTimeout(resolve, 500));
+    let change = waitForSecurityChange(2);
 
     await ContentTask.spawn(browser, {}, function() {
       content.postMessage("more-tracking", "*");
     });
 
-    let result = await Promise.race([change, timeoutPromise]);
-    is(result, undefined, "No securityChange events should be received");
+    await change;
 
     viewShown = BrowserTestUtils.waitForEvent(trackersView, "ViewShown");
     categoryItem.click();
     await viewShown;
 
     ok(true, "Trackers view was shown");
 
     listItems = Array.from(document.querySelectorAll(".identity-popup-trackersView-list-item"));
--- a/dom/base/nsGlobalWindowOuter.cpp
+++ b/dom/base/nsGlobalWindowOuter.cpp
@@ -5389,21 +5389,16 @@ nsGlobalWindowOuter::NotifyContentBlocki
   }
   const uint32_t oldState = state;
   if (aBlocked) {
     state |= aState;
   } else if (unblocked) {
     state &= ~aState;
   }
 
-  if (state == oldState) {
-    // Avoid dispatching repeated notifications when nothing has changed
-    return;
-  }
-
   eventSink->OnSecurityChange(aChannel, oldState, state, doc->GetContentBlockingLog());
 }
 
 //static
 bool
 nsGlobalWindowOuter::SameLoadingURI(nsIDocument *aDoc, nsIChannel *aChannel)
 {
   nsCOMPtr<nsIURI> docURI = aDoc->GetDocumentURI();