Skip to content

Commit

Permalink
[Bug #8592] - Improve localStorage feature detection
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasoberrauch committed Sep 18, 2014
1 parent e1687b5 commit aa37aa1
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions framework/source/class/qx/bom/client/Html.js
Expand Up @@ -203,16 +203,13 @@ qx.Bootstrap.define("qx.bom.client.Html",
*/
getLocalStorage : function() {
try {
var has = window.localStorage != null;
// write once to make sure to catch safari's private mode [BUG #7718]
if (has) {
window.sessionStorage.setItem("$qx_check", "test");
window.sessionStorage.removeItem("$qx_check");
}
return has;
window.localStorage.setItem("$qx_check", "test");
window.localStorage.removeItem("$qx_check");
return true;
} catch (exc) {
// Firefox Bug: Local execution of window.sessionStorage throws error
// see https://bugzilla.mozilla.org/show_bug.cgi?id=357323
// Firefox Bug: localStorage doesn't work in file:/// documents
// see https://bugzilla.mozilla.org/show_bug.cgi?id=507361
return false;
}
},
Expand All @@ -226,13 +223,10 @@ qx.Bootstrap.define("qx.bom.client.Html",
*/
getSessionStorage : function() {
try {
var has = window.sessionStorage != null;
// write once to make sure to catch safari's private mode [BUG #7718]
if (has) {
window.sessionStorage.setItem("$qx_check", "test");
window.sessionStorage.removeItem("$qx_check");
}
return has;
window.sessionStorage.setItem("$qx_check", "test");
window.sessionStorage.removeItem("$qx_check");
return true;
} catch (exc) {
// Firefox Bug: Local execution of window.sessionStorage throws error
// see https://bugzilla.mozilla.org/show_bug.cgi?id=357323
Expand Down

0 comments on commit aa37aa1

Please sign in to comment.