diff options
| -rw-r--r-- | background_scripts/main.coffee | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 647923c0..72b36b0b 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -165,7 +165,9 @@ openUrlInCurrentTab = (request) -> # openUrlInNewTab = (request) -> chrome.tabs.getSelected(null, (tab) -> - chrome.tabs.create({ url: Utils.convertToUrl(request.url), index: tab.index + 1, selected: true })) + # Pass selected tabs windowId to make sure we open in current window. + # Fixes issue #1507 Open new tab in incognito mode should open new tab in same window. + chrome.tabs.create({ url: Utils.convertToUrl(request.url), index: tab.index + 1, selected: true, windowId: tab.windowId })) openUrlInIncognito = (request) -> chrome.windows.create({ url: Utils.convertToUrl(request.url), incognito: true}) @@ -231,7 +233,10 @@ 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) -> chrome.tabs.create({url: Settings.get("newTabUrl")}, (tab) -> callback()) + # Using openUrlInNewTab instead of chrome.tabs.create() because of upstread bug #308171. + # The function openUrlInNewTab now selects the current tab and uses its windowId while + # opening a new tab to force proper window selection. + createTab: (callback) -> openUrlInNewTab({ url: Settings.get("newTabUrl") }) duplicateTab: (callback) -> chrome.tabs.getSelected(null, (tab) -> chrome.tabs.duplicate(tab.id) |
