[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

oliver at apple.com oliver at apple.com
Wed Dec 22 11:17:06 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 7db79c53b150fc8f97c4a4323055cbacf3ab484b
Author: oliver at apple.com <oliver at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jul 16 18:32:42 2010 +0000

    2010-07-16  Oliver Hunt  <oliver at apple.com>
    
            Reviewed by Geoffrey Garen.
    
            ES5 allows use of reserved words as IdentifierName
            https://bugs.webkit.org/show_bug.cgi?id=42471
    
            Modify the lexer to allow us to avoid identifying reserved
            words in those contexts where they are valid identifiers, and
            we know it's safe.  Additionally tag the reserved word tokens
            so we can easily identify them in those cases where we can't
            guarantee that we've skipped reserved word identification.
    
            * parser/JSParser.cpp:
            (JSC::JSParser::next):
            (JSC::JSParser::parseProperty):
            (JSC::JSParser::parseMemberExpression):
            * parser/JSParser.h:
            (JSC::):
            * parser/Lexer.cpp:
            (JSC::Lexer::lex):
            * parser/Lexer.h:
            (JSC::Lexer::):
    2010-07-16  Oliver Hunt  <oliver at apple.com>
    
            Reviewed by Geoffrey Garen.
    
            ES5 allows use of reserved words as IdentifierName
            https://bugs.webkit.org/show_bug.cgi?id=42471
    
            Add tests to check for correct handling of reserved words with
            the ES5 semantics.
    
            * fast/js/reserved-words-as-property-expected.txt: Added.
            * fast/js/reserved-words-as-property.html: Added.
            * fast/js/script-tests/reserved-words-as-property.js: Added.
            ():
            * fast/js/sputnik/Conformance/11_Expressions/11.1_Primary_Expressions/11.1.5_Object_Initializer/S11.1.5_A4.1-expected.txt:
            * fast/js/sputnik/Conformance/11_Expressions/11.1_Primary_Expressions/11.1.5_Object_Initializer/S11.1.5_A4.2-expected.txt:
              These tests are wrong, unsure how to get sputnik tests corrected.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63566 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 136e70c..78c7dbc 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,27 @@
+2010-07-16  Oliver Hunt  <oliver at apple.com>
+
+        Reviewed by Geoffrey Garen.
+
+        ES5 allows use of reserved words as IdentifierName
+        https://bugs.webkit.org/show_bug.cgi?id=42471
+
+        Modify the lexer to allow us to avoid identifying reserved
+        words in those contexts where they are valid identifiers, and
+        we know it's safe.  Additionally tag the reserved word tokens
+        so we can easily identify them in those cases where we can't
+        guarantee that we've skipped reserved word identification.
+
+        * parser/JSParser.cpp:
+        (JSC::JSParser::next):
+        (JSC::JSParser::parseProperty):
+        (JSC::JSParser::parseMemberExpression):
+        * parser/JSParser.h:
+        (JSC::):
+        * parser/Lexer.cpp:
+        (JSC::Lexer::lex):
+        * parser/Lexer.h:
+        (JSC::Lexer::):
+
 2010-07-16  Anders Carlsson  <andersca at apple.com>
 
         Reviewed by David Levin.
diff --git a/JavaScriptCore/parser/JSParser.cpp b/JavaScriptCore/parser/JSParser.cpp
index 1fb1a91..13013c7 100644
--- a/JavaScriptCore/parser/JSParser.cpp
+++ b/JavaScriptCore/parser/JSParser.cpp
@@ -85,12 +85,12 @@ private:
     };
 
     const JSToken& token() { return m_token; }
-    void next()
+    void next(Lexer::LexType lexType = Lexer::IdentifyReservedWords)
     {
         m_lastLine = token().m_info.line;
         m_lastTokenEnd = token().m_info.endOffset;
         m_lexer->setLastLineNumber(m_lastLine);
-        m_token.m_type = m_lexer->lex(&m_token.m_data, &m_token.m_info);
+        m_token.m_type = m_lexer->lex(&m_token.m_data, &m_token.m_info, lexType);
         m_tokenCount++;
     }
 
