diff options
| author | Jez Ng | 2012-11-10 04:46:32 -0500 |
|---|---|---|
| committer | Jez Ng | 2012-11-10 04:46:32 -0500 |
| commit | a3eb1cbee93c4c10505f629b8bc8bc00e37adb8a (patch) | |
| tree | 38436ec1cbfca74ac4f58e4bb9130fdfc6e08b3d | |
| parent | 386a3cf6c61f225f238f7b67c8b9405986467c33 (diff) | |
| download | vimium-a3eb1cbee93c4c10505f629b8bc8bc00e37adb8a.tar.bz2 | |
Inject bookmarklets by appending them as scripts.
This *should* fix the permission problems that `eval` faced.
Closes #575, #710.
| -rw-r--r-- | content_scripts/vomnibar.coffee | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/content_scripts/vomnibar.coffee b/content_scripts/vomnibar.coffee index 6f4527fd..fdd698dc 100644 --- a/content_scripts/vomnibar.coffee +++ b/content_scripts/vomnibar.coffee @@ -213,7 +213,9 @@ extend BackgroundCompleter, navigateToUrl: (url, openInNewTab) -> # If the URL is a bookmarklet prefixed with javascript:, we shouldn't open that in a new tab. if url.startsWith "javascript:" - eval decodeURIComponent(url["javascript:".length..]) + script = document.createElement 'script' + script.textContent = decodeURIComponent(url["javascript:".length..]) + (document.head || document.documentElement).appendChild script else chrome.extension.sendRequest( handler: if openInNewTab then "openUrlInNewTab" else "openUrlInCurrentTab" |
