OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 var __c = ""; // that's good enough for me. | 5 var __c = ""; // that's good enough for me. |
6 var __td; | 6 var __td; |
7 var __tf; | 7 var __tf; |
8 var __tl; | 8 var __tl; |
9 var __iterations; | 9 var __iterations; |
10 var __cycle; | 10 var __cycle; |
11 var __results = false; | 11 var __results = false; |
12 var __page; | 12 var __page; |
13 var __TIMEOUT = 15; | 13 var __TIMEOUT = 15; |
14 function __get_cookie(name) { | 14 function __get_cookie(name) { |
15 var cookies = document.cookie.split("; "); | 15 var cookies = document.cookie.split("; "); |
16 for (var i = 0; i < cookies.length; ++i) { | 16 for (var i = 0; i < cookies.length; ++i) { |
17 var t = cookies[i].split("="); | 17 var t = cookies[i].split("="); |
18 if (t[0] == name && t[1]) | 18 if (t[0] == name && t[1]) |
19 return t[1]; | 19 return t[1]; |
20 } | 20 } |
21 return ""; | 21 return ""; |
22 } | 22 } |
23 function __pages() { // fetch lazily | 23 function __pages() { // fetch lazily |
24 if (!("data" in this)) | 24 if (!("data" in this)) |
25 this.data = __get_cookie("__pc_pages").split(","); | 25 this.data = __get_cookie("__pc_pages").split(","); |
26 return this.data; | 26 return this.data; |
27 } | 27 } |
28 function __get_timings() { | 28 function __get_timings() { |
29 if (sessionStorage == null) | 29 if (sessionStorage != null && |
| 30 sessionStorage.getItem("__pc_timings") != null) { |
| 31 return sessionStorage["__pc_timings"]; |
| 32 } else { |
30 return __get_cookie("__pc_timings"); | 33 return __get_cookie("__pc_timings"); |
31 else { | |
32 if (sessionStorage.getItem("__pc_timings") == null) | |
33 return ""; | |
34 else | |
35 return sessionStorage["__pc_timings"]; | |
36 } | 34 } |
37 } | 35 } |
38 function __set_timings(timings) { | 36 function __set_timings(timings) { |
39 if (sessionStorage == null) | 37 if (sessionStorage == null) |
40 document.cookie = "__pc_timings=" + timings + "; path=/"; | 38 document.cookie = "__pc_timings=" + timings + "; path=/"; |
41 else | 39 else |
42 sessionStorage["__pc_timings"]=timings; | 40 sessionStorage["__pc_timings"]=timings; |
43 } | 41 } |
44 function __ontimeout() { | 42 function __ontimeout() { |
45 var doc; | 43 var doc; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 __te = te; | 119 __te = te; |
122 __tf = tf; // record t-fudge | 120 __tf = tf; // record t-fudge |
123 | 121 |
124 setTimeout("__ontimeout()", __TIMEOUT); | 122 setTimeout("__ontimeout()", __TIMEOUT); |
125 } | 123 } |
126 | 124 |
127 if (window.attachEvent) | 125 if (window.attachEvent) |
128 window.attachEvent("onload", __onload); | 126 window.attachEvent("onload", __onload); |
129 else | 127 else |
130 addEventListener("load", __onload, false); | 128 addEventListener("load", __onload, false); |
OLD | NEW |