aboutsummaryrefslogtreecommitdiffstats
path: root/lib/utils.coffee
diff options
context:
space:
mode:
authormrmr19932015-04-27 19:58:10 +0100
committermrmr19932015-05-29 12:06:00 +0100
commitbfe304932b13eb1bfe65662490d3d6b830eefec7 (patch)
tree8fb91decfa641fc5eff10c34eb8b7745017b1008 /lib/utils.coffee
parentd7a0daf5fa2c0a3302a8fc6b9fa0744cfa17ab42 (diff)
downloadvimium-bfe304932b13eb1bfe65662490d3d6b830eefec7.tar.bz2
Only perform settings migration in the background page
Diffstat (limited to 'lib/utils.coffee')
-rw-r--r--lib/utils.coffee7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/utils.coffee b/lib/utils.coffee
index 65e26b7a..835b0359 100644
--- a/lib/utils.coffee
+++ b/lib/utils.coffee
@@ -2,6 +2,13 @@ Utils =
getCurrentVersion: ->
chrome.runtime.getManifest().version
+ # Returns true whenever the current page is from the extension's origin (and thus can access the
+ # extension's localStorage).
+ 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
+
# Takes a dot-notation object string and call the function
# that it points to with the correct value for 'this'.
invokeCommandString: (str, argArray) ->