From bfe304932b13eb1bfe65662490d3d6b830eefec7 Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Mon, 27 Apr 2015 19:58:10 +0100 Subject: Only perform settings migration in the background page --- lib/utils.coffee | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib') 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) -> -- cgit v1.2.3