Backed out changeset d8cec61d53e8 (bug 1508944) for failures in browser_trackingUI_trackers_subview.js

This commit is contained in:
Noemi Erli 2018-11-23 01:05:18 +02:00
Родитель 458a02325f
Коммит aa166890b9
3 изменённых файлов: 13 добавлений и 30 удалений

Просмотреть файл

@ -1,4 +1,3 @@
/* 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.
@ -31,7 +30,7 @@ function waitForSecurityChange(tabbrowser, numChanges = 1) {
info("Received onSecurityChange event " + n + " of " + numChanges);
if (n >= numChanges) {
tabbrowser.removeProgressListener(listener);
resolve(n);
resolve();
}
},
};
@ -86,7 +85,7 @@ async function testTrackingProtectionAnimation(tabbrowser) {
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;
@ -95,7 +94,7 @@ async function testTrackingProtectionAnimation(tabbrowser) {
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;
@ -105,27 +104,23 @@ async function testTrackingProtectionAnimation(tabbrowser) {
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");
@ -133,27 +128,23 @@ async function testTrackingProtectionAnimation(tabbrowser) {
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");

Просмотреть файл

@ -1,4 +1,3 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
@ -28,7 +27,7 @@ function waitForSecurityChange(counter) {
onSecurityChange: (webProgress, request, oldState, state) => {
if (--counter == 0) {
gBrowser.removeProgressListener(webProgressListener);
resolve(counter);
resolve();
}
},
onProgressChange: () => {},
@ -68,15 +67,13 @@ async function assertSitesListed(blocked) {
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();

Просмотреть файл

@ -5394,11 +5394,6 @@ nsGlobalWindowOuter::NotifyContentBlockingState(unsigned aState,
state &= ~aState;
}
if (state == oldState) {
// Avoid dispatching repeated notifications when nothing has changed
return;
}
eventSink->OnSecurityChange(aChannel, oldState, state, doc->GetContentBlockingLog());
}