Bug 1416984 - Remove all cookies at the beginning of test_ext_cookies.html, r?mixedpuppy draft
authorBob Silverberg <bsilverberg@mozilla.com>
Wed, 15 Nov 2017 10:00:32 -0500
changeset 698339 f35a09ab57f31dcc8ec6bf59014243379a3246e7
parent 698261 45715ece25fcb064eee4f977ebd842d44a87f22b
child 740347 c5bac46b624949b06cde8e6d114a1073c98f88a5
push id89256
push userbmo:bob.silverberg@gmail.com
push dateWed, 15 Nov 2017 15:01:03 +0000
reviewersmixedpuppy
bugs1416984
milestone59.0a1
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
toolkit/components/extensions/test/mochitest/test_ext_cookies.html
--- 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();
 });