| <script src="resources/cookies-test-pre.js"></script> |
| <script> |
| description("This test checks that cookies set from a Set-Cookie header in private browsing mode are stored in the same cookie storage as cookies set with document.cookie."); |
| jsTestIsAsync = true; |
| |
| function runTest() { |
| if (window.location.search === "?stepTwo") { |
| debug("Cookies after enabling private browsing (should be empty): " + document.cookie); |
| if (!testCookies("")) { // We're using a different cookie storage now. key1=value1 is still in the default cookie storage. |
| finishJSTest(); |
| return; |
| } |
| document.cookie = "key2=value2"; |
| debug("Cookies after setting in private browsing (should be key2=value2):" + document.cookie); |
| if (!testCookies("key2=value2")) { |
| finishJSTest(); |
| return; |
| } |
| clearCookies(); |
| |
| if (window.testRunner) |
| testRunner.setShouldSwapToDefaultSessionOnNextNavigation(true); |
| window.location = "/cookies/private-cookie-storage.html?stepThree"; |
| } else if (window.location.search === "?stepThree") { |
| debug("Cookies after disabling private browsing (should be key1=value1):" + document.cookie); |
| testCookies("key1=value1"); |
| finishJSTest(); |
| } else { |
| debug("Cookies before setting (should be empty):" + document.cookie); |
| |
| document.cookie = "key1=value1"; |
| debug("Cookies before enabling private browsing (should be key1=value1):" + document.cookie); |
| if (!testCookies("key1=value1")) { |
| finishJSTest(); |
| return; |
| } |
| |
| if (window.testRunner) |
| testRunner.setShouldSwapToEphemeralSessionOnNextNavigation(true); |
| window.location = "/cookies/private-cookie-storage.html?stepTwo"; |
| } |
| } |
| |
| onload = runTest; |
| </script> |
| <script src="resources/cookies-test-post.js"></script> |