From a9a4c739a1ad07d6c0f5a867b447fef9647a3988 Mon Sep 17 00:00:00 2001 From: gorhill Date: Tue, 24 Feb 2015 15:35:32 -0500 Subject: [PATCH] comment review --- src/js/assets.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/js/assets.js b/src/js/assets.js index 608763427..8d33704f9 100644 --- a/src/js/assets.js +++ b/src/js/assets.js @@ -280,6 +280,8 @@ var cachedAssetsManager = (function() { /******************************************************************************/ var getTextFileFromURL = function(url, onLoad, onError) { + // console.log('µBlock.assets/getTextFileFromURL("%s"):', url); + // https://github.com/gorhill/uMatrix/issues/15 var onResponseReceived = function() { this.onload = this.onerror = this.ontimeout = null; @@ -301,11 +303,15 @@ var getTextFileFromURL = function(url, onLoad, onError) { } return onLoad.call(this); }; + var onErrorReceived = function() { this.onload = this.onerror = this.ontimeout = null; onError.call(this); }; - // console.log('µBlock> getTextFileFromURL("%s"):', url); + + // Be ready for thrown exceptions: + // I am pretty sure it used to work, but now using a URL such as + // `file:///` on Chromium 40 results in an exception being thrown. var xhr = new XMLHttpRequest(); try { xhr.open('get', url, true);