Do not announce robot account token before account ID is available
[chromium-blink-merge.git] / chrome / test / data / prerender / prerender_cookie.html
blobd57433b10fa1e158bbc767fb3fe5cdc29cd0a4de
1 <html>
2 <meta http-equiv="expires" content="0">
3 <script src="prerender_events_common.js"></script>
4 <script>
5 function GetCookie(cookieName) {
6 var re = RegExp(cookieName + '=([^;]*)');
7 var result = re.exec(document.cookie);
8 if (result)
9 return result[1];
10 return "";
13 function SetCookie(cookieName, cookieValue) {
14 var exp = "Tue, 31 Dec 2030 23:59:59 GMT";
15 if (cookieValue == "")
16 exp = "Thu, 01 Jan 1970 00:00:00 GMT";
17 document.cookie = cookieName + "=" + cookieValue + "; expires=" + exp;
20 function DidPrerenderPass() {
21 // If the prerender did not set a value, everything's fine.
22 if (ExtractGetParameterBadlyAndInsecurely('set', 0) == 0)
23 return true;
25 // If the prerender set a cookie, querying it again should yield the same
26 // value that was set during the request.
27 var cookieName = ExtractGetParameterBadlyAndInsecurely('key', "");
28 var cookieValue = ExtractGetParameterBadlyAndInsecurely('value', "");
29 return GetCookie(cookieName) == cookieValue;
32 if (ExtractGetParameterBadlyAndInsecurely('set', 0) != 0) {
33 var cookieName = ExtractGetParameterBadlyAndInsecurely('key', "");
34 var cookieValue = ExtractGetParameterBadlyAndInsecurely('value', "");
35 SetCookie(cookieName, cookieValue);
38 document.write(document.cookie);
40 </script>
41 <body></body></html>