@@ -1091,11 +1091,12 @@ template <bool complete, class TreeBuilder> TreeProperty JSParser::parseProperty
 {
     bool wasIdent = false;
     switch (token().m_type) {
+    namedProperty:
     case IDENT:
         wasIdent = true;
     case STRING: {
         const Identifier* ident = token().m_data.ident;
-        next();
+        next(Lexer::IgnoreReservedWords);
         if (match(COLON)) {
             next();
             TreeExpression node = parseAssignmentExpression(context);
@@ -1129,7 +1130,8 @@ template <bool complete, class TreeBuilder> TreeProperty JSParser::parseProperty
         return context.template createProperty<complete>(m_globalData, propertyName, node, PropertyNode::Constant);
     }
     default:
-        fail();
+        failIfFalse(token().m_type & KeywordTokenFlag);
+        goto namedProperty;
     }
 }
 
@@ -1410,7 +1412,7 @@ template <class TreeBuilder> TreeExpression JSParser::parseMemberExpression(Tree
         }
         case DOT: {
             int expressionEnd = lastTokenEnd();
-            next();
+            next(Lexer::IgnoreReservedWords);
             matchOrFail(IDENT);
             base = context.createDotAccess(base, *token().m_data.ident, expressionStart, expressionEnd, tokenEnd());
             next();
diff --git a/JavaScriptCore/parser/JSParser.h b/JavaScriptCore/parser/JSParser.h
index 60f284c..b5a21d9 100644
--- a/JavaScriptCore/parser/JSParser.h
+++ b/JavaScriptCore/parser/JSParser.h
@@ -34,16 +34,17 @@ class SourceCode;
 
 enum {
     UnaryOpTokenFlag = 64,
-    BinaryOpTokenPrecedenceShift = 7,
+    KeywordTokenFlag = 128,
+    BinaryOpTokenPrecedenceShift = 8,
     BinaryOpTokenAllowsInPrecedenceAdditionalShift = 4,
-    BinaryOpTokenPrecedenceMask = 15 << BinaryOpTokenPrecedenceShift
+    BinaryOpTokenPrecedenceMask = 15 << BinaryOpTokenPrecedenceShift,
 };
 
 #define BINARY_OP_PRECEDENCE(prec) (((prec) << BinaryOpTokenPrecedenceShift) | ((prec) << (BinaryOpTokenPrecedenceShift + BinaryOpTokenAllowsInPrecedenceAdditionalShift)))
 #define IN_OP_PRECEDENCE(prec) ((prec) << (BinaryOpTokenPrecedenceShift + BinaryOpTokenAllowsInPrecedenceAdditionalShift))
 
 enum JSTokenType {
-    NULLTOKEN,
+    NULLTOKEN = KeywordTokenFlag,
     TRUETOKEN,
     FALSETOKEN,
     BREAK,
@@ -69,7 +70,7 @@ enum JSTokenType {
     FINALLY,
     DEBUGGER,
     ELSE,
-    OPENBRACE,
+    OPENBRACE = 0,
     CLOSEBRACE,
     OPENPAREN,
     CLOSEPAREN,
@@ -106,9 +107,9 @@ enum JSTokenType {
     TILDE = 3 | UnaryOpTokenFlag,
     AUTOPLUSPLUS = 4 | UnaryOpTokenFlag,
     AUTOMINUSMINUS = 5 | UnaryOpTokenFlag,
-    TYPEOF = 6 | UnaryOpTokenFlag,
-    VOIDTOKEN = 7 | UnaryOpTokenFlag,
-    DELETETOKEN = 8 | UnaryOpTokenFlag,
+    TYPEOF = 6 | UnaryOpTokenFlag | KeywordTokenFlag,
+    VOIDTOKEN = 7 | UnaryOpTokenFlag | KeywordTokenFlag,
+    DELETETOKEN = 8 | UnaryOpTokenFlag | KeywordTokenFlag,
     OR = 0 | BINARY_OP_PRECEDENCE(1),
     AND = 1 | BINARY_OP_PRECEDENCE(2),
     BITOR = 2 | BINARY_OP_PRECEDENCE(3),
@@ -122,8 +123,8 @@ enum JSTokenType {
     GT = 10 | BINARY_OP_PRECEDENCE(7),
     LE = 11 | BINARY_OP_PRECEDENCE(7),
     GE = 12 | BINARY_OP_PRECEDENCE(7),
-    INSTANCEOF = 13 | BINARY_OP_PRECEDENCE(7),
-    INTOKEN = 14 | IN_OP_PRECEDENCE(7),
+    INSTANCEOF = 13 | BINARY_OP_PRECEDENCE(7) | KeywordTokenFlag,
+    INTOKEN = 14 | IN_OP_PRECEDENCE(7) | KeywordTokenFlag,
     LSHIFT = 15 | BINARY_OP_PRECEDENCE(8),
     RSHIFT = 16 | BINARY_OP_PRECEDENCE(8),
     URSHIFT = 17 | BINARY_OP_PRECEDENCE(8),
diff --git a/JavaScriptCore/parser/Lexer.cpp b/JavaScriptCore/parser/Lexer.cpp
index b6387e7..d7a122e 100644
--- a/JavaScriptCore/parser/Lexer.cpp
+++ b/JavaScriptCore/parser/Lexer.cpp
@@ -481,7 +481,7 @@ ALWAYS_INLINE bool Lexer::parseString(JSTokenData* lvalp)
     return true;
 }
 
-JSTokenType Lexer::lex(JSTokenData* lvalp, JSTokenInfo* llocp)
+JSTokenType Lexer::lex(JSTokenData* lvalp, JSTokenInfo* llocp, LexType lexType)
 {
     ASSERT(!m_error);
     ASSERT(m_buffer8.isEmpty());
@@ -1022,9 +1022,11 @@ doneIdentifierOrKeyword: {
     m_atLineStart = false;
     m_delimited = false;
     m_buffer16.resize(0);
-    const HashEntry* entry = m_keywordTable.entry(m_globalData, *lvalp->ident);
-    token = entry ? static_cast<JSTokenType>(entry->lexerValue()) : IDENT;
-
+    if (lexType == IdentifyReservedWords) {
+        const HashEntry* entry = m_keywordTable.entry(m_globalData, *lvalp->ident);
+        token = entry ? static_cast<JSTokenType>(entry->lexerValue()) : IDENT;
+    } else
+        token = IDENT;
     // Fall through into returnToken.
 }
 
diff --git a/JavaScriptCore/parser/Lexer.h b/JavaScriptCore/parser/Lexer.h
index c30ee1d..4f7af44 100644
--- a/JavaScriptCore/parser/Lexer.h
+++ b/JavaScriptCore/parser/Lexer.h
@@ -50,7 +50,8 @@ namespace JSC {
         void setIsReparsing() { m_isReparsing = true; }
 
         // Functions for the parser itself.
-        JSTokenType lex(JSTokenData* lvalp, JSTokenInfo* llocp);
+        enum LexType { IdentifyReservedWords, IgnoreReservedWords };
+        JSTokenType lex(JSTokenData* lvalp, JSTokenInfo* llocp, LexType);
         int lineNumber() const { return m_lineNumber; }
         void setLastLineNumber(int lastLineNumber) { m_lastLineNumber = lastLineNumber; }
         int lastLineNumber() const { return m_lastLineNumber; }
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 16d35da..122aaa5 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,21 @@
+2010-07-16  Oliver Hunt  <oliver at apple.com>
+
+        Reviewed by Geoffrey Garen.
+
+        ES5 allows use of reserved words as IdentifierName
+        https://bugs.webkit.org/show_bug.cgi?id=42471
+
+        Add tests to check for correct handling of reserved words with
+        the ES5 semantics.
+
+        * fast/js/reserved-words-as-property-expected.txt: Added.
+        * fast/js/reserved-words-as-property.html: Added.
+        * fast/js/script-tests/reserved-words-as-property.js: Added.
+        ():
+        * fast/js/sputnik/Conformance/11_Expressions/11.1_Primary_Expressions/11.1.5_Object_Initializer/S11.1.5_A4.1-expected.txt:
+        * fast/js/sputnik/Conformance/11_Expressions/11.1_Primary_Expressions/11.1.5_Object_Initializer/S11.1.5_A4.2-expected.txt:
+          These tests are wrong, unsure how to get sputnik tests corrected.
+
 2010-07-16  Anders Carlsson  <andersca at apple.com>
 
         Reviewed by Alexey Proskuryakov. 
diff --git a/LayoutTests/fast/js/reserved-words-as-property-expected.txt b/LayoutTests/fast/js/reserved-words-as-property-expected.txt
new file mode 100644
index 0000000..8fed288
--- /dev/null
+++ b/LayoutTests/fast/js/reserved-words-as-property-expected.txt
@@ -0,0 +1,335 @@
+Tests to ensure that we can use ES reserved words as property names.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS var true threw exception SyntaxError: Parse error.
+PASS (function(){var true}) threw exception SyntaxError: Parse error.
+PASS function g(true){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(true){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(true){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(true){}}) threw exception SyntaxError: Parse error.
+PASS function true(){} threw exception SyntaxError: Parse error.
+PASS (function(){function true(){}}) threw exception SyntaxError: Parse error.
+PASS var false threw exception SyntaxError: Parse error.
+PASS (function(){var false}) threw exception SyntaxError: Parse error.
+PASS function g(false){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(false){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(false){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(false){}}) threw exception SyntaxError: Parse error.
+PASS function false(){} threw exception SyntaxError: Parse error.
+PASS (function(){function false(){}}) threw exception SyntaxError: Parse error.
+PASS var null threw exception SyntaxError: Parse error.
+PASS (function(){var null}) threw exception SyntaxError: Parse error.
+PASS function g(null){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(null){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(null){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(null){}}) threw exception SyntaxError: Parse error.
+PASS function null(){} threw exception SyntaxError: Parse error.
+PASS (function(){function null(){}}) threw exception SyntaxError: Parse error.
+PASS var break threw exception SyntaxError: Parse error.
+PASS (function(){var break}) threw exception SyntaxError: Parse error.
+PASS function g(break){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(break){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(break){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(break){}}) threw exception SyntaxError: Parse error.
+PASS function break(){} threw exception SyntaxError: Parse error.
+PASS (function(){function break(){}}) threw exception SyntaxError: Parse error.
+PASS var case threw exception SyntaxError: Parse error.
+PASS (function(){var case}) threw exception SyntaxError: Parse error.
+PASS function g(case){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(case){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(case){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(case){}}) threw exception SyntaxError: Parse error.
+PASS function case(){} threw exception SyntaxError: Parse error.
+PASS (function(){function case(){}}) threw exception SyntaxError: Parse error.
+PASS var catch threw exception SyntaxError: Parse error.
+PASS (function(){var catch}) threw exception SyntaxError: Parse error.
+PASS function g(catch){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(catch){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(catch){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(catch){}}) threw exception SyntaxError: Parse error.
+PASS function catch(){} threw exception SyntaxError: Parse error.
+PASS (function(){function catch(){}}) threw exception SyntaxError: Parse error.
+PASS var continue threw exception SyntaxError: Parse error.
+PASS (function(){var continue}) threw exception SyntaxError: Parse error.
+PASS function g(continue){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(continue){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(continue){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(continue){}}) threw exception SyntaxError: Parse error.
+PASS function continue(){} threw exception SyntaxError: Parse error.
+PASS (function(){function continue(){}}) threw exception SyntaxError: Parse error.
+PASS var debugger threw exception SyntaxError: Parse error.
+PASS (function(){var debugger}) threw exception SyntaxError: Parse error.
+PASS function g(debugger){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(debugger){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(debugger){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(debugger){}}) threw exception SyntaxError: Parse error.
+PASS function debugger(){} threw exception SyntaxError: Parse error.
+PASS (function(){function debugger(){}}) threw exception SyntaxError: Parse error.
+PASS var default threw exception SyntaxError: Parse error.
+PASS (function(){var default}) threw exception SyntaxError: Parse error.
+PASS function g(default){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(default){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(default){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(default){}}) threw exception SyntaxError: Parse error.
+PASS function default(){} threw exception SyntaxError: Parse error.
+PASS (function(){function default(){}}) threw exception SyntaxError: Parse error.
+PASS var delete threw exception SyntaxError: Parse error.
+PASS (function(){var delete}) threw exception SyntaxError: Parse error.
+PASS function g(delete){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(delete){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(delete){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(delete){}}) threw exception SyntaxError: Parse error.
+PASS function delete(){} threw exception SyntaxError: Parse error.
+PASS (function(){function delete(){}}) threw exception SyntaxError: Parse error.
+PASS var do threw exception SyntaxError: Parse error.
+PASS (function(){var do}) threw exception SyntaxError: Parse error.
+PASS function g(do){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(do){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(do){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(do){}}) threw exception SyntaxError: Parse error.
+PASS function do(){} threw exception SyntaxError: Parse error.
+PASS (function(){function do(){}}) threw exception SyntaxError: Parse error.
+PASS var else threw exception SyntaxError: Parse error.
+PASS (function(){var else}) threw exception SyntaxError: Parse error.
+PASS function g(else){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(else){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(else){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(else){}}) threw exception SyntaxError: Parse error.
+PASS function else(){} threw exception SyntaxError: Parse error.
+PASS (function(){function else(){}}) threw exception SyntaxError: Parse error.
+PASS var finally threw exception SyntaxError: Parse error.
+PASS (function(){var finally}) threw exception SyntaxError: Parse error.
+PASS function g(finally){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(finally){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(finally){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(finally){}}) threw exception SyntaxError: Parse error.
+PASS function finally(){} threw exception SyntaxError: Parse error.
+PASS (function(){function finally(){}}) threw exception SyntaxError: Parse error.
+PASS var for threw exception SyntaxError: Parse error.
+PASS (function(){var for}) threw exception SyntaxError: Parse error.
+PASS function g(for){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(for){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(for){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(for){}}) threw exception SyntaxError: Parse error.
+PASS function for(){} threw exception SyntaxError: Parse error.
+PASS (function(){function for(){}}) threw exception SyntaxError: Parse error.
+PASS var function threw exception SyntaxError: Parse error.
+PASS (function(){var function}) threw exception SyntaxError: Parse error.
+PASS function g(function){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(function){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(function){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(function){}}) threw exception SyntaxError: Parse error.
+PASS function function(){} threw exception SyntaxError: Parse error.
+PASS (function(){function function(){}}) threw exception SyntaxError: Parse error.
+PASS var if threw exception SyntaxError: Parse error.
+PASS (function(){var if}) threw exception SyntaxError: Parse error.
+PASS function g(if){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(if){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(if){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(if){}}) threw exception SyntaxError: Parse error.
+PASS function if(){} threw exception SyntaxError: Parse error.
+PASS (function(){function if(){}}) threw exception SyntaxError: Parse error.
+PASS var in threw exception SyntaxError: Parse error.
+PASS (function(){var in}) threw exception SyntaxError: Parse error.
+PASS function g(in){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(in){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(in){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(in){}}) threw exception SyntaxError: Parse error.
+PASS function in(){} threw exception SyntaxError: Parse error.
+PASS (function(){function in(){}}) threw exception SyntaxError: Parse error.
+PASS var instanceof threw exception SyntaxError: Parse error.
+PASS (function(){var instanceof}) threw exception SyntaxError: Parse error.
+PASS function g(instanceof){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(instanceof){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(instanceof){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(instanceof){}}) threw exception SyntaxError: Parse error.
+PASS function instanceof(){} threw exception SyntaxError: Parse error.
+PASS (function(){function instanceof(){}}) threw exception SyntaxError: Parse error.
+PASS var new threw exception SyntaxError: Parse error.
+PASS (function(){var new}) threw exception SyntaxError: Parse error.
+PASS function g(new){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(new){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(new){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(new){}}) threw exception SyntaxError: Parse error.
+PASS function new(){} threw exception SyntaxError: Parse error.
+PASS (function(){function new(){}}) threw exception SyntaxError: Parse error.
+PASS var return threw exception SyntaxError: Parse error.
+PASS (function(){var return}) threw exception SyntaxError: Parse error.
+PASS function g(return){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(return){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(return){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(return){}}) threw exception SyntaxError: Parse error.
+PASS function return(){} threw exception SyntaxError: Parse error.
+PASS (function(){function return(){}}) threw exception SyntaxError: Parse error.
+PASS var switch threw exception SyntaxError: Parse error.
+PASS (function(){var switch}) threw exception SyntaxError: Parse error.
+PASS function g(switch){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(switch){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(switch){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(switch){}}) threw exception SyntaxError: Parse error.
+PASS function switch(){} threw exception SyntaxError: Parse error.
+PASS (function(){function switch(){}}) threw exception SyntaxError: Parse error.
+PASS var this threw exception SyntaxError: Parse error.
+PASS (function(){var this}) threw exception SyntaxError: Parse error.
+PASS function g(this){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(this){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(this){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(this){}}) threw exception SyntaxError: Parse error.
+PASS function this(){} threw exception SyntaxError: Parse error.
+PASS (function(){function this(){}}) threw exception SyntaxError: Parse error.
+PASS var throw threw exception SyntaxError: Parse error.
+PASS (function(){var throw}) threw exception SyntaxError: Parse error.
+PASS function g(throw){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(throw){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(throw){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(throw){}}) threw exception SyntaxError: Parse error.
+PASS function throw(){} threw exception SyntaxError: Parse error.
+PASS (function(){function throw(){}}) threw exception SyntaxError: Parse error.
+PASS var try threw exception SyntaxError: Parse error.
+PASS (function(){var try}) threw exception SyntaxError: Parse error.
+PASS function g(try){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(try){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(try){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(try){}}) threw exception SyntaxError: Parse error.
+PASS function try(){} threw exception SyntaxError: Parse error.
+PASS (function(){function try(){}}) threw exception SyntaxError: Parse error.
+PASS var typeof threw exception SyntaxError: Parse error.
+PASS (function(){var typeof}) threw exception SyntaxError: Parse error.
+PASS function g(typeof){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(typeof){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(typeof){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(typeof){}}) threw exception SyntaxError: Parse error.
+PASS function typeof(){} threw exception SyntaxError: Parse error.
+PASS (function(){function typeof(){}}) threw exception SyntaxError: Parse error.
+PASS var var threw exception SyntaxError: Parse error.
+PASS (function(){var var}) threw exception SyntaxError: Parse error.
+PASS function g(var){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(var){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(var){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(var){}}) threw exception SyntaxError: Parse error.
+PASS function var(){} threw exception SyntaxError: Parse error.
+PASS (function(){function var(){}}) threw exception SyntaxError: Parse error.
+PASS var void threw exception SyntaxError: Parse error.
+PASS (function(){var void}) threw exception SyntaxError: Parse error.
+PASS function g(void){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(void){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(void){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(void){}}) threw exception SyntaxError: Parse error.
+PASS function void(){} threw exception SyntaxError: Parse error.
+PASS (function(){function void(){}}) threw exception SyntaxError: Parse error.
+PASS var while threw exception SyntaxError: Parse error.
+PASS (function(){var while}) threw exception SyntaxError: Parse error.
+PASS function g(while){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(while){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(while){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(while){}}) threw exception SyntaxError: Parse error.
+PASS function while(){} threw exception SyntaxError: Parse error.
+PASS (function(){function while(){}}) threw exception SyntaxError: Parse error.
+PASS var with threw exception SyntaxError: Parse error.
+PASS (function(){var with}) threw exception SyntaxError: Parse error.
+PASS function g(with){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(with){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(with){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(with){}}) threw exception SyntaxError: Parse error.
+PASS function with(){} threw exception SyntaxError: Parse error.
+PASS (function(){function with(){}}) threw exception SyntaxError: Parse error.
+PASS var class threw exception SyntaxError: Parse error.
+PASS (function(){var class}) threw exception SyntaxError: Parse error.
+PASS function g(class){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(class){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(class){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(class){}}) threw exception SyntaxError: Parse error.
+PASS function class(){} threw exception SyntaxError: Parse error.
+PASS (function(){function class(){}}) threw exception SyntaxError: Parse error.
+PASS var const threw exception SyntaxError: Parse error.
+PASS (function(){var const}) threw exception SyntaxError: Parse error.
+PASS function g(const){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(const){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(const){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(const){}}) threw exception SyntaxError: Parse error.
+PASS function const(){} threw exception SyntaxError: Parse error.
+PASS (function(){function const(){}}) threw exception SyntaxError: Parse error.
+PASS var enum threw exception SyntaxError: Parse error.
+PASS (function(){var enum}) threw exception SyntaxError: Parse error.
+PASS function g(enum){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(enum){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(enum){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(enum){}}) threw exception SyntaxError: Parse error.
+PASS function enum(){} threw exception SyntaxError: Parse error.
+PASS (function(){function enum(){}}) threw exception SyntaxError: Parse error.
+PASS var export threw exception SyntaxError: Parse error.
+PASS (function(){var export}) threw exception SyntaxError: Parse error.
+PASS function g(export){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(export){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(export){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(export){}}) threw exception SyntaxError: Parse error.
+PASS function export(){} threw exception SyntaxError: Parse error.
+PASS (function(){function export(){}}) threw exception SyntaxError: Parse error.
+PASS var extends threw exception SyntaxError: Parse error.
+PASS (function(){var extends}) threw exception SyntaxError: Parse error.
+PASS function g(extends){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(extends){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(extends){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(extends){}}) threw exception SyntaxError: Parse error.
+PASS function extends(){} threw exception SyntaxError: Parse error.
+PASS (function(){function extends(){}}) threw exception SyntaxError: Parse error.
+PASS var import threw exception SyntaxError: Parse error.
+PASS (function(){var import}) threw exception SyntaxError: Parse error.
+PASS function g(import){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(import){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(import){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(import){}}) threw exception SyntaxError: Parse error.
+PASS function import(){} threw exception SyntaxError: Parse error.
+PASS (function(){function import(){}}) threw exception SyntaxError: Parse error.
+PASS var super threw exception SyntaxError: Parse error.
+PASS (function(){var super}) threw exception SyntaxError: Parse error.
+PASS function g(super){} threw exception SyntaxError: Parse error.
+PASS (function(){function g(super){}}) threw exception SyntaxError: Parse error.
+PASS try{}catch(super){} threw exception SyntaxError: Parse error.
+PASS (function(){try{}catch(super){}}) threw exception SyntaxError: Parse error.
+PASS function super(){} threw exception SyntaxError: Parse error.
+PASS (function(){function super(){}}) threw exception SyntaxError: Parse error.
+PASS (obj=({true: true,false: true,null: true,break: true,case: true,catch: true,continue: true,debugger: true,default: true,delete: true,do: true,else: true,finally: true,for: true,function: true,if: true,in: true,instanceof: true,new: true,return: true,switch: true,this: true,throw: true,try: true,typeof: true,var: true,void: true,while: true,with: true,class: true,const: true,enum: true,export: true,extends: true,import: true,super: true, parsed: true })).parsed is true
+PASS ({ true: true}).true is true
+PASS ({ false: true}).false is true
+PASS ({ null: true}).null is true
+PASS ({ break: true}).break is true
+PASS ({ case: true}).case is true
+PASS ({ catch: true}).catch is true
+PASS ({ continue: true}).continue is true
+PASS ({ debugger: true}).debugger is true
+PASS ({ default: true}).default is true
+PASS ({ delete: true}).delete is true
+PASS ({ do: true}).do is true
+PASS ({ else: true}).else is true
+PASS ({ finally: true}).finally is true
+PASS ({ for: true}).for is true
+PASS ({ function: true}).function is true
+PASS ({ if: true}).if is true
+PASS ({ in: true}).in is true
+PASS ({ instanceof: true}).instanceof is true
+PASS ({ new: true}).new is true
+PASS ({ return: true}).return is true
+PASS ({ switch: true}).switch is true
+PASS ({ this: true}).this is true
+PASS ({ throw: true}).throw is true
+PASS ({ try: true}).try is true
+PASS ({ typeof: true}).typeof is true
+PASS ({ var: true}).var is true
+PASS ({ void: true}).void is true
+PASS ({ while: true}).while is true
+PASS ({ with: true}).with is true
+PASS ({ class: true}).class is true
+PASS ({ const: true}).const is true
+PASS ({ enum: true}).enum is true
+PASS ({ export: true}).export is true
+PASS ({ extends: true}).extends is true
+PASS ({ import: true}).import is true
+PASS ({ super: true}).super is true
+PASS ({get true(){},set true(){},get false(){},set false(){},get null(){},set null(){},get break(){},set break(){},get case(){},set case(){},get catch(){},set catch(){},get continue(){},set continue(){},get debugger(){},set debugger(){},get default(){},set default(){},get delete(){},set delete(){},get do(){},set do(){},get else(){},set else(){},get finally(){},set finally(){},get for(){},set for(){},get function(){},set function(){},get if(){},set if(){},get in(){},set in(){},get instanceof(){},set instanceof(){},get new(){},set new(){},get return(){},set return(){},get switch(){},set switch(){},get this(){},set this(){},get throw(){},set throw(){},get try(){},set try(){},get typeof(){},set typeof(){},get var(){},set var(){},get void(){},set void(){},get while(){},set while(){},get with(){},set with(){},get class(){},set class(){},get const(){},set const(){},get enum(){},set enum(){},get export(){},set export(){},get extends(){},set extends(){},get import(){},set import(){},get super(){},set super(){}, parsed: true }).parsed is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/js/reserved-words-as-property.html b/LayoutTests/fast/js/reserved-words-as-property.html
new file mode 100644
index 0000000..995cc8e
--- /dev/null
+++ b/LayoutTests/fast/js/reserved-words-as-property.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/reserved-words-as-property.js"></script>
+<script src="resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/js/script-tests/reserved-words-as-property.js b/LayoutTests/fast/js/script-tests/reserved-words-as-property.js
new file mode 100644
index 0000000..2d9f666
--- /dev/null
+++ b/LayoutTests/fast/js/script-tests/reserved-words-as-property.js
@@ -0,0 +1,38 @@
+description("Tests to ensure that we can use ES reserved words as property names.");
+
+var reservedWords = ["true", "false", "null", "break", "case", "catch", "continue", "debugger", "default", "delete", "do", "else", "finally", "for",
+                     "function", "if", "in", "instanceof", "new", "return", "switch", "this", "throw", "try", "typeof", "var", "void", "while", "with",
+                     "class", "const", "enum", "export", "extends", "import", "super"];
+
+function parseShouldThrow(str) {
+    shouldThrow(str);
+    shouldThrow("(function(){"+str+"})");
+}
+
+for (var i = 0; i < reservedWords.length; i++) {
+    parseShouldThrow("var " + reservedWords[i]);
+    parseShouldThrow("function g(" + reservedWords[i] + "){}");
+    parseShouldThrow("try{}catch(" + reservedWords[i] + "){}");
+    parseShouldThrow("function " + reservedWords[i] + "(){}");
+}
+
+var literal = "({";
+for (var i = 0; i < reservedWords.length; i++)
+    literal += reservedWords[i] + ": true,"; 
+literal += " parsed: true })";
+
+var obj;
+shouldBeTrue("(obj=" + literal + ").parsed");
+for (var i = 0; i < reservedWords.length; i++)
+     shouldBeTrue("({ " + reservedWords[i] + ": true})."+reservedWords[i]);
+
+var accessorLiteral = "({";
+for (var i = 0; i < reservedWords.length; i++) {
+    accessorLiteral += "get " + reservedWords[i] + "(){},";
+    accessorLiteral += "set " + reservedWords[i] + "(){},"; 
+}
+accessorLiteral += " parsed: true })";
+
+shouldBeTrue(accessorLiteral + ".parsed");
+
+var successfullyParsed = true;
diff --git a/LayoutTests/fast/js/sputnik/Conformance/11_Expressions/11.1_Primary_Expressions/11.1.5_Object_Initializer/S11.1.5_A4.1-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/11_Expressions/11.1_Primary_Expressions/11.1.5_Object_Initializer/S11.1.5_A4.1-expected.txt
index 4efbae8..fc6074f 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/11_Expressions/11.1_Primary_Expressions/11.1.5_Object_Initializer/S11.1.5_A4.1-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/11_Expressions/11.1_Primary_Expressions/11.1.5_Object_Initializer/S11.1.5_A4.1-expected.txt
@@ -1,7 +1,6 @@
-CONSOLE MESSAGE: line 77: SyntaxError: Parse error
 S11.1.5_A4.1
 
-PASS Expected parsing failure
+FAIL No error detected
 
 TEST COMPLETE
 
diff --git a/LayoutTests/fast/js/sputnik/Conformance/11_Expressions/11.1_Primary_Expressions/11.1.5_Object_Initializer/S11.1.5_A4.2-expected.txt b/LayoutTests/fast/js/sputnik/Conformance/11_Expressions/11.1_Primary_Expressions/11.1.5_Object_Initializer/S11.1.5_A4.2-expected.txt
index 1e534ea..19520e3 100644
--- a/LayoutTests/fast/js/sputnik/Conformance/11_Expressions/11.1_Primary_Expressions/11.1.5_Object_Initializer/S11.1.5_A4.2-expected.txt
+++ b/LayoutTests/fast/js/sputnik/Conformance/11_Expressions/11.1_Primary_Expressions/11.1.5_Object_Initializer/S11.1.5_A4.2-expected.txt
@@ -1,7 +1,6 @@
-CONSOLE MESSAGE: line 77: SyntaxError: Parse error
 S11.1.5_A4.2
 
-PASS Expected parsing failure
+FAIL No error detected
 
 TEST COMPLETE
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list