4 https://bugzilla.mozilla.org/show_bug.cgi?id=603159
7 <title>Test for Bug
603159</title>
8 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css"/>
12 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=603159">Mozilla Bug
603159</a>
14 <div id=
"content" style=
"display: none"></div>
16 <script type=
"application/javascript">
18 /** Test for Bug
603159 **/
21 '
<xsl:stylesheet xmlns:
xsl=
"http://www.w3.org/1999/XSL/Transform" ' +
22 'xmlns:
date=
"http://exslt.org/dates-and-times" '+
24 '
<xsl:output method=
"html"/>' +
25 '
<xsl:template match=
"/">' +
26 '
<xsl:value-of select=
"date:date-time()" /> ' +
29 var styleDoc = new DOMParser().parseFromString (style,
"text/xml");
32 var originalDoc = new DOMParser().parseFromString(data,
"text/xml");
34 var processor = new XSLTProcessor();
35 processor.importStylesheet(styleDoc);
37 var fragment = processor.transformToFragment(originalDoc, document);
38 var content = document.getElementById(
"content");
39 content.appendChild(fragment);
41 // use Gecko's Date.parse to parse, then compare the milliseconds since epoch
42 var xslt_ms = Date.parse(content.innerHTML);
43 var now_ms = new Date().getTime();
44 var accepted_diff =
30 *
60 *
1000; //
30 minutes
45 var diff = Math.abs(now_ms - xslt_ms);
47 ok(diff < accepted_diff,
"generated timestamp should be not more than "
48 + accepted_diff +
" ms before 'now', but the difference was: " + diff);
50 content.innerHTML = '';