diff options
| author | mrmr1993 | 2017-09-29 18:07:45 +0100 | 
|---|---|---|
| committer | mrmr1993 | 2017-09-29 18:15:28 +0100 | 
| commit | fdc374f0904ddc0179f352aa9b4049c68872768e (patch) | |
| tree | f15f43abb5e5f14f643236d8b65fd2c2b07ae240 /background_scripts/main.coffee | |
| parent | c18d4f065c9529c62a82bc2a3bd518da318d89ff (diff) | |
| download | vimium-fdc374f0904ddc0179f352aa9b4049c68872768e.tar.bz2 | |
Use openerTabId in chrome.tabs.create when possible
Diffstat (limited to 'background_scripts/main.coffee')
| -rw-r--r-- | background_scripts/main.coffee | 13 | 
1 files changed, 6 insertions, 7 deletions
| diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 8afecd4f..10d383f9 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -109,13 +109,12 @@ TabOperations =      tabConfig.active = request.active if request.active?      # Firefox does not support "about:newtab" in chrome.tabs.create.      delete tabConfig["url"] if tabConfig["url"] == Settings.defaults.newTabUrl -    chrome.tabs.create tabConfig, (tab) -> -      # NOTE(mrmr1993, 2017-02-08): Firefox currently doesn't support openerTabId (issue 1238314) and throws -      # a type error if it is present. We work around this by attempting to set it separately from creating -      # the tab. -      try chrome.tabs.update tab.id, { openerTabId : request.tab.id }, callback -      catch -        callback.apply this, arguments + +    # Firefox <57 throws an error when openerTabId is used (issue 1238314). +    canUseOpenerTabId = not (Utils.isFirefox() and Utils.compareVersions(Utils.firefoxVersion(), "57") < 0) +    tabConfig.openerTabId = request.tab.id if canUseOpenerTabId + +    chrome.tabs.create tabConfig, callback    # Opens request.url in new window and switches to it.    openUrlInNewWindow: (request, callback = (->)) -> | 
