From 4f86d30f4a0435d05d995e345508dca66c7a68da Mon Sep 17 00:00:00 2001 From: sainaen Date: Thu, 9 May 2013 00:22:08 +0300 Subject: Fix utils.getCurrentVersion() The code of this function before patch doesn't work for two reasons: 1) it makes async call, so it actually returns `undefined` 2) you need appropriate permission to call chrome.management.get() in manifest --- lib/utils.coffee | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/utils.coffee b/lib/utils.coffee index f089f89d..8d588a43 100644 --- a/lib/utils.coffee +++ b/lib/utils.coffee @@ -1,8 +1,6 @@ Utils = getCurrentVersion: -> - chrome.management.get(chrome.i18n.getMessage('@@extension_id'), (info) -> - info.version - ) + chrome.runtime.getManifest().version # Takes a dot-notation object string and call the function # that it points to with the correct value for 'this'. -- cgit v1.2.3 From 453d35f24b77fc92c7aaf61f625878ea9848e9c6 Mon Sep 17 00:00:00 2001 From: sainaen Date: Thu, 9 May 2013 00:34:30 +0300 Subject: Add runtime.getManifest() stub to Chrome mock --- tests/dom_tests/chrome.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/dom_tests/chrome.coffee b/tests/dom_tests/chrome.coffee index c8ec9d29..71d0c572 100644 --- a/tests/dom_tests/chrome.coffee +++ b/tests/dom_tests/chrome.coffee @@ -17,4 +17,7 @@ root.chrome = { } sendMessage: -> } + runtime: { + getManifest: -> + } } -- cgit v1.2.3