dom/xslt/tests/mochitest/test_bug566629.xhtml

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

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 <html xmlns="http://www.w3.org/1999/xhtml">
michael@0 2 <!--
michael@0 3 https://bugzilla.mozilla.org/show_bug.cgi?id=566629
michael@0 4 -->
michael@0 5 <head>
michael@0 6 <title>Test for Bug 566629</title>
michael@0 7 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 8 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
michael@0 9 </head>
michael@0 10 <body>
michael@0 11 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=566629">Mozilla Bug 566629</a>
michael@0 12 <p id="display"></p>
michael@0 13 <div id="content" style="display: none">
michael@0 14
michael@0 15 </div>
michael@0 16 <pre id="test">
michael@0 17 <script class="testbody" type="text/javascript">
michael@0 18 <![CDATA[
michael@0 19 /** Test for Bug 566629 **/
michael@0 20
michael@0 21 var xsltdoc = new DOMParser().parseFromString(
michael@0 22 '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"\
michael@0 23 xmlns:xhtml="http://www.w3.org/1999/xhtml">\
michael@0 24 <xsl:template match="/">\
michael@0 25 <xsl:value-of select="count(//body)"/>\
michael@0 26 <xsl:text>,</xsl:text>\
michael@0 27 <xsl:value-of select="count(//xhtml:body)"/>\
michael@0 28 <xsl:text>,</xsl:text>\
michael@0 29 <xsl:value-of select="count(//xsl:body)"/>\
michael@0 30 <xsl:text>,</xsl:text>\
michael@0 31 <xsl:value-of select="name(//xhtml:body)"/>\
michael@0 32 <xsl:text>,</xsl:text>\
michael@0 33 <xsl:value-of select="local-name(//xhtml:body)"/>\
michael@0 34 </xsl:template>\
michael@0 35 </xsl:stylesheet>',
michael@0 36 "text/xml");
michael@0 37
michael@0 38 var processor = new XSLTProcessor;
michael@0 39 processor.importStylesheet(xsltdoc);
michael@0 40 var result = processor.transformToFragment(document, document);
michael@0 41 ok(result instanceof DocumentFragment, "returned a docfragment");
michael@0 42 is(result.firstChild.nodeValue, "0,1,0,body,body",
michael@0 43 "correct treatment of HTML elements in XSLT");
michael@0 44
michael@0 45 is(document.evaluate("count(//body)", document, null, XPathResult.ANY_TYPE, null).numberValue,
michael@0 46 0, "namespace-less node-test");
michael@0 47 is(document.evaluate("count(//a:body)", document,
michael@0 48 function() { return "http://www.w3.org/1999/xhtml" },
michael@0 49 XPathResult.ANY_TYPE, null).numberValue,
michael@0 50 1, "with-namespace node-test");
michael@0 51 is(document.evaluate("count(//a:body)", document,
michael@0 52 function() { return "foo" },
michael@0 53 XPathResult.ANY_TYPE, null).numberValue,
michael@0 54 0, "wrong-namespace node-test");
michael@0 55 is(document.evaluate("count(//a:bODy)", document,
michael@0 56 function() { return "http://www.w3.org/1999/xhtml" },
michael@0 57 XPathResult.ANY_TYPE, null).numberValue,
michael@0 58 0, "with-namespace wrong-casing node-test");
michael@0 59 is(document.evaluate("count(//bODy)", document, null, XPathResult.ANY_TYPE, null).numberValue,
michael@0 60 0, "without-namespace wrong-casing node-test");
michael@0 61 is(document.evaluate("name(//a:body)", document,
michael@0 62 function() { return "http://www.w3.org/1999/xhtml" },
michael@0 63 XPathResult.ANY_TYPE, null).stringValue,
michael@0 64 "body", "name()");
michael@0 65 is(document.evaluate("local-name(//a:body)", document,
michael@0 66 function() { return "http://www.w3.org/1999/xhtml" },
michael@0 67 XPathResult.ANY_TYPE, null).stringValue,
michael@0 68 "body", "local-name()");
michael@0 69 ]]>
michael@0 70 </script>
michael@0 71 </pre>
michael@0 72 </body>
michael@0 73 </html>

mercurial