summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--THANKS1
-rw-r--r--share/www/script/futon.js14
2 files changed, 12 insertions, 3 deletions
diff --git a/THANKS b/THANKS
index ebee4845..6472bb1a 100644
--- a/THANKS
+++ b/THANKS
@@ -65,5 +65,6 @@ suggesting improvements or submitting changes. Some of these people are:
* Juhani Ränkimies <juhani@juranki.com>
* Lim Yue Chuan <shasderias@gmail.com>
* David Davis <xantus@xantus.org>
+ * 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);
}