Bug 1488635 - Add a test with the cookie permission for the image cache case, r=ehsan

This commit is contained in:
Andrea Marchesini 2018-09-06 11:13:04 +02:00
Родитель 615ca69711
Коммит 694c3887e6
9 изменённых файлов: 28 добавлений и 1 удалений

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

@ -29,6 +29,7 @@ support-files = server.sjs
[browser_imageCache4.js] [browser_imageCache4.js]
[browser_imageCache5.js] [browser_imageCache5.js]
[browser_imageCache6.js] [browser_imageCache6.js]
[browser_imageCache7.js]
[browser_onBeforeRequestNotificationForTrackingResources.js] [browser_onBeforeRequestNotificationForTrackingResources.js]
[browser_onModifyRequestNotificationForTrackingResources.js] [browser_onModifyRequestNotificationForTrackingResources.js]
[browser_permissionInNormalWindows.js] [browser_permissionInNormalWindows.js]

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

@ -3,6 +3,7 @@ ChromeUtils.import("resource://gre/modules/Services.jsm");
let cookieBehavior = BEHAVIOR_REJECT_TRACKER; let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
let blockingByContentBlocking = false; let blockingByContentBlocking = false;
let blockingByAllowList = false; let blockingByAllowList = false;
let expectedBlockingNotifications = true;
let rootDir = getRootDirectory(gTestPath); let rootDir = getRootDirectory(gTestPath);
let jar = getJar(rootDir); let jar = getJar(rootDir);

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

@ -3,6 +3,7 @@ ChromeUtils.import("resource://gre/modules/Services.jsm");
let cookieBehavior = BEHAVIOR_REJECT_TRACKER; let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
let blockingByContentBlocking = true; let blockingByContentBlocking = true;
let blockingByAllowList = false; let blockingByAllowList = false;
let expectedBlockingNotifications = true;
let rootDir = getRootDirectory(gTestPath); let rootDir = getRootDirectory(gTestPath);
let jar = getJar(rootDir); let jar = getJar(rootDir);

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

@ -3,6 +3,7 @@ ChromeUtils.import("resource://gre/modules/Services.jsm");
let cookieBehavior = BEHAVIOR_REJECT_TRACKER; let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
let blockingByContentBlocking = false; let blockingByContentBlocking = false;
let blockingByAllowList = false; let blockingByAllowList = false;
let expectedBlockingNotifications = true;
let rootDir = getRootDirectory(gTestPath); let rootDir = getRootDirectory(gTestPath);
let jar = getJar(rootDir); let jar = getJar(rootDir);

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

@ -3,6 +3,7 @@ ChromeUtils.import("resource://gre/modules/Services.jsm");
let cookieBehavior = BEHAVIOR_REJECT_TRACKER; let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
let blockingByContentBlocking = true; let blockingByContentBlocking = true;
let blockingByAllowList = true; let blockingByAllowList = true;
let expectedBlockingNotifications = true;
let rootDir = getRootDirectory(gTestPath); let rootDir = getRootDirectory(gTestPath);
let jar = getJar(rootDir); let jar = getJar(rootDir);

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

@ -3,6 +3,7 @@ ChromeUtils.import("resource://gre/modules/Services.jsm");
let cookieBehavior = BEHAVIOR_REJECT_FOREIGN; let cookieBehavior = BEHAVIOR_REJECT_FOREIGN;
let blockingByContentBlocking = true; let blockingByContentBlocking = true;
let blockingByAllowList = true; let blockingByAllowList = true;
let expectedBlockingNotifications = true;
let rootDir = getRootDirectory(gTestPath); let rootDir = getRootDirectory(gTestPath);
let jar = getJar(rootDir); let jar = getJar(rootDir);

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

@ -3,6 +3,7 @@ ChromeUtils.import("resource://gre/modules/Services.jsm");
let cookieBehavior = BEHAVIOR_REJECT_FOREIGN; let cookieBehavior = BEHAVIOR_REJECT_FOREIGN;
let blockingByContentBlocking = false; let blockingByContentBlocking = false;
let blockingByAllowList = false; let blockingByAllowList = false;
let expectedBlockingNotifications = true;
let rootDir = getRootDirectory(gTestPath); let rootDir = getRootDirectory(gTestPath);
let jar = getJar(rootDir); let jar = getJar(rootDir);

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

@ -0,0 +1,19 @@
ChromeUtils.import("resource://gre/modules/Services.jsm");
/* Setting a custom permission for this website */
let uriObj = Services.io.newURI(TEST_DOMAIN);
Services.perms.add(uriObj, "cookie", Services.perms.ALLOW_ACTION);
let cookieBehavior = BEHAVIOR_REJECT_TRACKER;
let blockingByContentBlocking = false;
let blockingByAllowList = false;
let expectedBlockingNotifications = false;
let rootDir = getRootDirectory(gTestPath);
let jar = getJar(rootDir);
if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path + "/";
}
/* import-globals-from imageCacheWorker.js */
Services.scriptloader.loadSubScript(rootDir + "imageCacheWorker.js", this);

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

@ -43,7 +43,8 @@ AntiTracking.runTest("Image cache - should load the image twice.",
null, // cleanup function null, // cleanup function
null, // no extra prefs null, // no extra prefs
false, // no window open test false, // no window open test
false // no user-interaction test false, // no user-interaction test
expectedBlockingNotifications
); );
// We still want to see just 2 requests. // We still want to see just 2 requests.