diff options
| author | Stephen Blott | 2015-06-04 12:16:06 +0100 | 
|---|---|---|
| committer | Stephen Blott | 2015-06-04 12:16:06 +0100 | 
| commit | cb3d18a8068063050dd25f0db03777b564f1a548 (patch) | |
| tree | c3d7dde09310237b79411cc805c1c1adaded9c6d /background_scripts | |
| parent | 278b03bd14ddad188000e87ec1f60f925f94697b (diff) | |
| download | vimium-cb3d18a8068063050dd25f0db03777b564f1a548.tar.bz2 | |
Global marks; create a new tab, if necessary.
Diffstat (limited to 'background_scripts')
| -rw-r--r-- | background_scripts/main.coffee | 3 | ||||
| -rw-r--r-- | background_scripts/marks.coffee | 5 | 
2 files changed, 7 insertions, 1 deletions
| diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 980f8e18..cbb70c6c 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -35,7 +35,8 @@ namedKeyRegex = /^(<(?:[amc]-.|(?:[amc]-)?[a-z0-9]{2,5})>)(.*)$/  # Event handlers  selectionChangedHandlers = [] -tabLoadedHandlers = {} # tabId -> function() +# Note. tabLoadedHandlers handlers is exported for use also by "marks.coffee". +root.tabLoadedHandlers = {} # tabId -> function()  # A secret, available only within the current instantiation of Vimium.  The secret is big, likely unguessable  # in practice, but less than 2^31. diff --git a/background_scripts/marks.coffee b/background_scripts/marks.coffee index 05c8e579..94633c36 100644 --- a/background_scripts/marks.coffee +++ b/background_scripts/marks.coffee @@ -59,6 +59,11 @@ Marks =            if baseUrl == @getBaseUrl tab.url              # We have a matching tab.  We'll use it.              return @gotoPositionInTab extend markInfo, tabId: tab.id +      # There is no existing matching tab, we'll have to create one. +      chrome.tabs.create { url: @getBaseUrl(markInfo.url) }, (tab) => +        # Note. tabLoadedHandlers is defined in "main.coffee".  This handler will be called when the tab has +        # is loaded, its DOM is ready and it registers with the background page. +        tabLoadedHandlers[tab.id] = => @gotoPositionInTab extend markInfo, tabId: tab.id    getBaseUrl: (url) -> url.split("#")[0] | 
