Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

CB-4952: Test handling of file:///private/ URLs

  • Loading branch information...
commit f6c9c2cc05fea41261e40f9c9306c11badc4b20a 1 parent 39f214e
@clelland clelland authored
Showing with 25 additions and 0 deletions.
  1. +25 −0 file/index.html
View
25 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>
Please sign in to comment.
Something went wrong with that request. Please try again.