diff options
| author | mrmr1993 | 2014-09-02 17:43:41 +0100 | 
|---|---|---|
| committer | mrmr1993 | 2014-10-31 07:22:12 +0000 | 
| commit | d65f265a6ad137be0db4d8c86879e5123a10087b (patch) | |
| tree | 7be59d25dd26f8d1b5d2641ce76bfbd631cae28b | |
| parent | fdf592b25ead4c4ec919c1d0e6322d2dba48c1f8 (diff) | |
| download | vimium-d65f265a6ad137be0db4d8c86879e5123a10087b.tar.bz2 | |
Add comments about moving the Vomnibar to an iframe
| -rw-r--r-- | background_scripts/main.coffee | 4 | ||||
| -rw-r--r-- | content_scripts/vomnibar.coffee | 8 | ||||
| -rw-r--r-- | pages/vomnibar.coffee | 5 | ||||
| -rw-r--r-- | tests/dom_tests/dom_tests.html | 3 | 
4 files changed, 18 insertions, 2 deletions
| diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 49417d7a..03d6143d 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -635,8 +635,8 @@ 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. +# 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) diff --git a/content_scripts/vomnibar.coffee b/content_scripts/vomnibar.coffee index 0e19f194..7b3cfdbe 100644 --- a/content_scripts/vomnibar.coffee +++ b/content_scripts/vomnibar.coffee @@ -1,3 +1,6 @@ +# +# This wraps the vomnibar iframe, which we inject into the page to provide the vomnibar. +#  Vomnibar =    vomnibarElement: null @@ -21,6 +24,11 @@ Vomnibar =      newTab: true    } +  # This function opens the vomnibar. It accepts options, a map with the values: +  #   completer   - The completer to fetch results from. +  #   query       - Optional. Text to prefill the Vomnibar with. +  #   selectFirst - Optional, boolean. Whether to select the first entry. +  #   newTab      - Optional, boolean. Whether to open the result in a new tab.    open: (options) ->      unless @vomnibarElement?        @vomnibarElement = document.createElement "iframe" diff --git a/pages/vomnibar.coffee b/pages/vomnibar.coffee index 2e51082a..81401623 100644 --- a/pages/vomnibar.coffee +++ b/pages/vomnibar.coffee @@ -1,3 +1,8 @@ +# +# This controls the contents of the Vomnibar iframe. We use an iframe to avoid changing the selection on the +# page (useful for bookmarklets), ensure that the Vomnibar style is unaffected by the page, and simplify key +# handling in vimium_frontend.coffee +#  Vomnibar =    vomnibarUI: null # the dialog instance for this window    completers: {} diff --git a/tests/dom_tests/dom_tests.html b/tests/dom_tests/dom_tests.html index 72f54c9d..e6427e85 100644 --- a/tests/dom_tests/dom_tests.html +++ b/tests/dom_tests/dom_tests.html @@ -54,6 +54,9 @@      <div id="output-div"></div> +    <!-- This is a hack to keep Vomnibar tests working after moving it to an iframe. +         The following are the elements from the iframe so that we can embed the iframe's script without errors. +         TODO(mrmr1993): Look into rewriting the Vomnibar tests so we don't need this. -->      <div id="vomnibar" class="vimiumReset">        <div class="vimiumReset vomnibarSearchArea">          <input type="text" class="vimiumReset"> | 
