diff options
| author | Sudarshan Wadkar | 2015-02-26 22:53:32 -0500 |
|---|---|---|
| committer | Sudarshan Wadkar | 2015-02-26 22:53:32 -0500 |
| commit | 6be1188dd75891d903f74b814a127878190cad59 (patch) | |
| tree | 0371bcf45743d20bbd4e3bb7b8afcce34b1d4a4a /background_scripts | |
| parent | 243a77854c505b8bbdae7e4822c6239afb904d35 (diff) | |
| download | vimium-6be1188dd75891d903f74b814a127878190cad59.tar.bz2 | |
Fix #1507 Open new tab in incognito mode
- Change openUrlInNewTab to pass selected tab.windowId
- Change createTab to use openUrlInNewTab
Diffstat (limited to 'background_scripts')
| -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) |
