Skip to content

Commit

Permalink
Stick in callback so Nt works
Browse files Browse the repository at this point in the history
 - This fix enables `2t` to open two new tabs, even in incognito.
Include callback in the call chain so that numbered commands can work.
  • Loading branch information
wadkar committed Mar 1, 2015
1 parent e2e311f commit 6901f4e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions background_scripts/main.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,10 @@ openUrlInCurrentTab = (request) ->
#
# Opens request.url in new tab and switches to it if request.selected is true.
#
openUrlInNewTab = (request) ->
openUrlInNewTab = (request, callback) ->
chrome.tabs.getSelected(null, (tab) ->
chrome.tabs.create({ url: Utils.convertToUrl(request.url), index: tab.index + 1, selected: true, windowId: tab.windowId }))
chrome.tabs.create({ url: Utils.convertToUrl(request.url), index: tab.index + 1, selected: true, windowId: tab.windowId },
(tab) -> callback()))

openUrlInIncognito = (request) ->
chrome.windows.create({ url: Utils.convertToUrl(request.url), incognito: true})
Expand Down Expand Up @@ -231,7 +232,7 @@ moveTab = (callback, direction) ->
# These are commands which are bound to keystroke which must be handled by the background page. They are
# mapped in commands.coffee.
BackgroundCommands =
createTab: (callback) -> openUrlInNewTab({ url: Settings.get("newTabUrl") })
createTab: (callback) -> openUrlInNewTab({ url: Settings.get("newTabUrl") }, (tab) -> callback())
duplicateTab: (callback) ->
chrome.tabs.getSelected(null, (tab) ->
chrome.tabs.duplicate(tab.id)
Expand Down

0 comments on commit 6901f4e

Please sign in to comment.