From ba7d0d76840ecad6844855729a0e0392ce235a2c Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Mon, 21 Sep 2015 14:44:56 +0100 Subject: Add a comment explaining the choice of XMLHttpRequest for UIComponent --- content_scripts/ui_component.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/content_scripts/ui_component.coffee b/content_scripts/ui_component.coffee index 72627f69..74b58b82 100644 --- a/content_scripts/ui_component.coffee +++ b/content_scripts/ui_component.coffee @@ -12,6 +12,8 @@ class UIComponent # Default to everything hidden while the stylesheet loads. styleSheet.innerHTML = "iframe {display: none;}" + # Use an XMLHttpRequest, possibly via the background page, to fetch the stylesheet. This allows us to + # catch and recover from failures that we could not have caught when using CSS @include (eg. #1817). UIComponent::styleSheetGetter ?= new AsyncDataFetcher @fetchFileContents "content_scripts/vimium.css" @styleSheetGetter.use (styles) -> styleSheet.innerHTML = styles -- cgit v1.2.3