Jake Cobb created RIPPLE-62:
-------------------------------
Summary: Filesystem API Broken with Cordova 3.4 in Chrome
Key: RIPPLE-62
URL: https://issues.apache.org/jira/browse/RIPPLE-62
Project: Apache Ripple
Issue Type: Bug
Environment: hosted mode, cordova 3.4.1-0.1.0, ripple 0.9.22
Reporter: Jake Cobb
The Cordova Filesystem API support depends on Chrome's implementation being
present, e.g. using {{window.webkitRequestFileSystem}} to implement
{{requestFileSystem}}. However, it mishandles the URLs such that, at least
with Cordova 3.4.1-0.1.0, almost all operations result in a {{NOT_FOUND_ERR}}.
The bridge in use was created for 2.0.0, so perhaps there needs to be a new
version for 3.0.0.
The problem is that the result of {{window.webkitRequestFileSystem}} is being
wrapped in a Cordova {{FileSystem}} object, and the root of this filesystem is
represented as something like:
{noformat}
cdvfile://localhost/http_localhost_4400:Temporary/
{noformat}
On the other hand, the Webkit root represents itself as:
{noformat}
filesystem:http://localhost:4400/temporary/
{noformat}
The Cordova side passes the URL across the bridge as follows:
{code:javascript|title=DirectoryEntry.js}
exec(win, fail, "File", "getFile", [this.toInternalURL(), path, options]);
{code}
But on the Ripple side, the Webkit filesystem instance has been memorized and
the file path is treated as though it were e.g. {{file.fullPath}} instead of
the absolute URL that is being passed. For example, {{readEntries}} does:
{code:javascript|title=cordova/2.0.0/bridge/file.js}
readEntries: function (win, fail, args) {
var root = fs.root.toURL(),
path = args[0],
reader;
path = cleanPath(path);
path = root + path;
window.webkitResolveLocalFileSystemURL(path, function (entry) {
{code}
This means the URL it passes to Webkit looks like:
{noformat}
filesystem:http://localhost:4400/temporary/cdvfile://localhost/http_localhost_4400:Temporary/
{noformat}
All other functions are similar, in that they either try to resolve a URL in
this way, or they use the "path" as if it were a normal path instead of the
FileEntry URL that it is.
--
This message was sent by Atlassian JIRA
(v6.2#6252)