зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 586ec2ee45d7 (bug 957513) for breaking the web.
--HG-- extra : rebase_source : 4de52cd93646ca7055ba6683b29d0767efd4a322
This commit is contained in:
Родитель
8cd956ad44
Коммит
b04d83422a
|
@ -105,7 +105,7 @@ function test() {
|
|||
"myVar.prop + 42": 2549
|
||||
}))
|
||||
.then(() => deleteWatchExpression("myVar.prop + 42"))
|
||||
.then(() => testEdit("self", "910", {
|
||||
.then(() => testEdit("self", "0910", {
|
||||
"myVar.prop": 910
|
||||
}))
|
||||
.then(() => deleteLastWatchExpression("myVar.prop"))
|
||||
|
|
|
@ -1360,16 +1360,20 @@ TokenStream::getTokenInternal(Modifier modifier)
|
|||
} else if (JS7_ISDEC(c)) {
|
||||
radix = 8;
|
||||
numStart = userbuf.addressOfNextRawChar() - 1; // one past the '0'
|
||||
|
||||
// Octal integer literals are not permitted in strict mode code.
|
||||
if (!reportStrictModeError(JSMSG_DEPRECATED_OCTAL))
|
||||
goto error;
|
||||
|
||||
while (JS7_ISDEC(c)) {
|
||||
// Even in sloppy mode, 08 or 09 is a syntax error.
|
||||
if (c >= '8') {
|
||||
reportError(JSMSG_BAD_OCTAL, c == '8' ? "8" : "9");
|
||||
// Octal integer literals are not permitted in strict mode code.
|
||||
if (!reportStrictModeError(JSMSG_DEPRECATED_OCTAL))
|
||||
goto error;
|
||||
|
||||
// Outside strict mode, we permit 08 and 09 as decimal numbers,
|
||||
// which makes our behaviour a superset of the ECMA numeric
|
||||
// grammar. We might not always be so permissive, so we warn
|
||||
// about it.
|
||||
if (c >= '8') {
|
||||
if (!reportWarning(JSMSG_BAD_OCTAL, c == '8' ? "08" : "09")) {
|
||||
goto error;
|
||||
}
|
||||
goto decimal; // use the decimal scanner for the rest of the number
|
||||
}
|
||||
c = getCharIgnoreEOL();
|
||||
}
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
load(libdir + 'asserts.js');
|
||||
|
||||
for (var code of ["08", "09", "01238", "01239", "08e+1"]) {
|
||||
assertThrowsInstanceOf(() => Function(code), SyntaxError);
|
||||
assertThrowsInstanceOf(() => eval(code), SyntaxError);
|
||||
}
|
||||
|
||||
var ok = [0.8, 0.08, 0e8, 1e08, 1e+08];
|
|
@ -195,7 +195,7 @@ MSG_DEF(JSMSG_UNTERMINATED_REGEXP, 141, 0, JSEXN_SYNTAXERR, "unterminated reg
|
|||
MSG_DEF(JSMSG_BAD_CLONE_FUNOBJ_SCOPE, 142, 0, JSEXN_TYPEERR, "bad cloned function scope chain")
|
||||
MSG_DEF(JSMSG_MISSING_OCTAL_DIGITS, 143, 0, JSEXN_SYNTAXERR, "missing octal digits after '0o'")
|
||||
MSG_DEF(JSMSG_ILLEGAL_CHARACTER, 144, 0, JSEXN_SYNTAXERR, "illegal character")
|
||||
MSG_DEF(JSMSG_BAD_OCTAL, 145, 1, JSEXN_SYNTAXERR, "numbers starting with 0 followed by a digit are octals and can't contain {0}")
|
||||
MSG_DEF(JSMSG_BAD_OCTAL, 145, 1, JSEXN_SYNTAXERR, "{0} is not a legal ECMA-262 octal constant")
|
||||
MSG_DEF(JSMSG_RESULTING_STRING_TOO_LARGE, 146, 0, JSEXN_RANGEERR, "repeat count must be less than infinity and not overflow maximum string size")
|
||||
MSG_DEF(JSMSG_UNCAUGHT_EXCEPTION, 147, 1, JSEXN_INTERNALERR, "uncaught exception: {0}")
|
||||
MSG_DEF(JSMSG_INVALID_BACKREF, 148, 0, JSEXN_SYNTAXERR, "non-octal digit in an escape sequence that doesn't match a back-reference")
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
|
||||
/**
|
||||
File Name: 7.7.3-2.js
|
||||
ECMA Section: 7.7.3 Numeric Literals
|
||||
|
||||
Description:
|
||||
|
||||
This is a regression test for
|
||||
http://scopus.mcom.com/bugsplat/show_bug.cgi?id=122884
|
||||
|
||||
Waldemar's comments:
|
||||
|
||||
A numeric literal that starts with either '08' or '09' is interpreted as a
|
||||
decimal literal; it should be an error instead. (Strictly speaking, according
|
||||
to ECMA v1 such literals should be interpreted as two integers -- a zero
|
||||
followed by a decimal number whose first digit is 8 or 9, but this is a bug in
|
||||
ECMA that will be fixed in v2. In any case, there is no place in the grammar
|
||||
where two consecutive numbers would be legal.)
|
||||
|
||||
Author: christine@netscape.com
|
||||
Date: 15 june 1998
|
||||
|
||||
*/
|
||||
var SECTION = "7.7.3-2";
|
||||
var VERSION = "ECMA_1";
|
||||
var TITLE = "Numeric Literals";
|
||||
var BUGNUMBER="122884";
|
||||
|
||||
startTest();
|
||||
|
||||
writeHeaderToLog( SECTION + " "+ TITLE);
|
||||
|
||||
new TestCase( SECTION,
|
||||
"9",
|
||||
9,
|
||||
9 );
|
||||
|
||||
new TestCase( SECTION,
|
||||
"09",
|
||||
9,
|
||||
09 );
|
||||
|
||||
new TestCase( SECTION,
|
||||
"099",
|
||||
99,
|
||||
099 );
|
||||
|
||||
|
||||
new TestCase( SECTION,
|
||||
"077",
|
||||
63,
|
||||
077 );
|
||||
|
||||
test();
|
|
@ -9,6 +9,17 @@
|
|||
*
|
||||
*SUMMARY: Testing numeric literals that begin with 0.
|
||||
*This test arose from Bugzilla bug 49233.
|
||||
*The best explanation is from jsscan.c:
|
||||
*
|
||||
* "We permit 08 and 09 as decimal numbers, which makes
|
||||
* our behaviour a superset of the ECMA numeric grammar.
|
||||
* We might not always be so permissive, so we warn about it."
|
||||
*
|
||||
*Thus an expression 010 will evaluate, as always, as an octal (to 8).
|
||||
*However, 018 will evaluate as a decimal, to 18. Even though the
|
||||
*user began the expression as an octal, he later used a non-octal
|
||||
*digit. We forgive this and assume he intended a decimal. If the
|
||||
*JavaScript "strict" option is set though, we will give a warning.
|
||||
*/
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
@ -29,6 +40,14 @@ var expect = new Array();
|
|||
actual[1]=07
|
||||
expect[1]=7
|
||||
|
||||
asString[2]='08'
|
||||
actual[2]=08
|
||||
expect[2]=8
|
||||
|
||||
asString[3]='09'
|
||||
actual[3]=09
|
||||
expect[3]=9
|
||||
|
||||
asString[4]='010'
|
||||
actual[4]=010
|
||||
expect[4]=8
|
||||
|
@ -37,22 +56,71 @@ var expect = new Array();
|
|||
actual[5]=017
|
||||
expect[5]=15
|
||||
|
||||
asString[6]='018'
|
||||
actual[6]=018
|
||||
expect[6]=18
|
||||
|
||||
asString[7]='019'
|
||||
actual[7]=019
|
||||
expect[7]=19
|
||||
|
||||
asString[8]='079'
|
||||
actual[8]=079
|
||||
expect[8]=79
|
||||
|
||||
asString[9]='0079'
|
||||
actual[9]=0079
|
||||
expect[9]=79
|
||||
|
||||
asString[10]='099'
|
||||
actual[10]=099
|
||||
expect[10]=99
|
||||
|
||||
asString[11]='0099'
|
||||
actual[11]=0099
|
||||
expect[11]=99
|
||||
|
||||
asString[12]='000000000077'
|
||||
actual[12]=000000000077
|
||||
expect[12]=63
|
||||
|
||||
asString[13]='000000000078'
|
||||
actual[13]=000000000078
|
||||
expect[13]=78
|
||||
|
||||
asString[14]='0000000000770000'
|
||||
actual[14]=0000000000770000
|
||||
expect[14]=258048
|
||||
|
||||
asString[15]='0000000000780000'
|
||||
actual[15]=0000000000780000
|
||||
expect[15]=780000
|
||||
|
||||
asString[16]='0765432198'
|
||||
actual[16]=0765432198
|
||||
expect[16]=765432198
|
||||
|
||||
asString[17]='00076543219800'
|
||||
actual[17]=00076543219800
|
||||
expect[17]=76543219800
|
||||
|
||||
asString[18]='0000001001007'
|
||||
actual[18]=0000001001007
|
||||
expect[18]=262663
|
||||
|
||||
asString[19]='0000001001009'
|
||||
actual[19]=0000001001009
|
||||
expect[19]=1001009
|
||||
|
||||
asString[20]='070'
|
||||
actual[20]=070
|
||||
expect[20]=56
|
||||
|
||||
asString[21]='080'
|
||||
actual[21]=080
|
||||
expect[21]=80
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
test();
|
||||
|
|
Загрузка…
Ссылка в новой задаче