diff options
Diffstat (limited to 'background_scripts/main.coffee')
| -rw-r--r-- | background_scripts/main.coffee | 37 |
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')) |
