Index: chrome/browser/resources/image_loader/request.js |
diff --git a/chrome/browser/resources/image_loader/request.js b/chrome/browser/resources/image_loader/request.js |
index 40c3b40cbd0bbf4f9f2dbb6c8fdd3b03d787f104..8c453db7ab0fecd171c80d686374fd607b933dac 100644 |
--- a/chrome/browser/resources/image_loader/request.js |
+++ b/chrome/browser/resources/image_loader/request.js |
@@ -272,6 +272,13 @@ AuthorizedXHR.prototype.load = function(url, onSuccess, onFailure) { |
requestTokenAndCall(true, onMaybeSuccess, onMaybeFailure); |
}.bind(this); |
+ // Do not request a token for local resources, since it is not necessary. |
+ if (url.indexOf('filesystem:') === 0) { |
+ this.xhr_ = AuthorizedXHR.loadWithToken_( |
+ null, url, onMaybeSuccess, onMaybeFailure); |
+ return; |
+ } |
+ |
// Make the request with reusing the current token. If it fails, then retry. |
requestTokenAndCall(false, onMaybeSuccess, maybeRetryCall); |
}; |
@@ -280,7 +287,8 @@ AuthorizedXHR.prototype.load = function(url, onSuccess, onFailure) { |
* Fetches data using authorized XmlHttpRequest with the provided OAuth2 token. |
* If the token is invalid, the request will fail. |
* |
- * @param {string} token OAuth2 token to be injected to the request. |
+ * @param {?string} token OAuth2 token to be injected to the request. Null for |
+ * no token. |
* @param {string} url URL to the resource to be fetched. |
* @param {function(string, Blob}) onSuccess Success callback with the content |
* type and the fetched data. |
@@ -306,7 +314,8 @@ AuthorizedXHR.loadWithToken_ = function(token, url, onSuccess, onFailure) { |
// Perform a xhr request. |
try { |
xhr.open('GET', url, true); |
- xhr.setRequestHeader('Authorization', 'Bearer ' + token); |
+ if (token) |
+ xhr.setRequestHeader('Authorization', 'Bearer ' + token); |
xhr.send(); |
} catch (e) { |
onFailure(); |