Bug 1416984 - Remove all cookies at the beginning of test_ext_cookies.html, r=mixedpuppy
authorBob Silverberg <bsilverberg@mozilla.com>
Wed, 15 Nov 2017 10:00:32 -0500
changeset 392225 3c566123d6169f75c7ad844d32ded9889f6e4ef6
parent 392224 d040a96e22130814d441d3292a2e8b005d9f5533
child 392226 ed0cc9f865833b846754863062560c34e4cac3da
push id55499
push userbsilverberg@mozilla.com
push dateThu, 16 Nov 2017 17:42:41 +0000
treeherderautoland@3c566123d616 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmixedpuppy
bugs1416984
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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();
 });