aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts
diff options
context:
space:
mode:
authorStephen Blott2014-12-14 14:17:54 +0000
committerStephen Blott2014-12-14 14:20:54 +0000
commit9b8817593af71ddc106c60d44bc967a4bcc553e9 (patch)
treee8030195a85189c23dedc3aacb06e3bdc8351460 /background_scripts
parent3f3444d1fe72c74439bd9bec3c27ab441ae560a0 (diff)
parentd42913f75443df565d33ef5c565cd80c31714a60 (diff)
downloadvimium-9b8817593af71ddc106c60d44bc967a4bcc553e9.tar.bz2
Merge branch 'vomnibarToPage' of https://github.com/smblott-github/vimium into smblott-github-vomnibarToPage
Conflicts: background_scripts/main.coffee content_scripts/vimium.css content_scripts/vomnibar.coffee lib/utils.coffee
Diffstat (limited to 'background_scripts')
-rw-r--r--background_scripts/main.coffee41
1 files changed, 24 insertions, 17 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index 3ec618c9..17d21bc4 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -617,6 +617,12 @@ handleFrameFocused = (request, sender) ->
frameIdsForTab[tabId] =
[request.frameId, (frameIdsForTab[tabId].filter (id) -> id != request.frameId)...]
+# 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,
@@ -624,24 +630,25 @@ portHandlers =
filterCompleter: filterCompleter
sendRequestHandlers =
- getCompletionKeys: getCompletionKeysRequest,
- getCurrentTabUrl: getCurrentTabUrl,
- openUrlInNewTab: openUrlInNewTab,
- openUrlInIncognito: openUrlInIncognito,
- openUrlInCurrentTab: openUrlInCurrentTab,
- openOptionsPageInNewTab: openOptionsPageInNewTab,
- registerFrame: registerFrame,
- unregisterFrame: unregisterFrame,
- frameFocused: handleFrameFocused,
- upgradeNotificationClosed: upgradeNotificationClosed,
- updateScrollPosition: handleUpdateScrollPosition,
- copyToClipboard: copyToClipboard,
- isEnabledForUrl: isEnabledForUrl,
- saveHelpDialogSettings: saveHelpDialogSettings,
- selectSpecificTab: selectSpecificTab,
- refreshCompleter: refreshCompleter,
- createMark: Marks.create.bind(Marks),
+ getCompletionKeys: getCompletionKeysRequest
+ getCurrentTabUrl: getCurrentTabUrl
+ openUrlInNewTab: openUrlInNewTab
+ openUrlInIncognito: openUrlInIncognito
+ openUrlInCurrentTab: openUrlInCurrentTab
+ openOptionsPageInNewTab: openOptionsPageInNewTab
+ registerFrame: registerFrame
+ unregisterFrame: unregisterFrame
+ frameFocused: handleFrameFocused
+ upgradeNotificationClosed: upgradeNotificationClosed
+ updateScrollPosition: handleUpdateScrollPosition
+ copyToClipboard: copyToClipboard
+ isEnabledForUrl: isEnabledForUrl
+ saveHelpDialogSettings: saveHelpDialogSettings
+ selectSpecificTab: selectSpecificTab
+ refreshCompleter: refreshCompleter
+ 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'))