Sat, 03 Jan 2015 20:18:00 +0100
Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=603159 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 603159</title> |
michael@0 | 8 | <script type="application/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 | <body> |
michael@0 | 12 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=603159">Mozilla Bug 603159</a> |
michael@0 | 13 | <p id="display"></p> |
michael@0 | 14 | <div id="content" style="display: none"></div> |
michael@0 | 15 | <pre id="test"> |
michael@0 | 16 | <script type="application/javascript"> |
michael@0 | 17 | |
michael@0 | 18 | /** Test for Bug 603159 **/ |
michael@0 | 19 | |
michael@0 | 20 | var style = |
michael@0 | 21 | '<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ' + |
michael@0 | 22 | 'xmlns:date="http://exslt.org/dates-and-times" '+ |
michael@0 | 23 | 'version="1.0">' + |
michael@0 | 24 | '<xsl:output method="html"/>' + |
michael@0 | 25 | '<xsl:template match="/">' + |
michael@0 | 26 | '<xsl:value-of select="date:date-time()" /> ' + |
michael@0 | 27 | '</xsl:template>' + |
michael@0 | 28 | '</xsl:stylesheet>'; |
michael@0 | 29 | var styleDoc = new DOMParser().parseFromString (style, "text/xml"); |
michael@0 | 30 | |
michael@0 | 31 | var data = '<root/>'; |
michael@0 | 32 | var originalDoc = new DOMParser().parseFromString(data, "text/xml"); |
michael@0 | 33 | |
michael@0 | 34 | var processor = new XSLTProcessor(); |
michael@0 | 35 | processor.importStylesheet(styleDoc); |
michael@0 | 36 | |
michael@0 | 37 | var fragment = processor.transformToFragment(originalDoc, document); |
michael@0 | 38 | var content = document.getElementById("content"); |
michael@0 | 39 | content.appendChild(fragment); |
michael@0 | 40 | |
michael@0 | 41 | // use Gecko's Date.parse to parse, then compare the milliseconds since epoch |
michael@0 | 42 | var xslt_ms = Date.parse(content.innerHTML); |
michael@0 | 43 | var now_ms = new Date().getTime(); |
michael@0 | 44 | var accepted_diff = 30 * 60 * 1000; // 30 minutes |
michael@0 | 45 | var diff = Math.abs(now_ms - xslt_ms); |
michael@0 | 46 | |
michael@0 | 47 | ok(diff < accepted_diff, "generated timestamp should be not more than " |
michael@0 | 48 | + accepted_diff + " ms before 'now', but the difference was: " + diff); |
michael@0 | 49 | |
michael@0 | 50 | content.innerHTML = ''; |
michael@0 | 51 | </script> |
michael@0 | 52 | </pre> |
michael@0 | 53 | </body> |
michael@0 | 54 | </html> |