From 701c2ab36c880276525c81b48029deb8620ec307 Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Thu, 19 Oct 2017 16:54:31 +0100 Subject: (FF android) Guard against undefined chrome.windows --- background_scripts/marks.coffee | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'background_scripts/marks.coffee') diff --git a/background_scripts/marks.coffee b/background_scripts/marks.coffee index a6491b9e..77b07b41 100644 --- a/background_scripts/marks.coffee +++ b/background_scripts/marks.coffee @@ -82,7 +82,7 @@ Marks = # Given a list of tabs candidate tabs, pick one. Prefer tabs in the current window and tabs with shorter # (matching) URLs. pickTab: (tabs, callback) -> - chrome.windows.getCurrent ({ id }) -> + tabPicker = ({ id }) -> # Prefer tabs in the current window, if there are any. tabsInWindow = tabs.filter (tab) -> tab.windowId == id tabs = tabsInWindow if 0 < tabsInWindow.length @@ -92,6 +92,10 @@ Marks = # Prefer shorter URLs. tabs.sort (a,b) -> a.url.length - b.url.length callback tabs[0] + if chrome.windows? + chrome.windows.getCurrent tabPicker + else + tabPicker({id: undefined}) root = exports ? window root.Marks = Marks -- cgit v1.2.3