From 2ee2da82416e6976b8f41b9a41549bfa128a0e09 Mon Sep 17 00:00:00 2001 From: "chase@chromium.org" Date: Fri, 20 Aug 2010 23:19:33 +0000 Subject: Changed page_cycler to use sessionStorage instead of cookies for timing values. Review URL: http://codereview.chromium.org/3145006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56932 0039d316-1c4b-4281-b951-d872f2087c98 --- tools/page_cycler/common/head.js | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'tools/page_cycler') diff --git a/tools/page_cycler/common/head.js b/tools/page_cycler/common/head.js index 1a4ddc84..f63a56c 100644 --- a/tools/page_cycler/common/head.js +++ b/tools/page_cycler/common/head.js @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -50,10 +50,20 @@ function __pages() { // fetch lazily return this.data; } function __get_timings() { - return __get_cookie("__pc_timings"); + if (sessionStorage == null) + return __get_cookie("__pc_timings"); + else { + if (sessionStorage.getItem("__pc_timings") == null) + return ""; + else + return sessionStorage["__pc_timings"]; + } } function __set_timings(timings) { - document.cookie = "__pc_timings=" + timings + "; path=/"; + if (sessionStorage == null) + document.cookie = "__pc_timings=" + timings + "; path=/"; + else + sessionStorage["__pc_timings"]=timings; } function __ontimeout() { var doc; @@ -74,15 +84,16 @@ function __ontimeout() { } else { doc = "../" + __pages()[__page] + "/index.html" } - + var timings = __tl; var oldTimings = __get_timings(); - if (oldTimings != "") { + if (oldTimings != "") { timings = oldTimings + "," + timings; } __set_timings(timings); - - var url = doc + "?n=" + __iterations + "&i=" + __cycle + "&p=" + __page + "&ts=" + ts + "&td=" + __td + "&tf=" + __tf; + + var url = doc + "?n=" + __iterations + "&i=" + __cycle + "&p=" + __page + + "&ts=" + ts + "&td=" + __td + "&tf=" + __tf; document.location.href = url; } function __onload() { -- cgit v1.1