[bugzilla-gnome-org-extensions] Work around issues when Firefox is set to ask about cookies
- From: Krzesimir Nowak <krnowak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [bugzilla-gnome-org-extensions] Work around issues when Firefox is set to ask about cookies
- Date: Thu, 20 Nov 2014 22:21:11 +0000 (UTC)
commit 6878b774e1f6984164ac5db21ffb2bef0d88f351
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Mon Sep 28 14:28:38 2009 -0400
Work around issues when Firefox is set to ask about cookies
When Firefox is set to ask about cookies, attempting to access
localStorage throws a security exception. Catch that and pretend
that localStorage isn't there.
js/reviewStorage.js | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/js/reviewStorage.js b/js/reviewStorage.js
index 63939bc..e4185f5 100644
--- a/js/reviewStorage.js
+++ b/js/reviewStorage.js
@@ -22,7 +22,15 @@ function LocalReviewStorage() {
}
LocalReviewStorage.available = function() {
- return 'localStorage' in window && window.localStorage != null;
+ // The try is a workaround for
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=517778
+ // where if cookies are disabled or set to ask, then the first attempt
+ // to access the localStorage property throws a security error.
+ try {
+ return 'localStorage' in window && window.localStorage != null;
+ } catch (e) {
+ return false;
+ }
};
LocalReviewStorage.prototype = {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]