From 5885bc779bed46dfcff4b1e82968151448569f9f Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Tue, 19 Aug 2014 18:15:13 +0100 Subject: Move the vomnibar to an iframe --- background_scripts/main.coffee | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) (limited to 'background_scripts') diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index dda1beae..49417d7a 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -119,7 +119,7 @@ root.addExcludedUrl = (url) -> continue # And just keep everything else. newExcludedUrls.push(spec) - + Settings.set("excludedUrls", newExcludedUrls.join("\n")) chrome.tabs.query({ windowId: chrome.windows.WINDOW_ID_CURRENT, active: true }, @@ -635,6 +635,12 @@ getCurrFrameIndex = (frames) -> return i if frames[i].id == focusedFrame frames.length + 1 +# Send message back to the tab unchanged. +# Frames in the same tab can use this to communicate securely. +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, @@ -642,23 +648,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')) -- cgit v1.2.3