aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--background_scripts/main.coffee3
-rw-r--r--background_scripts/marks.coffee5
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]