| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <script src="resources/resetCookies.js"></script> | |
| 4 <script> | |
| 5 resetCookies(); | |
| 6 | |
| 7 if (window.testRunner) { | |
| 8 testRunner.dumpAsText(); | |
| 9 testRunner.waitUntilDone(); | |
| 10 } | |
| 11 | |
| 12 window.onmessage = function(evt) | |
| 13 { | |
| 14 if (evt.data != "done") { | |
| 15 alert("Unexpected message: " + evt.data); | |
| 16 return; | |
| 17 } | |
| 18 | |
| 19 runNextTestOrFinish(); | |
| 20 } | |
| 21 | |
| 22 function allowAllCookies() | |
| 23 { | |
| 24 alert("Allowing all cookies"); | |
| 25 if (window.testRunner) | |
| 26 testRunner.setAlwaysAcceptCookies(true); | |
| 27 runNextTestOrFinish(); | |
| 28 } | |
| 29 | |
| 30 function restrictCookies() | |
| 31 { | |
| 32 alert("Restricting to first party only cookies"); | |
| 33 if (window.testRunner) | |
| 34 testRunner.setAlwaysAcceptCookies(false); | |
| 35 runNextTestOrFinish(); | |
| 36 } | |
| 37 | |
| 38 function deleteAllCookies() | |
| 39 { | |
| 40 sendXHR("deleteCookies"); | |
| 41 } | |
| 42 | |
| 43 function echoCookies() | |
| 44 { | |
| 45 window.frames[0].postMessage("showCookies", "*"); | |
| 46 } | |
| 47 | |
| 48 function sendXHR(command) | |
| 49 { | |
| 50 window.frames[0].postMessage("sendXHR " + command, "*"); | |
| 51 } | |
| 52 | |
| 53 function setFooCookie() | |
| 54 { | |
| 55 sendXHR("setFooCookie"); | |
| 56 } | |
| 57 | |
| 58 function setFooAndBarCookies() | |
| 59 { | |
| 60 sendXHR("setFooAndBarCookie"); | |
| 61 } | |
| 62 | |
| 63 function startNewTest() | |
| 64 { | |
| 65 alert("\n"); | |
| 66 runNextTestOrFinish(); | |
| 67 } | |
| 68 | |
| 69 var currentFunction = 0; | |
| 70 var functions = new Array( | |
| 71 startNewTest, allowAllCookies, deleteAllCookies, echoCookies, restrictCookie
s, setFooCookie, echoCookies, | |
| 72 startNewTest, allowAllCookies, deleteAllCookies, echoCookies, restrictCookie
s, setFooAndBarCookies, echoCookies, | |
| 73 startNewTest, allowAllCookies, deleteAllCookies, echoCookies, setFooCookie,
echoCookies, restrictCookies, deleteAllCookies, echoCookies, | |
| 74 startNewTest, allowAllCookies, deleteAllCookies, echoCookies, setFooCookie,
echoCookies, restrictCookies, setFooAndBarCookies, echoCookies | |
| 75 ); | |
| 76 | |
| 77 function runNextTestOrFinish() | |
| 78 { | |
| 79 if (currentFunction >= functions.length) { | |
| 80 if (window.testRunner) { | |
| 81 resetCookies(); | |
| 82 window.frames[0].postMessage("resetCookiesAndNotifyDone", "*"); | |
| 83 } | |
| 84 return; | |
| 85 } | |
| 86 | |
| 87 var functionToRun = currentFunction++; | |
| 88 functions[functionToRun](); | |
| 89 } | |
| 90 | |
| 91 </script> | |
| 92 </head> | |
| 93 <body onload="runNextTestOrFinish();"> | |
| 94 <iframe id='testFrame' src="http://localhost:8000/cookies/resources/third-party-
cookie-relaxing-iframe.html"></iframe> | |
| 95 </body> | |
| 96 </html> | |
| OLD | NEW |