[parser] Treat \ufffe as non-whitespace.
R=marja@chromium.org Bug: chromium:726625 Change-Id: I3f451a47b5a60a4c367d04a5466acd9e2f90df14 Reviewed-on: https://chromium-review.googlesource.com/530849 Reviewed-by: Marja Hölttä <marja@chromium.org> Commit-Queue: Daniel Vogelheim <vogelheim@chromium.org> Cr-Commit-Position: refs/heads/master@{#46063}
This commit is contained in:
parent
ebc76f64c5
commit
79324c4de6
@ -429,18 +429,6 @@ Token::Value Scanner::PeekAhead() {
|
||||
}
|
||||
|
||||
|
||||
// TODO(yangguo): check whether this is actually necessary.
|
||||
static inline bool IsLittleEndianByteOrderMark(uc32 c) {
|
||||
// The Unicode value U+FFFE is guaranteed never to be assigned as a
|
||||
// Unicode character; this implies that in a Unicode context the
|
||||
// 0xFF, 0xFE byte pattern can only be interpreted as the U+FEFF
|
||||
// character expressed in little-endian byte order (since it could
|
||||
// not be a U+FFFE character expressed in big-endian byte
|
||||
// order). Nevertheless, we check for it to be compatible with
|
||||
// Spidermonkey.
|
||||
return c == 0xFFFE;
|
||||
}
|
||||
|
||||
Token::Value Scanner::SkipWhiteSpace() {
|
||||
int start_position = source_pos();
|
||||
|
||||
@ -453,8 +441,7 @@ Token::Value Scanner::SkipWhiteSpace() {
|
||||
// Remember if the latter is the case.
|
||||
if (unicode_cache_->IsLineTerminator(c0_)) {
|
||||
has_line_terminator_before_next_ = true;
|
||||
} else if (!unicode_cache_->IsWhiteSpace(c0_) &&
|
||||
!IsLittleEndianByteOrderMark(c0_)) {
|
||||
} else if (!unicode_cache_->IsWhiteSpace(c0_)) {
|
||||
break;
|
||||
}
|
||||
Advance();
|
||||
|
6
test/mjsunit/regress/regress-726625.js
Normal file
6
test/mjsunit/regress/regress-726625.js
Normal file
@ -0,0 +1,6 @@
|
||||
// Copyright 2017 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
function abc() { return; }
|
||||
assertThrows("abc" + String.fromCharCode(65534) + "(1)");
|
@ -115,6 +115,9 @@
|
||||
# Function declarations are no longer allowed as the body of a with statement.
|
||||
'js1_5/Regress/regress-326453': [FAIL],
|
||||
|
||||
# Invalid according to ES2015 syntax. (Details: crbug.com/726625)
|
||||
'ecma_3/extensions/regress-368516': [FAIL],
|
||||
|
||||
##################### SKIPPED TESTS #####################
|
||||
|
||||
# This test checks that we behave properly in an out-of-memory
|
||||
|
Loading…
Reference in New Issue
Block a user