aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authormrmr19932017-09-07 12:55:57 +0100
committermrmr19932017-09-12 11:42:35 +0100
commit504e63cd9a833b236b3d7f87ea71d58707db8804 (patch)
tree3f1487d69a7e2597c67d5248301b952ee50c0903 /lib
parent4d148a48ec375db2dc86f09f274bf5c3f76cce39 (diff)
downloadvimium-504e63cd9a833b236b3d7f87ea71d58707db8804.tar.bz2
Use browser.runtime.getBrowserInfo to identify Firefox
Diffstat (limited to 'lib')
-rw-r--r--lib/utils.coffee8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/utils.coffee b/lib/utils.coffee
index 520d5b8c..93cc3246 100644
--- a/lib/utils.coffee
+++ b/lib/utils.coffee
@@ -7,7 +7,13 @@ window.forTrusted ?= (handler) -> (event) ->
true
Utils =
- isFirefox: -> 0 <= navigator.userAgent.indexOf "Firefox"
+ isFirefox: do ->
+ # NOTE(mrmr1993): This test only works in the background page, this is overwritten by isEnabledForUrl for
+ # content scripts.
+ isFirefox = false
+ browser?.runtime?.getBrowserInfo?()?.then? (browserInfo) ->
+ isFirefox = browserInfo?.name == "Firefox"
+ -> isFirefox
getCurrentVersion: ->
chrome.runtime.getManifest().version