Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / ui / file_manager / image_loader / request.js
index 11fc7c1..cc7c84d 100644 (file)
@@ -253,7 +253,7 @@ AuthorizedXHR.prototype.load = function(url, onSuccess, onFailure) {
   // Fetches the access token and makes an authorized call. If refresh is true,
   // then forces refreshing the access token.
   var requestTokenAndCall = function(refresh, onInnerSuccess, onInnerFailure) {
-    chrome.fileBrowserPrivate.requestAccessToken(refresh, function(token) {
+    chrome.fileManagerPrivate.requestAccessToken(refresh, function(token) {
       if (this.aborted_)
         return;
       if (!token) {
@@ -273,8 +273,15 @@ AuthorizedXHR.prototype.load = function(url, onSuccess, onFailure) {
   }.bind(this);
 
   // Do not request a token for local resources, since it is not necessary.
-  if (url.indexOf('filesystem:') === 0) {
-    this.xhr_ = AuthorizedXHR.load_(null, url, onMaybeSuccess, onMaybeFailure);
+  if (/^filesystem:/.test(url)) {
+    // The query parameter is workaround for
+    // crbug.com/379678, which force to obtain the latest contents of the image.
+    var noCacheUrl = url + '?nocache=' + Date.now();
+    this.xhr_ = AuthorizedXHR.load_(
+        null,
+        noCacheUrl,
+        onMaybeSuccess,
+        onMaybeFailure);
     return;
   }
 
@@ -364,9 +371,8 @@ Request.prototype.sendImage_ = function(imageChanged) {
  * @private
  */
 Request.prototype.sendImageData_ = function(data) {
-  this.sendResponse_({status: 'success',
-                      data: data,
-                      taskId: this.request_.taskId});
+  this.sendResponse_(
+      {status: 'success', data: data, taskId: this.request_.taskId});
 };
 
 /**
@@ -400,8 +406,8 @@ Request.prototype.onImageLoad_ = function(callback) {
  * @private
  */
 Request.prototype.onImageError_ = function(callback) {
-  this.sendResponse_({status: 'error',
-                      taskId: this.request_.taskId});
+  this.sendResponse_(
+      {status: 'error', taskId: this.request_.taskId});
   this.cleanup_();
   this.downloadCallback_();
 };