content/base/test/test_bug403852.html

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <head>
michael@0 4 <!--
michael@0 5 https://bugzilla.mozilla.org/show_bug.cgi?id=403852
michael@0 6 -->
michael@0 7 <title>Test for Bug 403852</title>
michael@0 8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
michael@0 10 </head>
michael@0 11
michael@0 12 <body>
michael@0 13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=403852">Mozilla Bug 403852</a>
michael@0 14 <p id="display">
michael@0 15 <input id="fileList" type="file"></input>
michael@0 16 <canvas id="canvas"></canvas>
michael@0 17 </p>
michael@0 18 <div id="content" style="display: none">
michael@0 19 </div>
michael@0 20
michael@0 21 <pre id="test">
michael@0 22 <script class="testbody" type="text/javascript">
michael@0 23
michael@0 24 var testFile = SpecialPowers.Services.dirsvc.get("ProfD", SpecialPowers.Ci.nsIFile);
michael@0 25 testFile.append("prefs.js");
michael@0 26
michael@0 27 var fileList = document.getElementById('fileList');
michael@0 28 SpecialPowers.wrap(fileList).value = testFile.path;
michael@0 29
michael@0 30 // Make sure the file is accessible with indexed notation
michael@0 31 var domFile = fileList.files[0];
michael@0 32
michael@0 33 is(domFile.name, "prefs.js", "fileName should be prefs.js");
michael@0 34
michael@0 35 ok("lastModifiedDate" in domFile, "lastModifiedDate must be present");
michael@0 36
michael@0 37 var d = new Date(testFile.lastModifiedTime);
michael@0 38 ok(d.getTime() == domFile.lastModifiedDate.getTime(), "lastModifiedDate should be the same.");
michael@0 39
michael@0 40 var cf = document.getElementById("canvas").mozGetAsFile("canvFile");
michael@0 41
michael@0 42 var x = new Date();
michael@0 43 var y = cf.lastModifiedDate;
michael@0 44 var z = new Date();
michael@0 45
michael@0 46 ok((x.getTime() <= y.getTime()) && (y.getTime() <= z.getTime()), "lastModifiedDate of file which does not have last modified date should be current time");
michael@0 47
michael@0 48 </script>
michael@0 49 </pre>
michael@0 50 </body> </html>

mercurial