OLD | NEW |
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../js/resources/js-test-pre.js"></script> | 4 <script src="../js/resources/js-test-pre.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=41862">bug 41862</a>
: | 7 <p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=41862">bug 41862</a>
: |
8 XPath substring function is broken when passing NaN as the position parameter.</
p> | 8 XPath substring function is broken when passing NaN as the position parameter.</
p> |
9 <div id="console"></div> | 9 <div id="console"></div> |
10 | 10 |
11 <script> | 11 <script> |
12 shouldBe("document.evaluate(\"substring('12345', number(\'NaN\'))\", documen
t, null, XPathResult.STRING_TYPE, null).stringValue", "''"); | 12 shouldBe("document.evaluate(\"substring('12345', number(\'NaN\'))\", documen
t, null, XPathResult.STRING_TYPE, null).stringValue", "''"); |
13 shouldBe("document.evaluate(\"substring('12345', number(\'NaN\'), 3)\", docu
ment, null, XPathResult.STRING_TYPE, null).stringValue", "''"); | 13 shouldBe("document.evaluate(\"substring('12345', number(\'NaN\'), 3)\", docu
ment, null, XPathResult.STRING_TYPE, null).stringValue", "''"); |
14 | 14 |
15 <!-- -2147483645 represents MIN_INT-3 which when passed through the original
substring function before the fix for 41862 landed caused an overflow and wrap
to 2. That meant that this case was effectively calling substring('12345', MIN_I
NT, 2) and returning 12, rather than the empty string which the NaN should have
triggered.. --> | 15 <!-- -2147483645 represents MIN_INT-3 which when passed through the original
substring function before the fix for 41862 landed caused an overflow and wrap
to 2. That meant that this case was effectively calling substring('12345', MIN_I
NT, 2) and returning 12, rather than the empty string which the NaN should have
triggered.. --> |
16 shouldBe("document.evaluate(\"substring('12345', number(\'NaN\'), -214748364
5)\", document, null, XPathResult.STRING_TYPE, null).stringValue", "''"); | 16 shouldBe("document.evaluate(\"substring('12345', number(\'NaN\'), -214748364
5)\", document, null, XPathResult.STRING_TYPE, null).stringValue", "''"); |
17 | 17 |
18 shouldBe("document.evaluate(\"substring('12345', number(\'NaN\'), number(\'N
aN\'))\", document, null, XPathResult.STRING_TYPE, null).stringValue", "''"); | 18 shouldBe("document.evaluate(\"substring('12345', number(\'NaN\'), number(\'N
aN\'))\", document, null, XPathResult.STRING_TYPE, null).stringValue", "''"); |
19 | 19 |
20 </script> | 20 </script> |
21 <script src="../js/resources/js-test-post.js"></script> | |
22 </body> | 21 </body> |
23 </html> | 22 </html> |
OLD | NEW |