mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-13 03:24:26 +00:00
Back out bc75fd3095eb (bug 907958), the simple rebasing through bug 666399 is busted. Probably a simple-ish fix, not gonna try it on a deadline, tho. r=beep-beep-beep from a CLOSED TREE
This commit is contained in:
parent
caecd047a6
commit
234e8e440a
@ -2446,7 +2446,7 @@ Parser<ParseHandler>::functionStmt()
|
||||
|
||||
RootedPropertyName name(context);
|
||||
GeneratorKind generatorKind = NotGenerator;
|
||||
TokenKind tt = tokenStream.getToken();
|
||||
TokenKind tt = tokenStream.getToken(TokenStream::KeywordIsName);
|
||||
|
||||
if (tt == TOK_MUL) {
|
||||
tokenStream.tell(&start);
|
||||
@ -2481,7 +2481,7 @@ Parser<ParseHandler>::functionExpr()
|
||||
|
||||
RootedPropertyName name(context);
|
||||
GeneratorKind generatorKind = NotGenerator;
|
||||
TokenKind tt = tokenStream.getToken();
|
||||
TokenKind tt = tokenStream.getToken(TokenStream::KeywordIsName);
|
||||
|
||||
if (tt == TOK_MUL) {
|
||||
tokenStream.tell(&start);
|
||||
|
@ -4588,7 +4588,7 @@ ParseFunction(ModuleCompiler &m, ParseNode **fnOut)
|
||||
DebugOnly<TokenKind> tk = tokenStream.getToken();
|
||||
JS_ASSERT(tk == TOK_FUNCTION);
|
||||
|
||||
if (tokenStream.getToken() != TOK_NAME)
|
||||
if (tokenStream.getToken(TokenStream::KeywordIsName) != TOK_NAME)
|
||||
return false; // This will throw a SyntaxError, no need to m.fail.
|
||||
|
||||
RootedPropertyName name(m.cx(), tokenStream.currentToken().name());
|
||||
|
@ -37,7 +37,7 @@ var strictFutureReservedWords =
|
||||
"yield", // enabled: this file doesn't execute as JS1.7
|
||||
];
|
||||
|
||||
function testWord(word, expectNormal, expectStrict)
|
||||
function testWord(word, wordKind, expectNormal, expectStrict)
|
||||
{
|
||||
var actual, status;
|
||||
|
||||
@ -355,19 +355,22 @@ function testWord(word, expectNormal, expectStrict)
|
||||
|
||||
// USE AS FUNCTION NAME IN FUNCTION DECLARATION
|
||||
|
||||
actual = "";
|
||||
status = summary + ": " + word + ": normal function name";
|
||||
try
|
||||
if (wordKind !== "reserved")
|
||||
{
|
||||
eval("function " + word + "() { }");
|
||||
actual = "no error";
|
||||
actual = "";
|
||||
status = summary + ": " + word + ": normal function name";
|
||||
try
|
||||
{
|
||||
eval("function " + word + "() { }");
|
||||
actual = "no error";
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
actual = e.name;
|
||||
status += ", " + e.name + ": " + e.message + " ";
|
||||
}
|
||||
reportCompare(expectNormal, actual, status);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
actual = e.name;
|
||||
status += ", " + e.name + ": " + e.message + " ";
|
||||
}
|
||||
reportCompare(expectNormal, actual, status);
|
||||
|
||||
actual = "";
|
||||
status = summary + ": " + word + ": strict function name";
|
||||
@ -399,19 +402,22 @@ function testWord(word, expectNormal, expectStrict)
|
||||
|
||||
// USE AS FUNCTION NAME IN FUNCTION EXPRESSION
|
||||
|
||||
actual = "";
|
||||
status = summary + ": " + word + ": normal function expression name";
|
||||
try
|
||||
if (wordKind !== "reserved")
|
||||
{
|
||||
eval("var s = (function " + word + "() { });");
|
||||
actual = "no error";
|
||||
actual = "";
|
||||
status = summary + ": " + word + ": normal function expression name";
|
||||
try
|
||||
{
|
||||
eval("var s = (function " + word + "() { });");
|
||||
actual = "no error";
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
actual = e.name;
|
||||
status += ", " + e.name + ": " + e.message + " ";
|
||||
}
|
||||
reportCompare(expectNormal, actual, status);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
actual = e.name;
|
||||
status += ", " + e.name + ": " + e.message + " ";
|
||||
}
|
||||
reportCompare(expectNormal, actual, status);
|
||||
|
||||
actual = "";
|
||||
status = summary + ": " + word + ": strict function expression name";
|
||||
@ -444,12 +450,12 @@ function testWord(word, expectNormal, expectStrict)
|
||||
|
||||
function testFutureReservedWord(word)
|
||||
{
|
||||
testWord(word, "SyntaxError", "SyntaxError");
|
||||
testWord(word, "reserved", "SyntaxError", "SyntaxError");
|
||||
}
|
||||
|
||||
function testStrictFutureReservedWord(word)
|
||||
{
|
||||
testWord(word, "no error", "SyntaxError");
|
||||
testWord(word, "strict reserved", "no error", "SyntaxError");
|
||||
}
|
||||
|
||||
futureReservedWords.forEach(testFutureReservedWord);
|
||||
|
49
js/src/tests/js1_5/LexicalConventions/regress-343675.js
Normal file
49
js/src/tests/js1_5/LexicalConventions/regress-343675.js
Normal file
@ -0,0 +1,49 @@
|
||||
/* -*- 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/. */
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
var BUGNUMBER = 343675;
|
||||
var summary = 'Allow keywords, reserved words as function names';
|
||||
var actual = '';
|
||||
var expect = 'No Error';
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
test();
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
function test()
|
||||
{
|
||||
enterFunc ('test');
|
||||
printBugNumber(BUGNUMBER);
|
||||
printStatus (summary);
|
||||
|
||||
var words = [
|
||||
'break', 'else', 'new', 'var', 'case', 'finally', 'return', 'void',
|
||||
'catch', 'for', 'switch', 'while', 'continue', 'function', 'this',
|
||||
'with', 'default', 'if', 'throw', 'delete', 'in', 'try', 'do',
|
||||
'instanceof', 'typeof',
|
||||
'abstract', 'enum', 'int', 'short', 'boolean', 'export', 'interface',
|
||||
'static', 'byte', 'extends', 'long', 'super', 'char', 'final', 'native',
|
||||
'synchronized', 'class', 'float', 'package', 'throws', 'const', 'goto',
|
||||
'private', 'transient', 'debugger', 'implements', 'protected', 'volatile',
|
||||
'double', 'import', 'public'];
|
||||
|
||||
for (var i = 0; i < words.length; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
actual = 'No Error';
|
||||
eval('function ' + words[i] + '() {}');
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
actual = ex + '';
|
||||
}
|
||||
reportCompare(expect, actual, summary + ': ' + words[i]);
|
||||
}
|
||||
|
||||
exitFunc ('test');
|
||||
}
|
@ -93,5 +93,17 @@ function test()
|
||||
}
|
||||
reportCompare(expect, actual, summary + ': function () { var let;}');
|
||||
|
||||
try
|
||||
{
|
||||
expect = 'No Error';
|
||||
function yield() {}
|
||||
actual = 'No Error';
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
actual = ex + '';
|
||||
}
|
||||
reportCompare(expect, actual, summary + ': function yield()');
|
||||
|
||||
exitFunc ('test');
|
||||
}
|
||||
|
@ -36,7 +36,11 @@ function test()
|
||||
|
||||
// Assertion failure: !pn->isPlaceholder(), at ../jsparse.cpp:4876
|
||||
// =====
|
||||
(function(){ var x; eval("var x; x = null"); })();
|
||||
(function(){ var x; eval("var x; x = null"); })()
|
||||
|
||||
// Assertion failure: regs.sp == StackBase(fp), at ../jsinterp.cpp:2984
|
||||
// =====
|
||||
function this ({x}) { function x(){} }
|
||||
|
||||
// Assertion failure: !(pnu->pn_dflags & PND_BOUND), at ../jsemit.cpp:1818
|
||||
// =====
|
||||
|
@ -111,7 +111,7 @@ ServerBSO.prototype = {
|
||||
return obj;
|
||||
},
|
||||
|
||||
delete: function delete_() {
|
||||
delete: function delete() {
|
||||
this.deleted = true;
|
||||
|
||||
delete this.payload;
|
||||
@ -571,7 +571,7 @@ StorageServerCollection.prototype = {
|
||||
return {success: success, failed: failed};
|
||||
},
|
||||
|
||||
delete: function delete_(options) {
|
||||
delete: function delete(options) {
|
||||
options = options || {};
|
||||
|
||||
// Protocol 2.0 only allows the "ids" query string argument.
|
||||
|
Loading…
x
Reference in New Issue
Block a user