diff options
| author | Stephen Blott | 2016-03-26 10:44:22 +0000 |
|---|---|---|
| committer | Stephen Blott | 2016-03-26 12:06:34 +0000 |
| commit | 24d305500b4fd3574ed31cff33b177f42cd88457 (patch) | |
| tree | 731a6c8901359a28de80278e41ec1e4408e1803d | |
| parent | 135de62c2fecea4eb1ef07c155d339c609b6ad1c (diff) | |
| download | vimium-24d305500b4fd3574ed31cff33b177f42cd88457.tar.bz2 | |
Get frameId in background page.
| -rw-r--r-- | background_scripts/main.coffee | 2 | ||||
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 06788ee4..79c3b005 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -68,7 +68,7 @@ chrome.runtime.onConnect.addListener (port, name) -> port.onMessage.addListener portHandlers[port.name] port.sender, port chrome.runtime.onMessage.addListener((request, sender, sendResponse) -> - request = extend {count: 1}, extend request, tab: sender.tab, tabId: sender.tab.id + request = extend {count: 1, frameId: sender.frameId}, extend request, tab: sender.tab, tabId: sender.tab.id if (sendRequestHandlers[request.handler]) sendResponse(sendRequestHandlers[request.handler](request, sender)) # Ensure the sendResponse callback is freed. diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 5767d454..e4a2e8c9 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -34,7 +34,7 @@ frameId = null # For debugging only. This logs to the console on the background page. bgLog = (args...) -> args = (arg.toString() for arg in args) - chrome.runtime.sendMessage handler: "log", frameId: frameId, message: args.join " " + chrome.runtime.sendMessage handler: "log", message: args.join " " # If an input grabs the focus before the user has interacted with the page, then grab it back (if the # grabBackFocus option is set). @@ -120,7 +120,7 @@ class NormalMode extends KeyHandlerMode chrome.runtime.sendMessage handler: "sendMessageToFrames", message: {name: "runInTopFrame", sourceFrameId: frameId, registryEntry} else if registryEntry.background - chrome.runtime.sendMessage {handler: "runBackgroundCommand", frameId, registryEntry, count} + chrome.runtime.sendMessage {handler: "runBackgroundCommand", registryEntry, count} else if registryEntry.passCountToFunction Utils.invokeCommandString registryEntry.command, [count] else @@ -191,7 +191,7 @@ installListeners = Utils.makeIdempotent -> # onFocus = (event) -> if event.target == window - chrome.runtime.sendMessage handler: "frameFocused", frameId: frameId + chrome.runtime.sendMessage handler: "frameFocused" checkIfEnabledForUrl true # We install these listeners directly (that is, we don't use installListener) because we still need to receive @@ -263,7 +263,7 @@ focusThisFrame = (request) -> if window.innerWidth < 3 or window.innerHeight < 3 or document.body?.tagName.toLowerCase() == "frameset" # This frame is too small to focus or it's a frameset. Cancel and tell the background page to focus the # next frame instead. This affects sites like Google Inbox, which have many tiny iframes. See #1317. - chrome.runtime.sendMessage handler: "nextFrame", frameId: frameId + chrome.runtime.sendMessage handler: "nextFrame" return window.focus() flashFrame() if request.highlight |
