Changeset 89100 in webkit


Ignore:
Timestamp:
Jun 16, 2011 6:47:25 PM (13 years ago)
Author:
barraclough@apple.com
Message:

https://bugs.webkit.org/show_bug.cgi?id=23611
Multiline Javascript comments cause incorrect parsing of following script.

Reviewed by Oliver Hunt.

From the spec:
"A MultiLineComment [is] simply discarded if it contains no line terminator,
but if a MultiLineComment contains one or more line terminators, then it is
replaced with a single line terminator, which becomes part of the stream of
inputs for the syntactic grammar."

This may result in behavioural changes, due to automatic semicolon insertion.

Source/JavaScriptCore:

  • parser/Lexer.cpp:

(JSC::Lexer::parseMultilineComment):

  • Set m_terminator is we see a line terminator in a multiline comment.

LayoutTests:

  • fast/js/multiline-comment-newline-expected.txt: Added.
  • fast/js/multiline-comment-newline.html: Added.
  • fast/js/script-tests/multiline-comment-newline.js: Added.

(shouldBeUndefined):

Location:
trunk
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r89099 r89100  
     12011-06-16  Gavin Barraclough  <barraclough@apple.com>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=23611
     6        Multiline Javascript comments cause incorrect parsing of following script.
     7
     8        From the spec:
     9        "A MultiLineComment [is] simply discarded if it contains no line terminator,
     10        but if a MultiLineComment contains one or more line terminators, then it is
     11        replaced with a single line terminator, which becomes part of the stream of
     12        inputs for the syntactic grammar."
     13
     14        This may result in behavioural changes, due to automatic semicolon insertion.
     15
     16        * fast/js/multiline-comment-newline-expected.txt: Added.
     17        * fast/js/multiline-comment-newline.html: Added.
     18        * fast/js/script-tests/multiline-comment-newline.js: Added.
     19        (shouldBeUndefined):
     20
    1212011-06-16  Ryosuke Niwa  <rniwa@webkit.org>
    222
  • trunk/Source/JavaScriptCore/ChangeLog

    r89084 r89100  
     12011-06-16  Gavin Barraclough  <barraclough@apple.com>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=23611
     6        Multiline Javascript comments cause incorrect parsing of following script.
     7
     8        From the spec:
     9        "A MultiLineComment [is] simply discarded if it contains no line terminator,
     10        but if a MultiLineComment contains one or more line terminators, then it is
     11        replaced with a single line terminator, which becomes part of the stream of
     12        inputs for the syntactic grammar."
     13
     14        This may result in behavioural changes, due to automatic semicolon insertion.
     15
     16        * parser/Lexer.cpp:
     17        (JSC::Lexer::parseMultilineComment):
     18            - Set m_terminator is we see a line terminator in a multiline comment.
     19
    1202011-06-16  Gavin Barraclough  <barraclough@apple.com>
    221
  • trunk/Source/JavaScriptCore/parser/Lexer.cpp

    r88724 r89100  
    737737            return false;
    738738
    739         if (isLineTerminator(m_current))
     739        if (isLineTerminator(m_current)) {
    740740            shiftLineTerminator();
    741         else
     741            m_terminator = true;
     742        } else
    742743            shift();
    743744    }
Note: See TracChangeset for help on using the changeset viewer.