aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts
diff options
context:
space:
mode:
authorStephen Blott2014-10-31 12:39:39 +0000
committerStephen Blott2014-10-31 12:39:39 +0000
commit92f177faac3a14e41c033f4bc1ae95909e90c9ce (patch)
treea7b40b2a2d18608a989a7921a55569da5db393e4 /background_scripts
parenta277fa6332f3aa3c0aa5f2c541f539fb1569c6b9 (diff)
parentd65f265a6ad137be0db4d8c86879e5123a10087b (diff)
downloadvimium-92f177faac3a14e41c033f4bc1ae95909e90c9ce.tar.bz2
Merge vomnibarToPage from @mrmr1993.
Diffstat (limited to 'background_scripts')
-rw-r--r--background_scripts/main.coffee37
1 files changed, 22 insertions, 15 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index 898f46f1..0f2c6d85 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -620,6 +620,12 @@ getCurrFrameIndex = (frames) ->
return i if frames[i].id == focusedFrame
frames.length + 1
+# Send message back to the tab unchanged. This allows different frames from the same tab to message eachother
+# while avoiding security concerns such as eavesdropping or message spoofing.
+echo = (request, sender) ->
+ delete request.handler # No need to send this information
+ chrome.tabs.sendMessage(sender.tab.id, request)
+
# Port handler mapping
portHandlers =
keyDown: handleKeyDown,
@@ -627,23 +633,24 @@ portHandlers =
filterCompleter: filterCompleter
sendRequestHandlers =
- getCompletionKeys: getCompletionKeysRequest,
- getCurrentTabUrl: getCurrentTabUrl,
- openUrlInNewTab: openUrlInNewTab,
- openUrlInIncognito: openUrlInIncognito,
- openUrlInCurrentTab: openUrlInCurrentTab,
- openOptionsPageInNewTab: openOptionsPageInNewTab,
- registerFrame: registerFrame,
- frameFocused: handleFrameFocused,
- upgradeNotificationClosed: upgradeNotificationClosed,
- updateScrollPosition: handleUpdateScrollPosition,
- copyToClipboard: copyToClipboard,
- isEnabledForUrl: isEnabledForUrl,
- saveHelpDialogSettings: saveHelpDialogSettings,
- selectSpecificTab: selectSpecificTab,
+ getCompletionKeys: getCompletionKeysRequest
+ getCurrentTabUrl: getCurrentTabUrl
+ openUrlInNewTab: openUrlInNewTab
+ openUrlInIncognito: openUrlInIncognito
+ openUrlInCurrentTab: openUrlInCurrentTab
+ openOptionsPageInNewTab: openOptionsPageInNewTab
+ registerFrame: registerFrame
+ frameFocused: handleFrameFocused
+ upgradeNotificationClosed: upgradeNotificationClosed
+ updateScrollPosition: handleUpdateScrollPosition
+ copyToClipboard: copyToClipboard
+ isEnabledForUrl: isEnabledForUrl
+ saveHelpDialogSettings: saveHelpDialogSettings
+ selectSpecificTab: selectSpecificTab
refreshCompleter: refreshCompleter
- createMark: Marks.create.bind(Marks),
+ createMark: Marks.create.bind(Marks)
gotoMark: Marks.goto.bind(Marks)
+ echo: echo
# Convenience function for development use.
window.runTests = -> open(chrome.runtime.getURL('tests/dom_tests/dom_tests.html'))