commit eadb5fec07e55a5ec845558711de527d93c7d37b
parent 7b5f74a788ed8eaaaf42e03eb25a622c2f38b1da
Author: Eli Barzilay <eli@racket-lang.org>
Date: Wed, 31 Mar 2010 06:36:58 +0000
Hack for chrome: catch errors when reading/writing cookies
and just treat it as if there is no cookie. This is what
chrome effectively did until recently -- so the relying on
cookies for the return path to the user-specific pages was
and still is broken.
svn: r18684
original commit: 658fc0717d470d0b4f4cf1f19cec4a5ff3336187
Diffstat:
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/collects/scribble/scribble-common.js b/collects/scribble/scribble-common.js
@@ -54,8 +54,11 @@ function MergePageArgsIntoLink(a) {
// Cookies --------------------------------------------------------------------
function GetCookie(key, def) {
- if (document.cookie.length <= 0) return def;
- var i, cookiestrs = document.cookie.split(/; */);
+ var i, cookiestrs;
+ try {
+ if (document.cookie.length <= 0) return def;
+ cookiestrs = document.cookie.split(/; */);
+ } catch (e) { return def; }
for (i = 0; i < cookiestrs.length; i++) {
var cur = cookiestrs[i];
var eql = cur.indexOf('=');
@@ -68,8 +71,10 @@ function GetCookie(key, def) {
function SetCookie(key, val) {
var d = new Date();
d.setTime(d.getTime()+(365*24*60*60*1000));
- document.cookie =
- key + "=" + escape(val) + "; expires="+ d.toGMTString() + "; path=/";
+ try {
+ document.cookie =
+ key + "=" + escape(val) + "; expires="+ d.toGMTString() + "; path=/";
+ } catch (e) {}
}
// note that this always stores a directory name, ending with a "/"