Merge inbound to mozilla-central. a=merge

This commit is contained in:
Ciure Andrei 2019-03-04 23:50:12 +02:00
Родитель bf9d1edd25 3a951ef767
Коммит e97d6d2ed4
2 изменённых файлов: 52 добавлений и 20 удалений

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

@ -21,6 +21,12 @@ async function testIdentityState(hasException) {
let promise = BrowserTestUtils.openNewForegroundTab({url: TRACKING_PAGE, gBrowser});
let [tab] = await Promise.all([promise, waitForContentBlockingEvent()]);
if (hasException) {
let loaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, TRACKING_PAGE);
ContentBlocking.disableForCurrentPage();
await loaded;
}
ok(!ContentBlocking.content.hasAttribute("detected"), "cryptominers are not detected");
ok(BrowserTestUtils.is_hidden(ContentBlocking.iconBox), "icon box is not visible");
@ -37,6 +43,12 @@ async function testIdentityState(hasException) {
is(ContentBlocking.iconBox.hasAttribute("hasException"), hasException,
"Shows an exception when appropriate");
if (hasException) {
let loaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, TRACKING_PAGE);
ContentBlocking.enableForCurrentPage();
await loaded;
}
BrowserTestUtils.removeTab(tab);
}
@ -44,6 +56,12 @@ async function testSubview(hasException) {
let promise = BrowserTestUtils.openNewForegroundTab({url: TRACKING_PAGE, gBrowser});
let [tab] = await Promise.all([promise, waitForContentBlockingEvent()]);
if (hasException) {
let loaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, TRACKING_PAGE);
ContentBlocking.disableForCurrentPage();
await loaded;
}
promise = waitForContentBlockingEvent();
await ContentTask.spawn(tab.linkedBrowser, {}, function() {
content.postMessage("cryptomining", "*");
@ -76,25 +94,23 @@ async function testSubview(hasException) {
ok(true, "Main view was shown");
if (hasException) {
let loaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, TRACKING_PAGE);
ContentBlocking.enableForCurrentPage();
await loaded;
}
BrowserTestUtils.removeTab(tab);
}
add_task(async function test() {
let uri = Services.io.newURI("https://example.org");
Services.prefs.setBoolPref(CM_PREF, true);
await testIdentityState(false);
Services.perms.add(uri, "trackingprotection", Services.perms.ALLOW_ACTION);
// TODO: This currently fails because of bug 1525458, fixing should allow us to re-enable it.
// await testIdentityState(true);
Services.perms.remove(uri, "trackingprotection");
await testIdentityState(true);
await testSubview(false);
Services.perms.add(uri, "trackingprotection", Services.perms.ALLOW_ACTION);
// TODO: This currently fails because of bug 1525458, fixing should allow us to re-enable it.
// await testSubview(true);
Services.perms.remove(uri, "trackingprotection");
await testSubview(true);
Services.prefs.clearUserPref(CM_PREF);
});

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

@ -21,6 +21,12 @@ async function testIdentityState(hasException) {
let promise = BrowserTestUtils.openNewForegroundTab({url: TRACKING_PAGE, gBrowser});
let [tab] = await Promise.all([promise, waitForContentBlockingEvent()]);
if (hasException) {
let loaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, TRACKING_PAGE);
ContentBlocking.disableForCurrentPage();
await loaded;
}
ok(!ContentBlocking.content.hasAttribute("detected"), "fingerprinters are not detected");
ok(BrowserTestUtils.is_hidden(ContentBlocking.iconBox), "icon box is not visible");
@ -37,6 +43,12 @@ async function testIdentityState(hasException) {
is(ContentBlocking.iconBox.hasAttribute("hasException"), hasException,
"Shows an exception when appropriate");
if (hasException) {
let loaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, TRACKING_PAGE);
ContentBlocking.enableForCurrentPage();
await loaded;
}
BrowserTestUtils.removeTab(tab);
}
@ -44,6 +56,12 @@ async function testSubview(hasException) {
let promise = BrowserTestUtils.openNewForegroundTab({url: TRACKING_PAGE, gBrowser});
let [tab] = await Promise.all([promise, waitForContentBlockingEvent()]);
if (hasException) {
let loaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, TRACKING_PAGE);
ContentBlocking.disableForCurrentPage();
await loaded;
}
promise = waitForContentBlockingEvent();
await ContentTask.spawn(tab.linkedBrowser, {}, function() {
content.postMessage("fingerprinting", "*");
@ -76,25 +94,23 @@ async function testSubview(hasException) {
ok(true, "Main view was shown");
if (hasException) {
let loaded = BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, TRACKING_PAGE);
ContentBlocking.enableForCurrentPage();
await loaded;
}
BrowserTestUtils.removeTab(tab);
}
add_task(async function test() {
let uri = Services.io.newURI("https://example.org");
Services.prefs.setBoolPref(FP_PREF, true);
await testIdentityState(false);
Services.perms.add(uri, "trackingprotection", Services.perms.ALLOW_ACTION);
// TODO: This currently fails because of bug 1525458, fixing should allow us to re-enable it.
// await testIdentityState(true);
Services.perms.remove(uri, "trackingprotection");
await testIdentityState(true);
await testSubview(false);
Services.perms.add(uri, "trackingprotection", Services.perms.ALLOW_ACTION);
// TODO: This currently fails because of bug 1525458, fixing should allow us to re-enable it.
// await testSubview(true);
Services.perms.remove(uri, "trackingprotection");
await testSubview(true);
Services.prefs.clearUserPref(FP_PREF);
});