summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast
diff options
context:
space:
mode:
authorLeon Clarke <leonclarke@google.com>2010-07-15 12:03:35 +0100
committerLeon Clarke <leonclarke@google.com>2010-07-20 16:57:23 +0100
commite458d70a0d18538346f41b503114c9ebe6b2ce12 (patch)
tree86f1637deca2c524432a822e5fcedd4bef221091 /LayoutTests/fast
parentf43eabc081f7ce6af24b9df4953498a3cd6ca24d (diff)
downloadexternal_webkit-e458d70a0d18538346f41b503114c9ebe6b2ce12.zip
external_webkit-e458d70a0d18538346f41b503114c9ebe6b2ce12.tar.gz
external_webkit-e458d70a0d18538346f41b503114c9ebe6b2ce12.tar.bz2
Merge WebKit at r63173 : Initial merge by git.
Change-Id: Ife5af0c7c6261fbbc8ae6bc08c390efa9ef10b44
Diffstat (limited to 'LayoutTests/fast')
-rw-r--r--LayoutTests/fast/xpath/substring-nan-position-expected.txt10
-rw-r--r--LayoutTests/fast/xpath/substring-nan-position.html26
-rw-r--r--LayoutTests/fast/xpath/substring-non-positive-postion-expected.txt10
-rw-r--r--LayoutTests/fast/xpath/substring-non-positive-postion.html23
4 files changed, 69 insertions, 0 deletions
diff --git a/LayoutTests/fast/xpath/substring-nan-position-expected.txt b/LayoutTests/fast/xpath/substring-nan-position-expected.txt
new file mode 100644
index 0000000..136cf21
--- /dev/null
+++ b/LayoutTests/fast/xpath/substring-nan-position-expected.txt
@@ -0,0 +1,10 @@
+Test for bug 41862: XPath substring function is broken when passing NaN as the position parameter.
+
+PASS document.evaluate("substring('12345', number('NaN'))", document, null, XPathResult.STRING_TYPE, null).stringValue is ''
+PASS document.evaluate("substring('12345', number('NaN'), 3)", document, null, XPathResult.STRING_TYPE, null).stringValue is ''
+PASS document.evaluate("substring('12345', number('NaN'), -2147483645)", document, null, XPathResult.STRING_TYPE, null).stringValue is ''
+PASS document.evaluate("substring('12345', number('NaN'), number('NaN'))", document, null, XPathResult.STRING_TYPE, null).stringValue is ''
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/xpath/substring-nan-position.html b/LayoutTests/fast/xpath/substring-nan-position.html
new file mode 100644
index 0000000..d1a1813
--- /dev/null
+++ b/LayoutTests/fast/xpath/substring-nan-position.html
@@ -0,0 +1,26 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../js/resources/js-test-style.css">
+<script src="../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=41862">bug 41862</a>:
+XPath substring function is broken when passing NaN as the position parameter.</p>
+<div id="console"></div>
+
+<script>
+ shouldBe("document.evaluate(\"substring('12345', number(\'NaN\'))\", document, null, XPathResult.STRING_TYPE, null).stringValue", "''");
+ shouldBe("document.evaluate(\"substring('12345', number(\'NaN\'), 3)\", document, null, XPathResult.STRING_TYPE, null).stringValue", "''");
+
+ <!-- -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_INT, 2) and returning 12, rather than the empty string which the NaN should have triggered.. -->
+ shouldBe("document.evaluate(\"substring('12345', number(\'NaN\'), -2147483645)\", document, null, XPathResult.STRING_TYPE, null).stringValue", "''");
+
+ shouldBe("document.evaluate(\"substring('12345', number(\'NaN\'), number(\'NaN\'))\", document, null, XPathResult.STRING_TYPE, null).stringValue", "''");
+
+ var successfullyParsed = true;
+
+</script>
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/xpath/substring-non-positive-postion-expected.txt b/LayoutTests/fast/xpath/substring-non-positive-postion-expected.txt
new file mode 100644
index 0000000..d3683b7
--- /dev/null
+++ b/LayoutTests/fast/xpath/substring-non-positive-postion-expected.txt
@@ -0,0 +1,10 @@
+Test for bug 41913: XPath substring function does not correctly handle non-positive values for the position argument
+
+PASS document.evaluate("substring('abcde', 0)", document, null, XPathResult.STRING_TYPE, null).stringValue is 'abcde'
+PASS document.evaluate("substring('abcde', -2)", document, null, XPathResult.STRING_TYPE, null).stringValue is 'abcde'
+PASS document.evaluate("substring('abcde', 0, 5)", document, null, XPathResult.STRING_TYPE, null).stringValue is 'abcd'
+PASS document.evaluate("substring('abcde', -2, 5)", document, null, XPathResult.STRING_TYPE, null).stringValue is 'ab'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/xpath/substring-non-positive-postion.html b/LayoutTests/fast/xpath/substring-non-positive-postion.html
new file mode 100644
index 0000000..321bf25
--- /dev/null
+++ b/LayoutTests/fast/xpath/substring-non-positive-postion.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../js/resources/js-test-style.css">
+<script src="../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=41913">bug 41913</a>:
+XPath substring function does not correctly handle non-positive values for the position argument</p>
+<div id="console"></div>
+
+<script>
+ shouldBe("document.evaluate(\"substring('abcde', 0)\", document, null, XPathResult.STRING_TYPE, null).stringValue", "'abcde'");
+ shouldBe("document.evaluate(\"substring('abcde', -2)\", document, null, XPathResult.STRING_TYPE, null).stringValue", "'abcde'");
+ shouldBe("document.evaluate(\"substring('abcde', 0, 5)\", document, null, XPathResult.STRING_TYPE, null).stringValue", "'abcd'");
+ shouldBe("document.evaluate(\"substring('abcde', -2, 5)\", document, null, XPathResult.STRING_TYPE, null).stringValue", "'ab'");
+
+ var successfullyParsed = true;
+
+</script>
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>