cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhigg...@apache.org
Subject git commit: CB-6013 Fix resolveLocalFileSystemURI for reader / writer
Date Thu, 20 Feb 2014 18:24:52 GMT
Repository: cordova-plugin-file
Updated Branches:
  refs/heads/readWrite [created] bf5712d19


CB-6013 Fix resolveLocalFileSystemURI for reader / writer

Due to a bug in BB10's webkit implementation, requestAnimationFrame is
required to make multiple calls to requestFileSystem in the same
callback chain.


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/commit/bf5712d1
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/tree/bf5712d1
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/diff/bf5712d1

Branch: refs/heads/readWrite
Commit: bf5712d1969852a00e80df2ec2d0e3ee6e60f908
Parents: 6a3bc14
Author: Bryan Higgins <bhiggins@blackberry.com>
Authored: Thu Feb 20 13:21:47 2014 -0500
Committer: Bryan Higgins <bhiggins@blackberry.com>
Committed: Thu Feb 20 13:21:47 2014 -0500

----------------------------------------------------------------------
 www/blackberry10/FileReader.js                |  2 +-
 www/blackberry10/FileWriter.js                |  2 +-
 www/blackberry10/resolveLocalFileSystemURI.js | 34 ++++++++++++----------
 3 files changed, 20 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/bf5712d1/www/blackberry10/FileReader.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/FileReader.js b/www/blackberry10/FileReader.js
index 6e3a10c..a3943ba 100644
--- a/www/blackberry10/FileReader.js
+++ b/www/blackberry10/FileReader.js
@@ -60,7 +60,7 @@ FileReader.prototype.abort = function() {
 
 function read(method, context, file, encoding) {
     if (file.fullPath) {
-         resolveLocalFileSystemURI("filesystem:local:///persistent/" + file.fullPath, function
(entry) {
+         resolveLocalFileSystemURI(file.fullPath, function (entry) {
             entry.nativeEntry.file(function (nativeFile) {
                 context.nativeReader[method].call(context.nativeReader, nativeFile, encoding);
             }, context.onerror);

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/bf5712d1/www/blackberry10/FileWriter.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/FileWriter.js b/www/blackberry10/FileWriter.js
index 8992943..d50efc5 100644
--- a/www/blackberry10/FileWriter.js
+++ b/www/blackberry10/FileWriter.js
@@ -29,7 +29,7 @@ function FileWriter (file) {
     this.file = file;
     this.events = {};
     this.pending = [];
-    resolveLocalFileSystemURI("filesystem:local:///persistent/" + file.fullPath, function
(entry) {
+    resolveLocalFileSystemURI(file.fullPath, function (entry) {
         entry.nativeEntry.createWriter(function (writer) {
             var i,
                 event;

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/bf5712d1/www/blackberry10/resolveLocalFileSystemURI.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/resolveLocalFileSystemURI.js b/www/blackberry10/resolveLocalFileSystemURI.js
index a3f62f7..045fe1d 100644
--- a/www/blackberry10/resolveLocalFileSystemURI.js
+++ b/www/blackberry10/resolveLocalFileSystemURI.js
@@ -29,22 +29,24 @@ module.exports = function (uri, success, fail) {
             fail(FileError.NOT_FOUND_ERR);
         },
         resolveURI = function () {
-            window.webkitRequestFileSystem(
-                window.PERSISTENT,
-                50*1024*1024,
-                function (fs) {
-                    var op = decodedURI.slice(-1) === '/' ? 'getDirectory' : 'getFile';
-                    fs.root[op](
-                        decodedURI,
-                        { create: false },
-                        function (entry) {
-                            success(fileUtils.createEntry(entry));
-                        },
-                        failNotFound
-                    );
-                },
-                failNotFound
-            );
+            window.requestAnimationFrame(function () {
+                window.webkitRequestFileSystem(
+                    window.PERSISTENT,
+                    50*1024*1024,
+                    function (fs) {
+                        var op = decodedURI.slice(-1) === '/' ? 'getDirectory' : 'getFile';
+                        fs.root[op](
+                            decodedURI,
+                            { create: false },
+                            function (entry) {
+                                success(fileUtils.createEntry(entry));
+                            },
+                            failNotFound
+                        );
+                    },
+                    failNotFound
+                );
+            });
         };
 
     if (decodedURI.substring(0, 8) === 'local://') {


Mime
View raw message