Bug 1590688 - Replace ContentTask.spawn with SpecialPowers.spawn in trackingUI tests. r=timhuang

Differential Revision: https://phabricator.services.mozilla.com/D50176

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nihanth Subramanya 2019-10-23 23:36:58 +00:00
Родитель ede6368cfb
Коммит c1df54d751
10 изменённых файлов: 26 добавлений и 26 удалений

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

@ -134,7 +134,7 @@ async function testTrackingProtectionAnimation(tabbrowser) {
info("Inject tracking cookie inside tracking tab");
securityChanged = waitForSecurityChange(1, tabbrowser.ownerGlobal);
let timeoutPromise = new Promise(resolve => setTimeout(resolve, 500));
await ContentTask.spawn(tabbrowser.selectedBrowser, {}, function() {
await SpecialPowers.spawn(tabbrowser.selectedBrowser, [], function() {
content.postMessage("cookie", "*");
});
let result = await Promise.race([securityChanged, timeoutPromise]);
@ -149,7 +149,7 @@ async function testTrackingProtectionAnimation(tabbrowser) {
info("Inject tracking element inside tracking tab");
securityChanged = waitForSecurityChange(1, tabbrowser.ownerGlobal);
timeoutPromise = new Promise(resolve => setTimeout(resolve, 500));
await ContentTask.spawn(tabbrowser.selectedBrowser, {}, function() {
await SpecialPowers.spawn(tabbrowser.selectedBrowser, [], function() {
content.postMessage("tracking", "*");
});
result = await Promise.race([securityChanged, timeoutPromise]);
@ -166,7 +166,7 @@ async function testTrackingProtectionAnimation(tabbrowser) {
info("Inject tracking cookie inside tracking cookies tab");
securityChanged = waitForSecurityChange(1, tabbrowser.ownerGlobal);
timeoutPromise = new Promise(resolve => setTimeout(resolve, 500));
await ContentTask.spawn(tabbrowser.selectedBrowser, {}, function() {
await SpecialPowers.spawn(tabbrowser.selectedBrowser, [], function() {
content.postMessage("cookie", "*");
});
result = await Promise.race([securityChanged, timeoutPromise]);
@ -181,7 +181,7 @@ async function testTrackingProtectionAnimation(tabbrowser) {
info("Inject tracking element inside tracking cookies tab");
securityChanged = waitForSecurityChange(1, tabbrowser.ownerGlobal);
timeoutPromise = new Promise(resolve => setTimeout(resolve, 500));
await ContentTask.spawn(tabbrowser.selectedBrowser, {}, function() {
await SpecialPowers.spawn(tabbrowser.selectedBrowser, [], function() {
content.postMessage("tracking", "*");
});
result = await Promise.race([securityChanged, timeoutPromise]);

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

@ -36,7 +36,7 @@ add_task(async function testProtectionsButton() {
// When the graph is built it means any messaging has finished,
// we can close the tab.
await ContentTask.spawn(browser, {}, async function() {
await SpecialPowers.spawn(browser, [], async function() {
await ContentTaskUtils.waitForCondition(() => {
let bars = content.document.querySelectorAll(".graph-bar");
return bars.length;

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

@ -146,7 +146,7 @@ async function assertSitesListed(testCase) {
let change = waitForContentBlockingEvent();
let timeoutPromise = new Promise(resolve => setTimeout(resolve, 1000));
await ContentTask.spawn(browser, {}, function() {
await SpecialPowers.spawn(browser, [], function() {
content.postMessage("third-party-cookie", "*");
});
@ -204,7 +204,7 @@ async function assertSitesListed(testCase) {
change = waitForSecurityChange();
timeoutPromise = new Promise(resolve => setTimeout(resolve, 1000));
await ContentTask.spawn(browser, {}, function() {
await SpecialPowers.spawn(browser, [], function() {
content.postMessage("first-party-cookie", "*");
});
@ -379,7 +379,7 @@ add_task(async function testCookiesSubViewAllowedHeuristic() {
);
});
await ContentTask.spawn(browser, {}, function() {
await SpecialPowers.spawn(browser, [], function() {
content.postMessage("window-open", "*");
});
await Promise.all([windowCreated, permChanged]);
@ -430,7 +430,7 @@ add_task(async function testCookiesSubViewAllowedHeuristic() {
);
ok(!listItem.classList.contains("allowed"), "Has removed the allowed class");
await ContentTask.spawn(browser, {}, function() {
await SpecialPowers.spawn(browser, [], function() {
content.postMessage("window-close", "*");
});

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

@ -63,7 +63,7 @@ async function testIdentityState(hasException) {
promise = waitForContentBlockingEvent();
await ContentTask.spawn(tab.linkedBrowser, {}, function() {
await SpecialPowers.spawn(tab.linkedBrowser, [], function() {
content.postMessage("cryptomining", "*");
});
@ -118,7 +118,7 @@ async function testSubview(hasException) {
}
promise = waitForContentBlockingEvent();
await ContentTask.spawn(tab.linkedBrowser, {}, function() {
await SpecialPowers.spawn(tab.linkedBrowser, [], function() {
content.postMessage("cryptomining", "*");
});
await promise;
@ -211,7 +211,7 @@ async function testCategoryItem() {
promise = waitForContentBlockingEvent();
await ContentTask.spawn(tab.linkedBrowser, {}, function() {
await SpecialPowers.spawn(tab.linkedBrowser, [], function() {
content.postMessage("cryptomining", "*");
});

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

@ -10,7 +10,7 @@ add_task(async function test_fetch() {
newTabBrowser
) {
let contentBlockingEvent = waitForContentBlockingEvent();
await ContentTask.spawn(newTabBrowser, null, async function() {
await SpecialPowers.spawn(newTabBrowser, [], async function() {
await content.wrappedJSObject
.test_fetch()
.then(response => Assert.ok(false, "should have denied the request"))

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

@ -63,7 +63,7 @@ async function testIdentityState(hasException) {
promise = waitForContentBlockingEvent();
await ContentTask.spawn(tab.linkedBrowser, {}, function() {
await SpecialPowers.spawn(tab.linkedBrowser, [], function() {
content.postMessage("fingerprinting", "*");
});
@ -137,7 +137,7 @@ async function testCategoryItem() {
promise = waitForContentBlockingEvent();
await ContentTask.spawn(tab.linkedBrowser, {}, function() {
await SpecialPowers.spawn(tab.linkedBrowser, [], function() {
content.postMessage("fingerprinting", "*");
});
@ -189,7 +189,7 @@ async function testSubview(hasException) {
}
promise = waitForContentBlockingEvent();
await ContentTask.spawn(tab.linkedBrowser, {}, function() {
await SpecialPowers.spawn(tab.linkedBrowser, [], function() {
content.postMessage("fingerprinting", "*");
});
await promise;

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

@ -22,16 +22,16 @@ async function waitAndAssertPreferencesShown(_spotlight, identityPopup) {
"Should open about:preferences."
);
await ContentTask.spawn(
await SpecialPowers.spawn(
gBrowser.selectedBrowser,
{ spotlight: _spotlight },
async function({ spotlight }) {
[_spotlight],
async spotlight => {
let doc = content.document;
let section = await ContentTaskUtils.waitForCondition(
() => doc.querySelector(".spotlight"),
"The spotlight should appear."
);
is(
Assert.equal(
section.getAttribute("data-subcategory"),
spotlight,
"The correct section is spotlighted."

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

@ -139,7 +139,7 @@ add_task(async function testFP() {
// Make sure that we correctly strip the query.
let url = TRACKING_PAGE + "?a=b&1=abc&unicode=🦊";
await BrowserTestUtils.withNewTab(url, async function(browser) {
await ContentTask.spawn(browser, {}, function() {
await SpecialPowers.spawn(browser, [], function() {
content.postMessage("fingerprinting", "*");
});
@ -156,7 +156,7 @@ add_task(async function testCM() {
// Make sure that we correctly strip the query.
let url = TRACKING_PAGE + "?a=b&1=abc&unicode=🦊";
await BrowserTestUtils.withNewTab(url, async function(browser) {
await ContentTask.spawn(browser, {}, function() {
await SpecialPowers.spawn(browser, [], function() {
content.postMessage("cryptomining", "*");
});

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

@ -63,7 +63,7 @@ async function testIdentityState(hasException) {
promise = waitForContentBlockingEvent();
await ContentTask.spawn(tab.linkedBrowser, {}, function() {
await SpecialPowers.spawn(tab.linkedBrowser, [], function() {
content.postMessage("socialtracking", "*");
});
@ -114,7 +114,7 @@ async function testSubview(hasException) {
}
promise = waitForContentBlockingEvent();
await ContentTask.spawn(tab.linkedBrowser, {}, function() {
await SpecialPowers.spawn(tab.linkedBrowser, [], function() {
content.postMessage("socialtracking", "*");
});
await promise;
@ -204,7 +204,7 @@ async function testCategoryItem() {
promise = waitForContentBlockingEvent();
await ContentTask.spawn(tab.linkedBrowser, {}, function() {
await SpecialPowers.spawn(tab.linkedBrowser, [], function() {
content.postMessage("socialtracking", "*");
});

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

@ -57,7 +57,7 @@ async function assertSitesListed(blocked) {
let change = waitForSecurityChange(1);
let timeoutPromise = new Promise(resolve => setTimeout(resolve, 1000));
await ContentTask.spawn(tab.linkedBrowser, {}, function() {
await SpecialPowers.spawn(tab.linkedBrowser, [], function() {
content.postMessage("more-tracking", "*");
});