[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e

barraclough at apple.com barraclough at apple.com
Fri Jan 21 14:46:53 UTC 2011


The following commit has been merged in the debian/experimental branch:
commit f7cdf3681eae0288d1d770ce43a6229aa63f3b2d
Author: barraclough at apple.com <barraclough at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Dec 30 00:00:24 2010 +0000

    Bug 51724 - In strict mode string literals should allow \0, but disallow \8 and \9.
    
    Reviewed by Sam Weinig.
    
    JavaScriptCore:
    
    * parser/Lexer.cpp:
    (JSC::Lexer::parseString):
    
    LayoutTests:
    
    * fast/js/numeric-escapes-in-string-literals-expected.txt: Added.
    * fast/js/numeric-escapes-in-string-literals.html: Added.
    * fast/js/script-tests/numeric-escapes-in-string-literals.js: Added.
    (test):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74767 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index c868f29..7e117ba 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,12 @@
+2010-12-29  Gavin Barraclough  <barraclough at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Bug 51724 - In strict mode string literals should allow \0, but disallow \8 and \9.
+
+        * parser/Lexer.cpp:
+        (JSC::Lexer::parseString):
+
 2010-12-29  Helder Correia  <helder at sencha.com>
 
         Reviewed by Eric Seidel.
diff --git a/JavaScriptCore/parser/Lexer.cpp b/JavaScriptCore/parser/Lexer.cpp
index b443561..ff7079f 100644
--- a/JavaScriptCore/parser/Lexer.cpp
+++ b/JavaScriptCore/parser/Lexer.cpp
@@ -492,10 +492,15 @@ ALWAYS_INLINE bool Lexer::parseString(JSTokenData* lvalp, bool strictMode)
                     record16('u');
                 else // Only stringQuoteCharacter allowed after \u
                     return false;
-            } else if (isASCIIOctalDigit(m_current)) {
-                // Octal character sequences
-                if (strictMode)
+            } else if (strictMode && isASCIIDigit(m_current)) {
+                // The only valid numeric escape in strict mode is '\0', and this must not be followed by a decimal digit.
+                int character1 = m_current;
+                shift();
+                if (character1 != '0' || isASCIIDigit(m_current))
                     return false;
+                record16(0);
+            } else if (!strictMode && isASCIIOctalDigit(m_current)) {
+                // Octal character sequences
                 int character1 = m_current;
                 shift();
                 if (isASCIIOctalDigit(m_current)) {
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 15673c5..2a79630 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,14 @@
+2010-12-29  Gavin Barraclough  <barraclough at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Bug 51724 - In strict mode string literals should allow \0, but disallow \8 and \9.
+
+        * fast/js/numeric-escapes-in-string-literals-expected.txt: Added.
+        * fast/js/numeric-escapes-in-string-literals.html: Added.
+        * fast/js/script-tests/numeric-escapes-in-string-literals.js: Added.
+        (test):
+
 2010-12-29  Mihai Parparita  <mihaip at chromium.org>
 
         Unreviewed Chromium expectations update. Mark another test as flaky.
diff --git a/LayoutTests/fast/js/numeric-escapes-in-string-literals-expected.txt b/LayoutTests/fast/js/numeric-escapes-in-string-literals-expected.txt
new file mode 100644
index 0000000..922bf76
--- /dev/null
+++ b/LayoutTests/fast/js/numeric-escapes-in-string-literals-expected.txt
@@ -0,0 +1,45 @@
+Test numeric escapes in string literals - https://bugs.webkit.org/show_bug.cgi?id=51724
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS eval(stringLiteral) is nonStrictResult
+PASS eval(stringLiteral) is strictResult
+PASS eval(stringLiteral) is nonStrictResult
+PASS eval(stringLiteral) threw exception SyntaxError: Parse error.
+PASS eval(stringLiteral) is nonStrictResult
+PASS eval(stringLiteral) threw exception SyntaxError: Parse error.
+PASS eval(stringLiteral) is nonStrictResult
+PASS eval(stringLiteral) threw exception SyntaxError: Parse error.
+PASS eval(stringLiteral) is nonStrictResult
+PASS eval(stringLiteral) threw exception SyntaxError: Parse error.
+PASS eval(stringLiteral) is nonStrictResult
+PASS eval(stringLiteral) threw exception SyntaxError: Parse error.
+PASS eval(stringLiteral) is nonStrictResult
+PASS eval(stringLiteral) threw exception SyntaxError: Parse error.
+PASS eval(stringLiteral) is nonStrictResult
+PASS eval(stringLiteral) threw exception SyntaxError: Parse error.
+PASS eval(stringLiteral) is nonStrictResult
+PASS eval(stringLiteral) threw exception SyntaxError: Parse error.
+PASS eval(stringLiteral) is nonStrictResult
+PASS eval(stringLiteral) threw exception SyntaxError: Parse error.
+PASS eval(stringLiteral) is nonStrictResult
+PASS eval(stringLiteral) threw exception SyntaxError: Parse error.
+PASS eval(stringLiteral) is nonStrictResult
+PASS eval(stringLiteral) threw exception SyntaxError: Parse error.
+PASS eval(stringLiteral) is nonStrictResult
+PASS eval(stringLiteral) threw exception SyntaxError: Parse error.
+PASS eval(stringLiteral) is nonStrictResult
+PASS eval(stringLiteral) threw exception SyntaxError: Parse error.
+PASS eval(stringLiteral) is nonStrictResult
+PASS eval(stringLiteral) threw exception SyntaxError: Parse error.
+PASS eval(stringLiteral) is nonStrictResult
+PASS eval(stringLiteral) threw exception SyntaxError: Parse error.
+PASS eval(stringLiteral) is nonStrictResult
+PASS eval(stringLiteral) threw exception SyntaxError: Parse error.
+PASS eval(stringLiteral) is nonStrictResult
+PASS eval(stringLiteral) threw exception SyntaxError: Parse error.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/js/numeric-escapes-in-string-literals.html b/LayoutTests/fast/js/numeric-escapes-in-string-literals.html
new file mode 100644
index 0000000..aeef8ea
--- /dev/null
+++ b/LayoutTests/fast/js/numeric-escapes-in-string-literals.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/numeric-escapes-in-string-literals.js"></script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/js/script-tests/numeric-escapes-in-string-literals.js b/LayoutTests/fast/js/script-tests/numeric-escapes-in-string-literals.js
new file mode 100644
index 0000000..3ba392e
--- /dev/null
+++ b/LayoutTests/fast/js/script-tests/numeric-escapes-in-string-literals.js
@@ -0,0 +1,48 @@
+description(
+"Test numeric escapes in string literals - https://bugs.webkit.org/show_bug.cgi?id=51724"
+);
+
+function test(_stringLiteral, _nonStrictResult, _strictResult)
+{
+    stringLiteral = '"' + _stringLiteral + '"';
+    nonStrictResult = _nonStrictResult;
+    shouldBe("eval(stringLiteral)", "nonStrictResult");
+
+    stringLiteral = '"use strict"; ' + stringLiteral;
+    if (_strictResult) {
+        strictResult = _strictResult;
+        shouldBe("eval(stringLiteral)", "strictResult");
+    } else
+        shouldThrow("eval(stringLiteral)");
+}
+
+// Tests for single digit octal and decimal escapes.
+// In non-strict mode 0-7 are octal escapes, 8-9 are NonEscapeCharacters.
+// In strict mode only "\0" is permitted.
+test("\\0", "\x00", "\x00");
+test("\\1", "\x01");
+test("\\7", "\x07");
+test("\\8", "8");
+test("\\9", "9");
+
+// Tests for multi-digit octal values outside strict mode;
+// Octal literals may be 1-3 digits long.  In strict more all multi-digit sequences are illegal.
+test("\\00", "\x00");
+test("\\000", "\x00");
+test("\\0000", "\x000");
+
+test("\\01", "\x01");
+test("\\001", "\x01");
+test("\\0001", "\x001");
+
+test("\\10", "\x08");
+test("\\100", "\x40");
+test("\\1000", "\x400");
+
+test("\\19", "\x019");
+test("\\109", "\x089");
+test("\\1009", "\x409");
+
+test("\\99", "99");
+
+var successfullyParsed = true;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list