[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

eric at webkit.org eric at webkit.org
Wed Apr 7 23:56:12 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit c48972286d886ce402851f978382b4fc76061859
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Nov 25 02:45:02 2009 +0000

    2009-11-24  Jason Smith  <dark.panda at gmail.com>
    
            Reviewed by Alexey Proskuryakov.
    
            RegExp#exec's returned Array-like object behaves differently from
            regular Arrays
            https://bugs.webkit.org/show_bug.cgi?id=31689
    
            * LayoutTests/fast/js/regexp-in-and-foreach-handling.html: Added.
            * LayoutTests/fast/js/script-tests/regexp-in-and-foreach-handling.js: Added.
            * LayoutTests/fast/js/regexp-in-and-foreach-handling-expected.txt: Added.
    2009-11-24  Jason Smith  <dark.panda at gmail.com>
    
            Reviewed by Alexey Proskuryakov.
    
            RegExp#exec's returned Array-like object behaves differently from
            regular Arrays
            https://bugs.webkit.org/show_bug.cgi?id=31689
    
            * JavaScriptCore/runtime/RegExpConstructor.cpp: ensure that undefined
            values are added to the returned RegExpMatchesArray
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51369 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/ChangeLog b/ChangeLog
index cd33e03..e2bd730 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2009-11-24  Jason Smith  <dark.panda at gmail.com>
+
+        Reviewed by Alexey Proskuryakov.
+
+        RegExp#exec's returned Array-like object behaves differently from
+        regular Arrays
+        https://bugs.webkit.org/show_bug.cgi?id=31689
+
+        * LayoutTests/fast/js/regexp-in-and-foreach-handling.html: Added.
+        * LayoutTests/fast/js/script-tests/regexp-in-and-foreach-handling.js: Added.
+        * LayoutTests/fast/js/regexp-in-and-foreach-handling-expected.txt: Added.
+
 2009-11-24  Jens Alfke  <snej at chromium.org>
 
         Reviewed by David Levin.
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 195ecde..fca6524 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,14 @@
+2009-11-24  Jason Smith  <dark.panda at gmail.com>
+
+        Reviewed by Alexey Proskuryakov.
+
+        RegExp#exec's returned Array-like object behaves differently from
+        regular Arrays
+        https://bugs.webkit.org/show_bug.cgi?id=31689
+
+        * JavaScriptCore/runtime/RegExpConstructor.cpp: ensure that undefined
+        values are added to the returned RegExpMatchesArray
+
 2009-11-24  Oliver Hunt  <oliver at apple.com>
 
         Reviewed by Alexey Proskuryakov.
diff --git a/JavaScriptCore/runtime/RegExpConstructor.cpp b/JavaScriptCore/runtime/RegExpConstructor.cpp
index c609e08..e5c6909 100644
--- a/JavaScriptCore/runtime/RegExpConstructor.cpp
+++ b/JavaScriptCore/runtime/RegExpConstructor.cpp
@@ -132,6 +132,8 @@ void RegExpMatchesArray::fillArrayInstance(ExecState* exec)
         int start = d->lastOvector()[2 * i];
         if (start >= 0)
             JSArray::put(exec, i, jsSubstring(exec, d->lastInput, start, d->lastOvector()[2 * i + 1] - start));
+        else
+            JSArray::put(exec, i, jsUndefined());
     }
 
     PutPropertySlot slot;
diff --git a/LayoutTests/fast/js/regexp-in-and-foreach-handling-expected.txt b/LayoutTests/fast/js/regexp-in-and-foreach-handling-expected.txt
new file mode 100644
index 0000000..5c7c094
--- /dev/null
+++ b/LayoutTests/fast/js/regexp-in-and-foreach-handling-expected.txt
@@ -0,0 +1,21 @@
+Test for bug 31689: RegExp#exec's returned Array-like object behaves differently from regular Arrays
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS testRegExpMatchesArray(0) is ["abcdef", "a", undefined, "c", undefined, "e", undefined]
+PASS testInOperator(0) is ["abcdef", "a", undefined, "c", undefined, "e", undefined]
+PASS testForEachFunction(0) is ["abcdef", "a", undefined, "c", undefined, "e", undefined]
+PASS testRegExpMatchesArray(1) is ["a", "a", undefined]
+PASS testInOperator(1) is ["a", "a", undefined]
+PASS testForEachFunction(1) is ["a", "a", undefined]
+PASS testRegExpMatchesArray(2) is ["xa", undefined, "a"]
+PASS testInOperator(2) is ["xa", undefined, "a"]
+PASS testForEachFunction(2) is ["xa", undefined, "a"]
+PASS testRegExpMatchesArray(3) is ["xa", undefined, "a", undefined]
+PASS testInOperator(3) is ["xa", undefined, "a", undefined]
+PASS testForEachFunction(3) is ["xa", undefined, "a", undefined]
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/js/regexp-in-and-foreach-handling.html b/LayoutTests/fast/js/regexp-in-and-foreach-handling.html
new file mode 100644
index 0000000..b425988
--- /dev/null
+++ b/LayoutTests/fast/js/regexp-in-and-foreach-handling.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="resources/js-test-style.css">
+<script src="resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/regexp-in-and-foreach-handling.js"></script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/js/script-tests/regexp-in-and-foreach-handling.js b/LayoutTests/fast/js/script-tests/regexp-in-and-foreach-handling.js
new file mode 100644
index 0000000..ebf723d
--- /dev/null
+++ b/LayoutTests/fast/js/script-tests/regexp-in-and-foreach-handling.js
@@ -0,0 +1,51 @@
+description("Test for bug 31689: RegExp#exec's returned Array-like object behaves differently from regular Arrays");
+
+var tests = [
+    [ /(a)(_)?.+(c)(_)?.+(e)(_)?.+/, 'abcdef', '["abcdef", "a", undefined, "c", undefined, "e", undefined]' ],
+    [ /(a)(_)?/, 'abcdef', '["a", "a", undefined]' ],
+    [ /(_)?.+(a)/, 'xabcdef', '["xa", undefined, "a"]' ],
+    [ /(_)?.+(a)(_)?/, 'xabcdef', '["xa", undefined, "a", undefined]' ],
+];
+
+function testRegExpMatchesArray(i)
+{
+    return tests[i][0].exec(tests[i][1]);
+}
+
+function testInOperator(i)
+{
+    var re = tests[i][0],
+        str = tests[i][1],
+        inArray = [],
+        matches = re.exec(str);
+
+    for (var j = 0; j < matches.length; j++) {
+        if (j in matches) {
+            inArray.push(matches[j]);
+        }
+    }
+    return inArray;
+}
+
+function testForEachFunction(i) 
+{
+    var re = tests[i][0],
+        str = tests[i][1],
+        inArray = [],
+        matches = re.exec(str);
+
+    matches.forEach(function(m) {
+        inArray.push(m);
+    });
+    return inArray;
+
+}
+
+for (var i in tests) {
+    shouldBe('testRegExpMatchesArray(' + i + ')', tests[i][2]);
+    shouldBe('testInOperator(' + i + ')', tests[i][2]);
+    shouldBe('testForEachFunction(' + i + ')', tests[i][2]);
+}
+
+var successfullyParsed = true;
+

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list