You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ia...@apache.org on 2014/03/03 17:25:33 UTC
[2/2] spec commit: CB-4952: Test handling of file:///private/ URLs
CB-4952: Test handling of file:///private/ URLs
Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/f6c9c2cc
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/f6c9c2cc
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/f6c9c2cc
Branch: refs/heads/master
Commit: f6c9c2cc05fea41261e40f9c9306c11badc4b20a
Parents: 39f214e
Author: Ian Clelland <ic...@chromium.org>
Authored: Mon Mar 3 11:24:57 2014 -0500
Committer: Ian Clelland <ic...@chromium.org>
Committed: Mon Mar 3 11:24:57 2014 -0500
----------------------------------------------------------------------
file/index.html | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/f6c9c2cc/file/index.html
----------------------------------------------------------------------
diff --git a/file/index.html b/file/index.html
index be5edaa..e4a9ce4 100644
--- a/file/index.html
+++ b/file/index.html
@@ -58,6 +58,7 @@
document.getElementById('downloadImgNative').addEventListener('click', downloadImgNative, false);
document.getElementById('downloadVideoCDV').addEventListener('click', downloadVideoCDV, false);
document.getElementById('downloadVideoNative').addEventListener('click', downloadVideoNative, false);
+ document.getElementById('testPrivateURL').addEventListener('click', testPrivateURL, false);
}
function clearLog() {
@@ -136,6 +137,28 @@
});
}, logError("requestFileSystem"));
}
+
+ function testPrivateURL(ev) {
+ ev.preventDefault();
+ ev.stopPropagation();
+ requestFileSystem(TEMPORARY, 0, function(fileSystem) {
+ logMessage("Temporary root is at " + fileSystem.root.toNativeURL());
+ fileSystem.root.getFile("testfile", {create: true}, function(entry) {
+ logMessage("Temporary file is at " + entry.toNativeURL());
+ if (entry.toNativeURL().substring(0,12) == "file:///var/") {
+ logMessage("File starts with /var/, trying /private/var");
+ var newURL = "file://localhost/private/var/" + entry.toNativeURL().substring(12) + "?and=another_thing";
+ //var newURL = entry.toNativeURL();
+ logMessage(newURL, 'blue');
+ resolveLocalFileSystemURL(newURL, function(newEntry) {
+ logMessage("Successfully resolved.", 'green');
+ logMessage(newEntry.toURL(), 'blue');
+ logMessage(newEntry.toNativeURL(), 'blue');
+ }, logError("resolveLocalFileSystemURL"));
+ }
+ }, logError("getFile"));
+ }, logError("requestFileSystem"));
+ }
</script>
</head>
@@ -148,6 +171,8 @@
<div class="btn large" id="downloadVideoCDV">Download and play video (cdvfile)</div>
<div class="btn large" id="downloadVideoNative">Download and play video (native)</div>
+ <div class="btn large" id="testPrivateURL">Test /private/ URL (iOS)</div>
+
<div id="log"></div>
<div id="output"></div>
<h2> </h2><div class="backBtn" onclick="backHome();">Back</div>