diff options
author | Jan Lehnardt <jan@apache.org> | 2010-10-18 14:05:44 +0000 |
---|---|---|
committer | Jan Lehnardt <jan@apache.org> | 2010-10-18 14:05:44 +0000 |
commit | b36fa4fbe4f5f62129d8025e0e9df6bc6489a156 (patch) | |
tree | 8b65f642f2c2ec49edaaa7446322ff916b55d44a | |
parent | f95a797c1e69476ee80925e9b345c64cc69571af (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/trunk@1023807 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | THANKS | 1 | ||||
-rw-r--r-- | share/www/script/futon.js | 14 |
2 files changed, 12 insertions, 3 deletions
@@ -69,5 +69,6 @@ suggesting improvements or submitting changes. Some of these people are: * Lim Yue Chuan <shasderias@gmail.com> * David Davis <xantus@xantus.org> * Klaus Trainer <klaus.trainer@web.de> + * Dale Harvey <dale@arandomurl.com> For a list of authors see the `AUTHORS` file. 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); } |