Bug 1287007 - Work-around for test failure in test_ext_cookies.html r=billm
authorRob Wu <rob@robwu.nl>
Wed, 12 Oct 2016 19:13:46 +0200
changeset 428733 f10221d238ac3f5bb4e0f2a00591291d4ee4cee9
parent 428732 434598e8b200a661b6a4dafb667ad9299ed92396
child 428734 c0a8fecacb46f22d16205470dfdeb5e6aea815f8
push id33405
push userbcampen@mozilla.com
push dateMon, 24 Oct 2016 15:32:53 +0000
reviewersbillm
bugs1287007, 1309637
milestone52.0a1
Bug 1287007 - Work-around for test failure in test_ext_cookies.html r=billm There is a timing-sensitive bug in window.create and/or cookies API. I haven't figured out the exact details, but created a minimal test case and reported it at bugzil.la/1309637 Without this patch, the test will fail as described in that bug report. MozReview-Commit-ID: DiJOao8h8Q7
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
@@ -172,19 +172,24 @@ add_task(function* test_cookies() {
       assertExpected({url: TEST_URL, name: "name1", storeId: STORE_ID}, details);
       return browser.cookies.set({url: TEST_URL});
     }).then(cookie => {
       browser.test.assertEq("", cookie.name, "default name set");
       browser.test.assertEq("", cookie.value, "default value set");
       browser.test.assertEq(true, cookie.session, "no expiry date created session cookie");
       return browser.windows.create({incognito: true});
     }).then(privateWindow => {
+      // Hacky work-around for bugzil.la/1309637
+      return new Promise(resolve => setTimeout(resolve, 700, privateWindow));
+    }).then(privateWindow => {
       return browser.cookies.set({url: TEST_URL, name: "store", value: "private", expirationDate: THE_FUTURE, storeId: PRIVATE_STORE_ID}).then(cookie => {
+        browser.test.assertEq("private", cookie.value, "set the private cookie");
         return browser.cookies.set({url: TEST_URL, name: "store", value: "default", expirationDate: THE_FUTURE, storeId: STORE_ID});
       }).then(cookie => {
+        browser.test.assertEq("default", cookie.value, "set the default cookie");
         return browser.cookies.get({url: TEST_URL, name: "store", storeId: PRIVATE_STORE_ID});
       }).then(cookie => {
         browser.test.assertEq("private", cookie.value, "get the private cookie");
         browser.test.assertEq(PRIVATE_STORE_ID, cookie.storeId, "get the private cookie storeId");
         return browser.cookies.get({url: TEST_URL, name: "store", storeId: STORE_ID});
       }).then(cookie => {
         browser.test.assertEq("default", cookie.value, "get the default cookie");
         browser.test.assertEq(STORE_ID, cookie.storeId, "get the default cookie storeId");