aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authormrmr19932016-02-03 15:23:02 +0000
committermrmr19932016-02-03 15:23:02 +0000
commitacb0c7010d345a3e4918c4aa33eb1d2bf72cf8da (patch)
tree5759919f94f3cbf4db943bc89798cfd4695cd9e7 /lib
parent674990c07422a61a702f14bfdaa8b3d2f3117f1b (diff)
downloadvimium-acb0c7010d345a3e4918c4aa33eb1d2bf72cf8da.tar.bz2
Move help dialog into an iframe
Diffstat (limited to 'lib')
-rw-r--r--lib/settings.coffee4
-rw-r--r--lib/utils.coffee2
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/settings.coffee b/lib/settings.coffee
index dd1aa377..c127343d 100644
--- a/lib/settings.coffee
+++ b/lib/settings.coffee
@@ -18,8 +18,10 @@ Settings =
onLoadedCallbacks: []
init: ->
- if Utils.isExtensionPage()
+ if Utils.isExtensionPage() and (try localStorage)
# On extension pages, we use localStorage (or a copy of it) as the cache.
+ # For UIComponents (or other content of ours in an iframe within a regular page), we can't access
+ # localStorage, so we check for this too.
@cache = if Utils.isBackgroundPage() then localStorage else extend {}, localStorage
@onLoaded()
diff --git a/lib/utils.coffee b/lib/utils.coffee
index c255102e..4726739b 100644
--- a/lib/utils.coffee
+++ b/lib/utils.coffee
@@ -7,7 +7,7 @@ Utils =
isExtensionPage: -> document.location?.origin + "/" == chrome.extension.getURL ""
# Returns true whenever the current page is the extension's background page.
- isBackgroundPage: -> @isExtensionPage() and chrome.extension.getBackgroundPage() == window
+ isBackgroundPage: -> @isExtensionPage() and try chrome.extension.getBackgroundPage() == window
# Takes a dot-notation object string and call the function
# that it points to with the correct value for 'this'.