summaryrefslogtreecommitdiff
path: root/share/www
diff options
context:
space:
mode:
authorJan Lehnardt <jan@apache.org>2010-10-18 14:08:51 +0000
committerJan Lehnardt <jan@apache.org>2010-10-18 14:08:51 +0000
commit5d0186e008a0d6cdbca0ef37445199fd95bbe559 (patch)
tree03414c40b7051e048ec2b138ee0da829a288c46d /share/www
parent0e6ed4ed4cc45f72bbf68ef99730f71bf0af84f6 (diff)
Avoid occasional stalling of Futon in Firefox.
Closes COUCHDB-896. Patch by Dale Harvey. git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.0.x@1023808 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www')
-rw-r--r--share/www/script/futon.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/share/www/script/futon.js b/share/www/script/futon.js
index b15a5eec..200d6ec5 100644
--- a/share/www/script/futon.js
+++ b/share/www/script/futon.js
@@ -334,6 +334,14 @@ function $$(node) {
return callback(decl);
}
+ function windowName() {
+ try {
+ return JSON.parse(window.name || "{}");
+ } catch (e) {
+ return {};
+ }
+ }
+
// add suffix to cookie names to be able to separate between ports
var cookiePrefix = location.port + "_";
@@ -366,15 +374,15 @@ function $$(node) {
"window": {
get: function(name) {
- return JSON.parse(window.name || "{}")[name];
+ return windowName()[name];
},
set: function(name, value) {
- var obj = JSON.parse(window.name || "{}");
+ var obj = windowName();
obj[name] = value || null;
window.name = JSON.stringify(obj);
},
del: function(name) {
- var obj = JSON.parse(window.name || "{}");
+ var obj = windowName();
delete obj[name];
window.name = JSON.stringify(obj);
}