Changeset 108742 in webkit


Ignore:
Timestamp:
Feb 24, 2012 12:20:51 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

\u200c and \u200d should be allowed in IdentifierPart, as per ES5
https://bugs.webkit.org/show_bug.cgi?id=78908

Source/JavaScriptCore:

Add additional checks for zero-width non-joiner (0x200C) and
zero-width joiner (0x200D) characters.

Patch by Mathias Bynens <mathias@qiwi.be> on 2012-02-24
Reviewed by Michael Saboff.

  • parser/Lexer.cpp:

(JSC::isNonASCIIIdentPart)

  • runtime/LiteralParser.cpp:

(JSC::::Lexer::lexIdentifier)

LayoutTests:

Patch by Mathias Bynens <mathias@qiwi.be> on 2012-02-24
Reviewed by Michael Saboff.

  • fast/js/var-declarations-zero-width-expected.txt: Added.
  • fast/js/var-declarations-zero-width.html: Added.
  • fast/js/removing-Cf-characters-expected.txt: Removed the ZWJ test.
  • fast/js/script-tests/removing-Cf-characters.js: Removed the ZWJ test.
  • fast/js/script-tests/var-declarations-zero-width.js: Added.
  • platform/chromium/test_expectations.txt: Disable the new test in Chromium, for now.
Location:
trunk
Files:
3 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r108741 r108742  
     12012-02-24  Mathias Bynens  <mathias@qiwi.be>
     2
     3        `\u200c` and `\u200d` should be allowed in IdentifierPart, as per ES5
     4        https://bugs.webkit.org/show_bug.cgi?id=78908
     5
     6        Reviewed by Michael Saboff.
     7
     8        * fast/js/var-declarations-zero-width-expected.txt: Added.
     9        * fast/js/var-declarations-zero-width.html: Added.
     10        * fast/js/removing-Cf-characters-expected.txt: Removed the ZWJ test.
     11        * fast/js/script-tests/removing-Cf-characters.js: Removed the ZWJ test.
     12        * fast/js/script-tests/var-declarations-zero-width.js: Added.
     13        * platform/chromium/test_expectations.txt: Disable the new test in Chromium, for now.
     14
    1152012-02-24  Yuzo Fujishima  <yuzo@google.com>
    216
  • trunk/LayoutTests/fast/js/removing-Cf-characters-expected.txt

    r90265 r108742  
    1010PASS eval('""').charCodeAt(0) is 0xFEFF
    1111PASS ++1 /* BOM between the +'s */ is 1
    12 PASS var ZWJ_I‍nside; threw exception SyntaxError: Invalid character '\u8205'.
    1312PASS successfullyParsed is true
    1413
  • trunk/LayoutTests/fast/js/script-tests/removing-Cf-characters.js

    r98407 r108742  
    2626shouldBe('+'+eval("\"\uFEFF\"")+'+1 /* BOM between the +\'s */', '1');
    2727
    28 shouldThrow('var ZWJ_I‍nside;');
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r108741 r108742  
    909909// what the resolution was.
    910910BUGCR10279 : fast/js/var-declarations-shadowing.html = FAIL
     911
     912// FIXME: Enable this test when V8 r10800 has rolled into WebKit.
     913BUGWK79361 : fast/js/var-declarations-zero-width.html = FAIL
    911914
    912915// Implement full JSON support in V8
  • trunk/Source/JavaScriptCore/ChangeLog

    r108731 r108742  
     12012-02-24  Mathias Bynens  <mathias@qiwi.be>
     2
     3        `\u200c` and `\u200d` should be allowed in IdentifierPart, as per ES5
     4        https://bugs.webkit.org/show_bug.cgi?id=78908
     5
     6        Add additional checks for zero-width non-joiner (0x200C) and
     7        zero-width joiner (0x200D) characters.
     8
     9        Reviewed by Michael Saboff.
     10
     11        * parser/Lexer.cpp:
     12        (JSC::isNonASCIIIdentPart)
     13        * runtime/LiteralParser.cpp:
     14        (JSC::::Lexer::lexIdentifier)
     15
    1162012-02-23  Kenichi Ishibashi  <bashi@chromium.org>
    217
  • trunk/Source/JavaScriptCore/parser/Lexer.cpp

    r107625 r108742  
    44 *  Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca)
    55 *  Copyright (C) 2010 Zoltan Herczeg (zherczeg@inf.u-szeged.hu)
     6 *  Copyright (C) 2012 Mathias Bynens (mathias@qiwi.be)
    67 *
    78 *  This library is free software; you can redistribute it and/or
     
    380381static NEVER_INLINE bool isNonASCIIIdentPart(int c)
    381382{
    382     return category(c) & (Letter_Uppercase | Letter_Lowercase | Letter_Titlecase | Letter_Modifier | Letter_Other
    383         | Mark_NonSpacing | Mark_SpacingCombining | Number_DecimalDigit | Punctuation_Connector);
     383    return (category(c) & (Letter_Uppercase | Letter_Lowercase | Letter_Titlecase | Letter_Modifier | Letter_Other
     384        | Mark_NonSpacing | Mark_SpacingCombining | Number_DecimalDigit | Punctuation_Connector)) || c == 0x200C || c == 0x200D;
    384385}
    385386
  • trunk/Source/JavaScriptCore/runtime/LiteralParser.cpp

    r107625 r108742  
    11/*
    22 * Copyright (C) 2009 Apple Inc. All rights reserved.
     3 * Copyright (C) 2012 Mathias Bynens (mathias@qiwi.be)
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    295296ALWAYS_INLINE TokenType LiteralParser<UChar>::Lexer::lexIdentifier(LiteralParserToken<UChar>& token)
    296297{
    297     while (m_ptr < m_end && (isASCIIAlphanumeric(*m_ptr) || *m_ptr == '_' || *m_ptr == '$'))
     298    while (m_ptr < m_end && (isASCIIAlphanumeric(*m_ptr) || *m_ptr == '_' || *m_ptr == '$' || *m_ptr == 0x200C || *m_ptr == 0x200D))
    298299        m_ptr++;
    299300    token.stringIs8Bit = 0;
Note: See TracChangeset for help on using the changeset viewer.