Added fix to prevent some FF versions from throwing errors on localStorage check
git-svn-id: http://svg-edit.googlecode.com/svn/branches/transformlist@931 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
c5467373ef
commit
7c8fafa9ee
|
@ -35,12 +35,22 @@ function svg_edit_setup() {
|
||||||
var host = location.hostname;
|
var host = location.hostname;
|
||||||
var onweb = host && host.indexOf('.') != -1;
|
var onweb = host && host.indexOf('.') != -1;
|
||||||
var store = (val != undefined);
|
var store = (val != undefined);
|
||||||
|
var storage = false;
|
||||||
|
// Some FF versions throw security errors here
|
||||||
|
try {
|
||||||
if(window.localStorage && onweb) {
|
if(window.localStorage && onweb) {
|
||||||
if(store) localStorage.setItem(key, val);
|
storage = localStorage;
|
||||||
else return localStorage.getItem(key);
|
}
|
||||||
} else if(window.globalStorage && onweb) {
|
} catch(e) {}
|
||||||
if(store) globalStorage[host].setItem(key, val);
|
try {
|
||||||
else return globalStorage[host].getItem(key);
|
if(window.globalStorage && onweb) {
|
||||||
|
storage = globalStorage[host];
|
||||||
|
}
|
||||||
|
} catch(e) {}
|
||||||
|
|
||||||
|
if(storage) {
|
||||||
|
if(store) storage.setItem(key, val);
|
||||||
|
else return storage.getItem(key);
|
||||||
} else if(window.widget) {
|
} else if(window.widget) {
|
||||||
if(store) widget.setPreferenceForKey(val, key);
|
if(store) widget.setPreferenceForKey(val, key);
|
||||||
else return widget.preferenceForKey(key);
|
else return widget.preferenceForKey(key);
|
||||||
|
|
Loading…
Reference in New Issue