Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Side by Side Diff: chrome/test/data/prerender/prerender_cookie.html

Issue 280403002: Only commit cookie changes in prerenders after a prerender is shown (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: fix sync related bug Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
Added: svn:mime-type
+ text/html
OLDNEW
(Empty)
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 "";
11 }
12
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;
18 }
19
20 function DidPrerenderPass() {
21 // If the prerender did not set a value, everything's fine.
22 if (ExtractGetParameterBadlyAndInsecurely('set', 0) == 0)
23 return true;
24
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;
30 }
31
32 if (ExtractGetParameterBadlyAndInsecurely('set', 0) != 0) {
33 var cookieName = ExtractGetParameterBadlyAndInsecurely('key', "");
34 var cookieValue = ExtractGetParameterBadlyAndInsecurely('value', "");
35 SetCookie(cookieName, cookieValue);
36 }
37
38 document.write(document.cookie);
39
40 </script>
41 <body></body></html>
OLDNEW
« no previous file with comments | « chrome/test/data/android/prerender/homepage.html ('k') | content/browser/renderer_host/render_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698