content/base/test/chrome/test_bug914381.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/base/test/chrome/test_bug914381.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,48 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=650776
     1.8 +-->
     1.9 +<head>
    1.10 +  <meta charset="utf-8">
    1.11 +  <title>Test for Bug 914381</title>
    1.12 +  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    1.13 +  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
    1.14 +</head>
    1.15 +<body>
    1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=914381">Mozilla Bug 914381</a>
    1.17 +<p id="display"></p>
    1.18 +<div id="content" style="display: none">
    1.19 +</div>
    1.20 +<pre id="test">
    1.21 +<script type="application/javascript">
    1.22 +const Cc = Components.classes;
    1.23 +const Ci = Components.interfaces;
    1.24 +
    1.25 +function createFileWithData(fileData) {
    1.26 +  var dirSvc = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
    1.27 +  var testFile = dirSvc.get("ProfD", Ci.nsIFile);
    1.28 +  testFile.append("testBug914381");
    1.29 +
    1.30 +  var outStream = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(Ci.nsIFileOutputStream);
    1.31 +  outStream.init(testFile, 0x02 | 0x08 | 0x20, // write, create, truncate
    1.32 +                 0666, 0);
    1.33 +  outStream.write(fileData, fileData.length);
    1.34 +  outStream.close();
    1.35 +
    1.36 +  return testFile;
    1.37 +}
    1.38 +
    1.39 +/** Test for Bug 914381. DOMFile's created in JS using an nsIFile should allow mozGetFullPathInternal calls to succeed **/
    1.40 +var file = createFileWithData("Test bug 914381");
    1.41 +var f = File(file);
    1.42 +is(f.mozFullPathInternal, undefined, "mozFullPathInternal is undefined from js");
    1.43 +is(f.mozFullPath, file.path, "mozFullPath returns path if created with nsIFile");
    1.44 +
    1.45 +f = File(file.path);
    1.46 +is(f.mozFullPathInternal, undefined, "mozFullPathInternal is undefined from js");
    1.47 +is(f.mozFullPath, "", "mozFullPath returns blank if created with a string");
    1.48 +</script>
    1.49 +</pre>
    1.50 +</body>
    1.51 +</html>

mercurial