Index: chrome/browser/resources/chromeos/wallpaper_manager/js/util.js |
diff --git a/chrome/browser/resources/chromeos/wallpaper_manager/js/util.js b/chrome/browser/resources/chromeos/wallpaper_manager/js/util.js |
index bd63042c0d691dd03192d53d6998ba785264b643..4d07a5820c953cbf1145e5562b54f1b65457ea6f 100644 |
--- a/chrome/browser/resources/chromeos/wallpaper_manager/js/util.js |
+++ b/chrome/browser/resources/chromeos/wallpaper_manager/js/util.js |
@@ -58,13 +58,17 @@ WallpaperUtil.fetchURL = function(url, type, onSuccess, onFailure, opt_xhr) { |
xhr = new XMLHttpRequest(); |
try { |
- xhr.addEventListener('loadend', function(e) { |
+ // Do not use loadend here to handle both success and failure case. It gets |
+ // complicated with abortion. Unexpected error message may show up. See |
+ // http://crbug.com/242581. |
+ xhr.addEventListener('load', function(e) { |
if (this.status == 200) { |
onSuccess(this); |
} else { |
onFailure(); |
} |
}); |
+ xhr.addEventListener('error', onFailure); |
xhr.open('GET', url, true); |
xhr.responseType = type; |
xhr.send(null); |