diff options
| author | Stephen Blott | 2016-03-26 12:05:45 +0000 |
|---|---|---|
| committer | Stephen Blott | 2016-03-26 12:05:45 +0000 |
| commit | 135de62c2fecea4eb1ef07c155d339c609b6ad1c (patch) | |
| tree | a648e690de43be25917aa81078f7e945c00a3375 /background_scripts/marks.coffee | |
| parent | ebcfe61f785c9717065d4196b60198c2e10a462d (diff) | |
| parent | 5073fc3005b0cab3b44062d051311a704882d4d5 (diff) | |
| download | vimium-135de62c2fecea4eb1ef07c155d339c609b6ad1c.tar.bz2 | |
Merge pull request #2064 from smblott-github/standardise-background-commands-v2
Perform background commands on the requesting tab (v2)
Diffstat (limited to 'background_scripts/marks.coffee')
| -rw-r--r-- | background_scripts/marks.coffee | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/background_scripts/marks.coffee b/background_scripts/marks.coffee index 70ec1c17..7cdbbf74 100644 --- a/background_scripts/marks.coffee +++ b/background_scripts/marks.coffee @@ -50,7 +50,7 @@ Marks = duration: 1000 else if markInfo.vimiumSecret != vimiumSecret # This is a different Vimium instantiation, so markInfo.tabId is definitely out of date. - @focusOrLaunch markInfo + @focusOrLaunch markInfo, req else # Check whether markInfo.tabId still exists. According to here (https://developer.chrome.com/extensions/tabs), # tab Ids are unqiue within a Chrome session. So, if we find a match, we can use it. @@ -60,7 +60,7 @@ Marks = @gotoPositionInTab markInfo else # The original tab no longer exists. - @focusOrLaunch markInfo + @focusOrLaunch markInfo, req # Focus an existing tab and scroll to the given position within it. gotoPositionInTab: ({ tabId, scrollX, scrollY, markName }) -> @@ -74,7 +74,7 @@ Marks = # The tab we're trying to find no longer exists. We either find another tab with a matching URL and use it, # or we create a new tab. - focusOrLaunch: (markInfo) -> + focusOrLaunch: (markInfo, req) -> chrome.tabs.query { url: markInfo.url }, (tabs) => if 0 < tabs.length # We have a matching tab: use it (prefering, if there are more than one, one in the current window). @@ -82,7 +82,7 @@ Marks = @gotoPositionInTab extend markInfo, tabId: tab.id else # There is no existing matching tab, we'll have to create one. - TabOperations.openUrlInNewTab { url: @getBaseUrl markInfo.url }, (tab) => + TabOperations.openUrlInNewTab (extend req, url: @getBaseUrl markInfo.url), (tab) => # Note. tabLoadedHandlers is defined in "main.coffee". The handler below will be called when the tab # is loaded, its DOM is ready and it registers with the background page. tabLoadedHandlers[tab.id] = => @gotoPositionInTab extend markInfo, tabId: tab.id |
