Bug 497869 - Future reserved words are syntax errors in strict mode. r=brendan

This commit is contained in:
Jeff Walden 2011-01-22 17:46:22 -08:00
Родитель 47901214ce
Коммит ccaa2e2118
33 изменённых файлов: 225 добавлений и 191 удалений

Просмотреть файл

@ -880,9 +880,9 @@ var gSyncSetup = {
// if no property string is passed in, we clear label/style
_setFeedback: function (element, success, string) {
element.hidden = success || !string;
let class = success ? "success" : "error";
let classname = success ? "success" : "error";
let image = element.getElementsByAttribute("class", "statusIcon")[0];
image.setAttribute("status", class);
image.setAttribute("status", classname);
let label = element.getElementsByAttribute("class", "status")[0];
label.value = string;
},

Просмотреть файл

@ -146,9 +146,9 @@ BrowserGlue.prototype = {
// delays are in seconds
const MAX_DELAY = 300;
let delay = 3;
let enum = Services.wm.getEnumerator("navigator:browser");
while (enum.hasMoreElements()) {
delay += enum.getNext().gBrowser.tabs.length;
let browserEnum = Services.wm.getEnumerator("navigator:browser");
while (browserEnum.hasMoreElements()) {
delay += browserEnum.getNext().gBrowser.tabs.length;
}
delay = delay <= MAX_DELAY ? delay : MAX_DELAY;

Просмотреть файл

@ -703,10 +703,10 @@ Application.prototype = {
get windows() {
var win = [];
var enum = Utilities.windowMediator.getEnumerator("navigator:browser");
var browserEnum = Utilities.windowMediator.getEnumerator("navigator:browser");
while (enum.hasMoreElements())
win.push(new Window(enum.getNext()));
while (browserEnum.hasMoreElements())
win.push(new Window(browserEnum.getNext()));
return win;
},

Просмотреть файл

@ -21,8 +21,8 @@
<script type="application/javascript">
<![CDATA[
var imports = [ "SimpleTest", "is", "isnot", "ok" ];
for each (var import in imports) {
window[import] = window.opener.wrappedJSObject[import];
for each (var name in imports) {
window[name] = window.opener.wrappedJSObject[name];
}
function testStatics() {

Просмотреть файл

@ -15,8 +15,8 @@
<script type="application/javascript"><![CDATA[
var imports = [ "SimpleTest", "is", "isnot", "ok", "snapshotWindow",
"compareSnapshots", "onerror" ];
for each (var import in imports) {
window[import] = window.opener.wrappedJSObject[import];
for each (var name in imports) {
window[name] = window.opener.wrappedJSObject[name];
}
function $(id) {

Просмотреть файл

@ -47,8 +47,8 @@
<script type="application/javascript"><![CDATA[
var imports = [ "SimpleTest", "is", "isnot", "ok"];
for each (var import in imports) {
window[import] = window.opener.wrappedJSObject[import];
for each (var name in imports) {
window[name] = window.opener.wrappedJSObject[name];
}
const text="MOZILLA";

Просмотреть файл

@ -9,8 +9,8 @@
<!-- test code goes here -->
<script type="application/javascript"><![CDATA[
var imports = [ "SimpleTest", "is", "isnot", "ok", "onerror" ];
for each (var import in imports) {
window[import] = window.opener.wrappedJSObject[import];
for each (var name in imports) {
window[name] = window.opener.wrappedJSObject[name];
}
function $(id) {

Просмотреть файл

@ -9,8 +9,8 @@
<!-- test code goes here -->
<script type="application/javascript"><![CDATA[
var imports = [ "SimpleTest", "is", "isnot", "ok", "onerror" ];
for each (var import in imports) {
window[import] = window.opener.wrappedJSObject[import];
for each (var name in imports) {
window[name] = window.opener.wrappedJSObject[name];
}
function $(id) {

Просмотреть файл

@ -3,8 +3,8 @@
*/
var imports = [ "SimpleTest", "is", "isnot", "ok", "onerror", "todo",
"todo_is", "todo_isnot" ];
for each (var import in imports) {
window[import] = window.opener.wrappedJSObject[import];
for each (var name in imports) {
window[name] = window.opener.wrappedJSObject[name];
}
/**

Просмотреть файл

@ -7090,12 +7090,10 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
return JS_FALSE;
break;
#if JS_HAS_DEBUGGER_KEYWORD
case TOK_DEBUGGER:
if (js_Emit1(cx, cg, JSOP_DEBUGGER) < 0)
return JS_FALSE;
break;
#endif /* JS_HAS_DEBUGGER_KEYWORD */
#if JS_HAS_XML_SUPPORT
case TOK_XMLELEM:

Просмотреть файл

@ -6259,7 +6259,6 @@ BEGIN_CASE(JSOP_INSTANCEOF)
}
END_CASE(JSOP_INSTANCEOF)
#if JS_HAS_DEBUGGER_KEYWORD
BEGIN_CASE(JSOP_DEBUGGER)
{
JSDebuggerHandler handler = cx->debugHooks->debuggerHandler;
@ -6283,7 +6282,6 @@ BEGIN_CASE(JSOP_DEBUGGER)
}
}
END_CASE(JSOP_DEBUGGER)
#endif /* JS_HAS_DEBUGGER_KEYWORD */
#if JS_HAS_XML_SUPPORT
BEGIN_CASE(JSOP_DEFXMLNS)

Просмотреть файл

@ -38,87 +38,75 @@
*
* ***** END LICENSE BLOCK ***** */
/*
* Keywords used as primary expressions, sharing the TOK_PRIMARY token kind,
* distinguished by opcode.
*/
JS_KEYWORD(false, TOK_PRIMARY, JSOP_FALSE, JSVERSION_DEFAULT)
JS_KEYWORD(true, TOK_PRIMARY, JSOP_TRUE, JSVERSION_DEFAULT)
JS_KEYWORD(null, TOK_PRIMARY, JSOP_NULL, JSVERSION_DEFAULT)
/* ES5 Keywords. */
JS_KEYWORD(break, TOK_BREAK, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(case, TOK_CASE, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(catch, TOK_CATCH, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(continue, TOK_CONTINUE, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(debugger, TOK_DEBUGGER, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(default, TOK_DEFAULT, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(delete, TOK_DELETE, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(do, TOK_DO, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(else, TOK_ELSE, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(export, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(false, TOK_PRIMARY, JSOP_FALSE, JSVERSION_DEFAULT)
JS_KEYWORD(finally, TOK_FINALLY, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(for, TOK_FOR, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(function, TOK_FUNCTION, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(if, TOK_IF, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(in, TOK_IN, JSOP_IN, JSVERSION_DEFAULT)
JS_KEYWORD(instanceof, TOK_INSTANCEOF, JSOP_INSTANCEOF,JSVERSION_DEFAULT)
JS_KEYWORD(new, TOK_NEW, JSOP_NEW, JSVERSION_DEFAULT)
JS_KEYWORD(null, TOK_PRIMARY, JSOP_NULL, JSVERSION_DEFAULT)
JS_KEYWORD(return, TOK_RETURN, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(switch, TOK_SWITCH, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(this, TOK_PRIMARY, JSOP_THIS, JSVERSION_DEFAULT)
JS_KEYWORD(true, TOK_PRIMARY, JSOP_TRUE, JSVERSION_DEFAULT)
JS_KEYWORD(throw, TOK_THROW, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(try, TOK_TRY, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(typeof, TOK_UNARYOP, JSOP_TYPEOF, JSVERSION_DEFAULT)
JS_KEYWORD(var, TOK_VAR, JSOP_DEFVAR, JSVERSION_DEFAULT)
JS_KEYWORD(void, TOK_UNARYOP, JSOP_VOID, JSVERSION_DEFAULT)
JS_KEYWORD(while, TOK_WHILE, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(with, TOK_WITH, JSOP_NOP, JSVERSION_DEFAULT)
/* ES5 FutureReservedWord keywords. */
JS_KEYWORD(class, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(enum, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(export, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(extends, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(import, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(super, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
/*
* ES5 reserved keywords with long-implemented behavior, allowed in our
* implementation to ease code migration.
*/
#if JS_HAS_CONST
JS_KEYWORD(const, TOK_VAR, JSOP_DEFCONST, JSVERSION_DEFAULT)
#else
JS_KEYWORD(const, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
#endif
JS_KEYWORD(try, TOK_TRY, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(catch, TOK_CATCH, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(finally, TOK_FINALLY, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(throw, TOK_THROW, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(instanceof, TOK_INSTANCEOF, JSOP_INSTANCEOF,JSVERSION_DEFAULT)
#if JS_HAS_RESERVED_JAVA_KEYWORDS
JS_KEYWORD(abstract, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(boolean, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(byte, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(char, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(class, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(double, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(extends, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(final, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(float, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(goto, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(implements, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(import, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(int, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(interface, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(long, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(native, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(package, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(private, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(protected, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(public, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(short, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(static, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(super, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(synchronized,TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(throws, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(transient, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(volatile, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
#endif
#if JS_HAS_RESERVED_ECMA_KEYWORDS
JS_KEYWORD(enum, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
#endif
#if JS_HAS_DEBUGGER_KEYWORD
JS_KEYWORD(debugger, TOK_DEBUGGER, JSOP_NOP, JSVERSION_DEFAULT)
#elif JS_HAS_RESERVED_ECMA_KEYWORDS
JS_KEYWORD(debugger, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
#endif
#if JS_HAS_GENERATORS
JS_KEYWORD(yield, TOK_YIELD, JSOP_NOP, JSVERSION_1_7)
#endif
#if JS_HAS_BLOCK_SCOPE
JS_KEYWORD(let, TOK_LET, JSOP_NOP, JSVERSION_1_7)
JS_KEYWORD(let, TOK_LET, JSOP_NOP, JSVERSION_1_7)
#else
JS_KEYWORD(let, TOK_STRICT_RESERVED, JSOP_NOP, JSVERSION_1_7)
#endif
#if JS_HAS_GENERATORS
JS_KEYWORD(yield, TOK_YIELD, JSOP_NOP, JSVERSION_1_7)
#else
JS_KEYWORD(yield, TOK_STRICT_RESERVED, JSOP_NOP, JSVERSION_1_7)
#endif
/* ES5 future reserved keywords in strict mode. */
JS_KEYWORD(implements, TOK_STRICT_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(interface, TOK_STRICT_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(package, TOK_STRICT_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(private, TOK_STRICT_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(protected, TOK_STRICT_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(public, TOK_STRICT_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(static, TOK_STRICT_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)

Просмотреть файл

@ -4613,12 +4613,10 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb, JSOp nextop)
break;
#endif /* JS_HAS_SHARP_VARS */
#if JS_HAS_DEBUGGER_KEYWORD
case JSOP_DEBUGGER:
js_printf(jp, "\tdebugger;\n");
todo = -2;
break;
#endif /* JS_HAS_DEBUGGER_KEYWORD */
#if JS_HAS_XML_SUPPORT
case JSOP_STARTXML:

Просмотреть файл

@ -6203,7 +6203,6 @@ Parser::statement()
pn->pn_type = TOK_SEMI;
return pn;
#if JS_HAS_DEBUGGER_KEYWORD
case TOK_DEBUGGER:
pn = NullaryNode::create(tc);
if (!pn)
@ -6211,7 +6210,6 @@ Parser::statement()
pn->pn_type = TOK_DEBUGGER;
tc->flags |= TCF_FUN_HEAVYWEIGHT;
break;
#endif /* JS_HAS_DEBUGGER_KEYWORD */
#if JS_HAS_XML_SUPPORT
case TOK_DEFAULT:

Просмотреть файл

@ -1043,10 +1043,18 @@ TokenStream::getTokenInternal()
!(flags & TSF_KEYWORD_IS_NAME) &&
(kw = FindKeyword(tokenbuf.begin(), tokenbuf.length()))) {
if (kw->tokentype == TOK_RESERVED) {
if (!ReportCompileErrorNumber(cx, this, NULL, JSREPORT_WARNING | JSREPORT_STRICT,
if (!ReportCompileErrorNumber(cx, this, NULL, JSREPORT_ERROR,
JSMSG_RESERVED_ID, kw->chars)) {
goto error;
}
} else if (kw->tokentype == TOK_STRICT_RESERVED) {
if (isStrictMode()
? !ReportStrictModeError(cx, this, NULL, NULL, JSMSG_RESERVED_ID, kw->chars)
: !ReportCompileErrorNumber(cx, this, NULL,
JSREPORT_STRICT | JSREPORT_WARNING,
JSMSG_RESERVED_ID, kw->chars)) {
goto error;
}
} else if (kw->version <= VersionNumber(version)) {
tt = kw->tokentype;
tp->t_op = (JSOp) kw->op;

Просмотреть файл

@ -144,6 +144,7 @@ enum TokenKind {
of definitions paired with a parse
tree full of uses of those names */
TOK_RESERVED, /* reserved keywords */
TOK_STRICT_RESERVED, /* reserved keywords in strict mode */
TOK_LIMIT /* domain size */
};

Просмотреть файл

@ -89,7 +89,6 @@
#define JS_HAS_SHARP_VARS 0 /* has #n=, #n# for object literals */
#define JS_HAS_XDR 0 /* has XDR API and internal support */
#define JS_HAS_TOSOURCE 0 /* has Object/Array toSource method */
#define JS_HAS_DEBUGGER_KEYWORD 0 /* has hook for debugger keyword */
#define JS_HAS_CATCH_GUARD 0 /* has exception handling catch guard */
#define JS_HAS_SPARSE_ARRAYS 0 /* array methods preserve empty elems */
#define JS_HAS_UNEVAL 0 /* has uneval() top-level function */
@ -117,7 +116,6 @@
#define JS_HAS_SHARP_VARS 1 /* has #n=, #n# for object literals */
#define JS_HAS_XDR 1 /* has XDR API and internal support */
#define JS_HAS_TOSOURCE 1 /* has Object/Array toSource method */
#define JS_HAS_DEBUGGER_KEYWORD 1 /* has hook for debugger keyword */
#define JS_HAS_CATCH_GUARD 1 /* has exception handling catch guard */
#define JS_HAS_SPARSE_ARRAYS 0 /* array methods preserve empty elems */
#define JS_HAS_UNEVAL 1 /* has uneval() top-level function */
@ -141,7 +139,6 @@
#define JS_HAS_SHARP_VARS 1 /* has #n=, #n# for object literals */
#define JS_HAS_XDR 1 /* has XDR API and internal support */
#define JS_HAS_TOSOURCE 1 /* has Object/Array toSource method */
#define JS_HAS_DEBUGGER_KEYWORD 1 /* has hook for debugger keyword */
#define JS_HAS_CATCH_GUARD 1 /* has exception handling catch guard */
#define JS_HAS_SPARSE_ARRAYS 0 /* array methods preserve empty elems */
#define JS_HAS_UNEVAL 1 /* has uneval() top-level function */
@ -165,7 +162,6 @@
#define JS_HAS_SHARP_VARS 1 /* has #n=, #n# for object literals */
#define JS_HAS_XDR 1 /* has XDR API and internal support */
#define JS_HAS_TOSOURCE 1 /* has Object/Array toSource method */
#define JS_HAS_DEBUGGER_KEYWORD 1 /* has hook for debugger keyword */
#define JS_HAS_CATCH_GUARD 1 /* has exception handling catch guard */
#define JS_HAS_SPARSE_ARRAYS 0 /* array methods preserve empty elems */
#define JS_HAS_UNEVAL 1 /* has uneval() top-level function */
@ -189,7 +185,6 @@
#define JS_HAS_SHARP_VARS 1 /* has #n=, #n# for object literals */
#define JS_HAS_XDR 1 /* has XDR API and internal support */
#define JS_HAS_TOSOURCE 1 /* has Object/Array toSource method */
#define JS_HAS_DEBUGGER_KEYWORD 1 /* has hook for debugger keyword */
#define JS_HAS_CATCH_GUARD 1 /* has exception handling catch guard */
#define JS_HAS_SPARSE_ARRAYS 0 /* array methods preserve empty elems */
#define JS_HAS_UNEVAL 1 /* has uneval() top-level function */
@ -210,10 +205,6 @@
#endif
/* Features that are present in all versions. */
#define JS_HAS_RESERVED_JAVA_KEYWORDS 1
#define JS_HAS_RESERVED_ECMA_KEYWORDS 1
/* Support for JS_NewGlobalObject. */
#define JS_HAS_NEW_GLOBAL_OBJECT 1

Просмотреть файл

@ -0,0 +1,122 @@
/*
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/licenses/publicdomain/
*/
//-----------------------------------------------------------------------------
var BUGNUMBER = 497869;
var summary = "Implement FutureReservedWords per-spec";
print(BUGNUMBER + ": " + summary);
/**************
* BEGIN TEST *
**************/
var futureReservedWords =
["class",
// "const", // Mozilla extension enabled even for versionless code
"enum",
"export",
"extends",
"import",
"super"];
var strictFutureReservedWords =
[
"implements",
"interface",
// "let", // Mozilla extension, strict checks disabled for now
"package",
"private",
"protected",
"public",
"static",
// "yield", // Mozilla extension, strict checks disabled for now
];
function testWord(word, expectNormal, expectStrict)
{
var actual, status;
// USE IN VARIABLE DECLARATION
actual = "";
status = summary + ", normal var: " + word;
try
{
eval("var " + word + ";");
actual = "no error";
}
catch (e)
{
actual = "error";
status += ", " + e.name + ": " + e.message + " ";
}
reportCompare(expectNormal, actual, status);
actual = "";
status = summary + ", strict var: " + word;
try
{
eval("'use strict'; var " + word + ";");
actual = "no error";
}
catch (e)
{
actual = "error";
status += ", " + e.name + ": " + e.message + " ";
}
reportCompare(expectStrict, actual, status);
// USE AS LHS FOR ASSIGNMENT
actual = "";
status = summary + ", normal assignment: " + word;
try
{
eval(word + " = 'foo';");
actual = "no error";
}
catch(e)
{
actual = "error";
status += ", " + e.name + ": " + e.message + " ";
}
reportCompare(expectNormal, actual, status);
actual = "";
status = summary + ", strict assignment: " + word;
try
{
eval("'use strict'; " + word + " = 'foo';");
actual = "no error";
}
catch(e)
{
actual = "error";
status += ", " + e.name + ": " + e.message + " ";
}
reportCompare(expectStrict, actual, status);
}
function testFutureReservedWord(word)
{
testWord(word, "error", "error");
}
function testStrictFutureReservedWord(word)
{
testWord(word, "no error", "error");
}
futureReservedWords.forEach(testFutureReservedWord);
strictFutureReservedWords.forEach(testStrictFutureReservedWord);
/******************************************************************************/
if (typeof reportCompare === "function")
reportCompare(true, true);
print("All tests passed!");

Просмотреть файл

@ -6,3 +6,4 @@ script unwrapped-no-such-method.js
script explicit-undefined-optional-argument.js
script function-definition-eval.js
skip-if(!xulRuntime.shell) script function-definition-evaluate.js # needs evaluate()
script future-reserved-words.js

Просмотреть файл

@ -60,7 +60,6 @@ script regress-233483.js
script regress-234389.js
script regress-238881.js
script regress-238945.js
script regress-240317.js
script regress-240577.js
script regress-243174.js
script regress-243389-n.js

Просмотреть файл

@ -1,68 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/licenses/publicdomain/
* Contributor: Bob Clary
*/
//-----------------------------------------------------------------------------
var BUGNUMBER = 240317;
var summary = 'Using Reserved identifiers warns';
var actual = '';
var expect = 'no error';
printBugNumber(BUGNUMBER);
printStatus (summary);
function testvar(words)
{
var e;
expect = 'no error';
for (var i = 0; i < words.length; i++)
{
var word = words[i];
actual = '';
status = summary + ': ' + word;
try
{
eval('var ' + word + ';');
actual = 'no error';
}
catch(e)
{
actual = 'error';
status += ', ' + e.name + ': ' + e.message + ' ';
}
reportCompare(expect, actual, status);
actual = '';
status = summary + ': ' + word;
try
{
eval(word + ' = "foo";');
actual = 'no error';
}
catch(e)
{
actual = 'error';
status += ', ' + e.name + ': ' + e.message + ' ';
}
reportCompare(expect, actual, status);
}
}
// future reserved words
var reserved =
['abstract', 'enum', 'int', 'short', 'boolean',
'interface', 'static', 'byte', 'extends',
'long', 'super', 'char', 'final', 'native',
'synchronized', 'class', 'float', 'package', 'throws',
'goto', 'private', 'transient',
'implements', 'protected', 'volatile', 'double',
'public'];
testvar(reserved);

Просмотреть файл

@ -52,13 +52,13 @@ function test()
printBugNumber(BUGNUMBER);
printStatus (summary);
f = function() { [super] = q; };
expect = 'function() { [super] = q; }';
f = function() { [implements] = q; };
expect = 'function() { [implements] = q; }';
actual = f + '';
compareSource(expect, actual, summary + ': 1');
f = function() { return { get super() { } } };
expect = 'function() { return { get super() { } }; }';
f = function() { return { get implements() { } } };
expect = 'function() { return { get implements() { } }; }';
actual = f + '';
compareSource(expect, actual, summary + ': 2');

Просмотреть файл

@ -21,8 +21,8 @@
<script type="application/javascript">
<![CDATA[
var imports = [ "SimpleTest", "is", "isnot", "ok" ];
for each (var import in imports) {
window[import] = window.opener.wrappedJSObject[import];
for each (var name in imports) {
window[name] = window.opener.wrappedJSObject[name];
}
function runTests() {

Просмотреть файл

@ -22,8 +22,8 @@
<script type="application/javascript">
<![CDATA[
var imports = [ "SimpleTest", "is", "isnot", "ok", "todo" ];
for each (var import in imports) {
window[import] = window.opener.wrappedJSObject[import];
for each (var name in imports) {
window[name] = window.opener.wrappedJSObject[name];
}
var plugin;

Просмотреть файл

@ -18,8 +18,8 @@
SimpleTest.waitForExplicitFinish();
var imports = [ "SimpleTest", "is", "isnot", "ok" ];
for each (var import in imports) {
window[import] = window.opener.wrappedJSObject[import];
for each (var name in imports) {
window[name] = window.opener.wrappedJSObject[name];
}
function snapshot(win) {

Просмотреть файл

@ -9,7 +9,7 @@ var ua = navigator.userAgent;
if (/Windows/.test(ua)) {
id = "win";
if (/NT 5\.1/.test(ua) || /NT 5\.2; Win64/.test(ua))
var class = "winxp";
var classname = "winxp";
}
else if (/Linux/.test(ua))
id = "linux";
@ -24,5 +24,5 @@ else
document.documentElement.appendChild(
document.createTextNode("Unrecognized platform")
);
if (class)
document.documentElement.setAttribute("class", class);
if (classname)
document.documentElement.setAttribute("class", classname);

Просмотреть файл

@ -36,8 +36,8 @@
<script type="application/javascript">
var imports = [ "SimpleTest", "is", "isnot", "ok" ];
for each (var import in imports) {
window[import] = window.opener.wrappedJSObject[import];
for each (var name in imports) {
window[name] = window.opener.wrappedJSObject[name];
}
var div = document.getElementById("display");

Просмотреть файл

@ -204,8 +204,8 @@
}
var path = _entityEncode(this.path);
var html = this.results.map(function (t) {
var class = t.info ? "info" : "result " + (t.pass ? "passed" : "failed");
return "<p class=\"" + class + "\">" + t.result + " | " + path +
var classname = t.info ? "info" : "result " + (t.pass ? "passed" : "failed");
return "<p class=\"" + classname + "\">" + t.result + " | " + path +
" | " + _entityEncode(t.msg) + "</p>";
}).join("\n");
if (this.duration) {

Просмотреть файл

@ -82,12 +82,12 @@ function do_check_throws(f, type, stack)
do_throw("expected " + type.name + " exception, none thrown", stack);
}
function do_check_class(obj, class, stack)
function do_check_class(obj, classname, stack)
{
if (!stack)
stack = Components.stack.caller;
do_check_eq(Object.prototype.toString.call(obj), "[object " + class + "]", stack);
do_check_eq(Object.prototype.toString.call(obj), "[object " + classname + "]", stack);
}
function run_test()

Просмотреть файл

@ -55,8 +55,8 @@
var gBrowser;
var imports = ["SimpleTest", "ok"];
for each (var import in imports) {
window[import] = window.opener.wrappedJSObject[import];
for each (var name in imports) {
window[name] = window.opener.wrappedJSObject[name];
}
function finish() {

Просмотреть файл

@ -55,8 +55,8 @@
var gBrowser;
var imports = ["SimpleTest", "ok"];
for each (var import in imports) {
window[import] = window.opener.wrappedJSObject[import];
for each (var name in imports) {
window[name] = window.opener.wrappedJSObject[name];
}
function finish() {

Просмотреть файл

@ -57,8 +57,8 @@
var gBrowser;
var imports = ["SimpleTest", "ok", "snapshotWindow", "compareSnapshots"];
for each (var import in imports) {
window[import] = window.opener.wrappedJSObject[import];
for each (var name in imports) {
window[name] = window.opener.wrappedJSObject[name];
}
function finish() {

Просмотреть файл

@ -62,8 +62,8 @@
}
var imports = [ "SimpleTest", "ok"];
for each (var import in imports) {
window[import] = window.opener.wrappedJSObject[import];
for each (var name in imports) {
window[name] = window.opener.wrappedJSObject[name];
}