diff options
| author | mrmr1993 | 2015-05-10 00:36:27 +0100 |
|---|---|---|
| committer | mrmr1993 | 2015-05-29 12:15:47 +0100 |
| commit | 3b9508d4b4ce27acd2182d793467e748c815fe94 (patch) | |
| tree | ab824f17593bad0ee94d854ba938aee2d889fbd4 /content_scripts | |
| parent | 42fa6e9506d95073e0ca6924b1b9a082d23bd483 (diff) | |
| download | vimium-3b9508d4b4ce27acd2182d793467e748c815fe94.tar.bz2 | |
Disable UIComponent for XML documents
If the page is an XML document, nothing we do works:
* <style> elements show their contents inline,
* <iframe> elements don't load any content,
* document.createElement generates elements that
- have Element.style == null, and
- ignore CSS.
This commit stops us from injecting anything into the DOM from
UIComponent, fixing #1640.
Diffstat (limited to 'content_scripts')
| -rw-r--r-- | content_scripts/ui_component.coffee | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/content_scripts/ui_component.coffee b/content_scripts/ui_component.coffee index ba141b23..5bb13496 100644 --- a/content_scripts/ui_component.coffee +++ b/content_scripts/ui_component.coffee @@ -7,6 +7,14 @@ class UIComponent constructor: (iframeUrl, className, @handleMessage) -> styleSheet = document.createElement "style" + + # If this is an XML document, nothing we do here works: + # * <style> elements show their contents inline, + # * <iframe> elements don't load any content, + # * document.createElement generates elements that have style == null and ignore CSS. + # We bail here if this is the case so we're polluting the DOM to no or negative effect. + return unless styleSheet.style + styleSheet.type = "text/css" # Default to everything hidden while the stylesheet loads. styleSheet.innerHTML = "@import url(\"#{chrome.runtime.getURL("content_scripts/vimium.css")}\");" |
