Bug 1416984 - Remove all cookies at the beginning of test_ext_cookies.html, r?mixedpuppy
This test was failing when running locally during the second run (i.e., the non-oop run).
The problem ocurred because the cookies created during the first run were not removed
prior to the second run. This patch adds code to clean up any existing cookies before
running the test.
MozReview-Commit-ID: LieSZDudawN
--- a/toolkit/components/extensions/test/mochitest/test_ext_cookies.html
+++ b/toolkit/components/extensions/test/mochitest/test_ext_cookies.html
@@ -74,16 +74,19 @@ add_task(async function test_cookies() {
path: "/",
secure: false,
httpOnly: false,
session: false,
expirationDate: THE_FUTURE,
storeId: STORE_ID,
};
+ // Remove all cookies before starting the test.
+ await browser.browsingData.removeCookies({});
+
let cookie = await browser.cookies.set({url: TEST_URL, name: "name1", value: "value1", expirationDate: THE_FUTURE});
assertExpected(expected, cookie);
cookie = await browser.cookies.get({url: TEST_URL, name: "name1"});
assertExpected(expected, cookie);
let cookies = await browser.cookies.getAll({name: "name1"});
browser.test.assertEq(cookies.length, 1, "one cookie found for matching name");
@@ -254,17 +257,17 @@ add_task(async function test_cookies() {
}
browser.test.notifyPass("cookies");
}
let extension = ExtensionTestUtils.loadExtension({
background,
manifest: {
- permissions: ["cookies", "*://example.org/", "webNavigation"],
+ permissions: ["cookies", "*://example.org/", "webNavigation", "browsingData"],
},
});
await extension.startup();
await extension.awaitFinish("cookies");
await extension.unload();
});