Bug 20142: REGRESSION(r35245): /=/ weirdness
authoroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Jul 2008 10:16:51 +0000 (10:16 +0000)
committeroliver@apple.com <oliver@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Jul 2008 10:16:51 +0000 (10:16 +0000)
<https://bugs.webkit.org/show_bug.cgi?id=20142>

Reviewed by Alexey Proskuryakov.

When adding all the meta data needed for exception error messages
I accidentally clobbered the handling of regex beginning with /=.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@35323 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JavaScriptCore/ChangeLog
JavaScriptCore/kjs/grammar.y
LayoutTests/ChangeLog
LayoutTests/fast/js/regexp-divequal-expected.txt [new file with mode: 0644]
LayoutTests/fast/js/regexp-divequal.html [new file with mode: 0644]
LayoutTests/fast/js/resources/regexp-divequal.js [new file with mode: 0644]

index b307604..a6b842e 100644 (file)
@@ -1,3 +1,15 @@
+2008-07-24  Oliver Hunt  <oliver@apple.com>
+
+        Reviewed by Alexey Proskuryakov.
+
+        Bug 20142: REGRESSION(r35245): /=/ weirdness
+        <https://bugs.webkit.org/show_bug.cgi?id=20142>
+
+        When adding all the meta data needed for exception error messages
+        I accidentally clobbered the handling of regex beginning with /=.
+
+        * kjs/grammar.y:
+
 2008-07-23  Alp Toker  <alp@nuanti.com>
 
         Build fix after r35293: Add API/ to the include path.
index a9e55f8..00aaeae 100644 (file)
@@ -297,7 +297,7 @@ Literal:
                                             Lexer& l = *LEXER;
                                             if (!l.scanRegExp())
                                                 YYABORT;
-                                            RegExpNode* node = new RegExpNode(GLOBAL_DATA, l.pattern(), l.flags());
+                                            RegExpNode* node = new RegExpNode(GLOBAL_DATA, "=" + l.pattern(), l.flags());
                                             int size = l.pattern().size() + 2; // + 2 for the two /'s
                                             SET_EXCEPTION_LOCATION(node, @1.first_column, @1.first_column + size, @1.first_column + size);
                                             $$ = createNodeFeatureInfo<ExpressionNode*>(node, 0);
index 48c5828..290af27 100644 (file)
@@ -1,3 +1,13 @@
+2008-07-24  Oliver Hunt  <oliver@apple.com>
+
+        Reviewed by Alexey Proskuryakov.
+
+        Test cases for regex starting with /=
+
+        * fast/js/regexp-divequal-expected.txt: Added.
+        * fast/js/regexp-divequal.html: Added.
+        * fast/js/resources/regexp-divequal.js: Added.
+
 2008-07-23  Julien Chaffraix  <jchaffraix@webkit.org>
 
         Reviewed by Eric.
diff --git a/LayoutTests/fast/js/regexp-divequal-expected.txt b/LayoutTests/fast/js/regexp-divequal-expected.txt
new file mode 100644 (file)
index 0000000..b2d3a94
--- /dev/null
@@ -0,0 +1,14 @@
+Test JS parser handling of regex literals starting with /=
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS /=/.toString() is '/=/'
+PASS /=/.test('') is false
+PASS /=/.test('=') is true
+PASS '='.match(/=/) is ['=']
+PASS '='.match(/\=/) is ['=']
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/js/regexp-divequal.html b/LayoutTests/fast/js/regexp-divequal.html
new file mode 100644 (file)
index 0000000..ce8f82e
--- /dev/null
@@ -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="resources/regexp-divequal.js"></script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/js/resources/regexp-divequal.js b/LayoutTests/fast/js/resources/regexp-divequal.js
new file mode 100644 (file)
index 0000000..1fe1865
--- /dev/null
@@ -0,0 +1,9 @@
+description('Test JS parser handling of regex literals starting with /=');
+
+shouldBe("/=/.toString()", "'/=/'");
+shouldBeFalse("/=/.test('')");
+shouldBeTrue("/=/.test('=')");
+shouldBe("'='.match(/=/)", "['=']");
+shouldBe("'='.match(/\\=/)", "['=']");
+
+var successfullyParsed = true;