Back out everything from the last several hours for turning into a disaster zone finally ending in total orange. r=return-to-sanity

This commit is contained in:
Jeff Walden 2011-01-23 03:12:28 -08:00
parent 5ef527b523
commit 882117c5e3
37 changed files with 204 additions and 253 deletions

View File

@ -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 classname = success ? "success" : "error";
let class = success ? "success" : "error";
let image = element.getElementsByAttribute("class", "statusIcon")[0];
image.setAttribute("status", classname);
image.setAttribute("status", class);
let label = element.getElementsByAttribute("class", "status")[0];
label.value = string;
},

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,3 +0,0 @@
var COUNT = RUNLOOP;
eval("'use strict'; for (let j = 0; j < COUNT; j++); try { x; throw new Error(); } catch (e) { if (!(e instanceof ReferenceError)) throw e; }");
assertEq(typeof j, "undefined");

View File

@ -4845,8 +4845,7 @@ JS_DecompileScript(JSContext *cx, JSScript *script, const char *name, uintN inde
str = js_GetPrinterOutput(jp);
else
str = NULL;
if (!js_DestroyPrinter(jp))
return NULL;
js_DestroyPrinter(jp);
return str;
}

View File

@ -7090,10 +7090,12 @@ 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:

View File

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

View File

@ -38,75 +38,87 @@
*
* ***** 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(finally, TOK_FINALLY, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(export, TOK_RESERVED, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(false, TOK_PRIMARY, JSOP_FALSE, 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(throw, TOK_THROW, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(try, TOK_TRY, JSOP_NOP, JSVERSION_DEFAULT)
JS_KEYWORD(true, TOK_PRIMARY, JSOP_TRUE, 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
#if JS_HAS_BLOCK_SCOPE
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)
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
/* 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)
#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)
#endif

View File

@ -805,7 +805,6 @@ struct JSPrinter {
bool pretty; /* pretty-print: indent, use newlines */
bool grouped; /* in parenthesized expression context */
bool strict; /* in code marked strict */
bool error; /* error occured */
JSScript *script; /* script being printed */
jsbytecode *dvgfence; /* DecompileExpression fencepost */
jsbytecode **pcstack; /* DecompileExpression modeled stack */
@ -828,7 +827,6 @@ js_NewPrinter(JSContext *cx, const char *name, JSFunction *fun,
jp->pretty = !!pretty;
jp->grouped = !!grouped;
jp->strict = !!strict;
jp->error = false;
jp->script = NULL;
jp->dvgfence = NULL;
jp->pcstack = NULL;
@ -844,13 +842,11 @@ js_NewPrinter(JSContext *cx, const char *name, JSFunction *fun,
return jp;
}
JSBool
void
js_DestroyPrinter(JSPrinter *jp)
{
JS_FinishArenaPool(&jp->pool);
bool error = jp->error;
jp->sprinter.context->free(jp);
return error;
}
JSString *
@ -2333,7 +2329,7 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb, JSOp nextop)
ok = js_DecompileFunction(jp2);
if (ok && jp2->sprinter.base)
js_puts(jp, jp2->sprinter.base);
ok &= !!js_DestroyPrinter(jp2);
js_DestroyPrinter(jp2);
if (!ok)
return NULL;
js_puts(jp, "\n\n");
@ -4617,10 +4613,12 @@ 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:
@ -4925,8 +4923,7 @@ js_DecompileToString(JSContext *cx, const char *name, JSFunction *fun,
str = js_GetPrinterOutput(jp);
else
str = NULL;
if (!js_DestroyPrinter(jp))
return NULL;
js_DestroyPrinter(jp);
return str;
}
@ -5309,10 +5306,7 @@ DecompileExpression(JSContext *cx, JSScript *script, JSFunction *fun,
name = (jp->sprinter.base) ? jp->sprinter.base : (char *) "";
name = JS_strdup(cx, name);
}
if (!js_DestroyPrinter(jp)) {
cx->free(name);
name = NULL;
}
js_DestroyPrinter(jp);
}
out:

View File

@ -311,7 +311,7 @@ extern JSPrinter *
js_NewPrinter(JSContext *cx, const char *name, JSFunction *fun,
uintN indent, JSBool pretty, JSBool grouped, JSBool strict);
extern JSBool
extern void
js_DestroyPrinter(JSPrinter *jp);
extern JSString *

View File

@ -6203,6 +6203,7 @@ Parser::statement()
pn->pn_type = TOK_SEMI;
return pn;
#if JS_HAS_DEBUGGER_KEYWORD
case TOK_DEBUGGER:
pn = NullaryNode::create(tc);
if (!pn)
@ -6210,6 +6211,7 @@ 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:

View File

@ -1043,18 +1043,10 @@ TokenStream::getTokenInternal()
!(flags & TSF_KEYWORD_IS_NAME) &&
(kw = FindKeyword(tokenbuf.begin(), tokenbuf.length()))) {
if (kw->tokentype == TOK_RESERVED) {
if (!ReportCompileErrorNumber(cx, this, NULL, JSREPORT_ERROR,
if (!ReportCompileErrorNumber(cx, this, NULL, JSREPORT_WARNING | JSREPORT_STRICT,
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;

View File

@ -144,7 +144,6 @@ 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 */
};

View File

@ -14978,13 +14978,6 @@ TraceRecorder::record_JSOP_POPN()
return ARECORD_CONTINUE;
}
static inline bool
IsFindableCallObj(JSObject *obj)
{
return obj->isCall() &&
(obj->callIsForEval() || obj->getCallObjCalleeFunction()->isHeavyweight());
}
/*
* Generate LIR to reach |obj2| from |obj| by traversing the scope chain. The
* generated code also ensures that any call objects found have not changed shape.
@ -15026,10 +15019,13 @@ TraceRecorder::traverseScopeChain(JSObject *obj, LIns *obj_ins, JSObject *target
for (;;) {
if (searchObj != globalObj) {
if (searchObj->isBlock())
Class* clasp = searchObj->getClass();
if (clasp == &js_BlockClass) {
foundBlockObj = true;
else if (IsFindableCallObj(searchObj))
} else if (clasp == &js_CallClass &&
searchObj->getCallObjCalleeFunction()->isHeavyweight()) {
foundCallObj = true;
}
}
if (searchObj == targetObj)
@ -15058,7 +15054,8 @@ TraceRecorder::traverseScopeChain(JSObject *obj, LIns *obj_ins, JSObject *target
// We must guard on the shape of all call objects for heavyweight functions
// that we traverse on the scope chain: if the shape changes, a variable with
// the same name may have been inserted in the scope chain.
if (IsFindableCallObj(obj)) {
if (obj->isCall() &&
obj->getCallObjCalleeFunction()->isHeavyweight()) {
if (!exit)
exit = snapshot(BRANCH_EXIT);
guard(true,

View File

@ -89,6 +89,7 @@
#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 */
@ -116,6 +117,7 @@
#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 */
@ -139,6 +141,7 @@
#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 */
@ -162,6 +165,7 @@
#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 */
@ -185,6 +189,7 @@
#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 */
@ -205,6 +210,10 @@
#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

View File

@ -1,122 +0,0 @@
/*
* 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!");

View File

@ -6,4 +6,3 @@ 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

View File

@ -60,6 +60,7 @@ 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

View File

@ -0,0 +1,68 @@
/* -*- 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);

View File

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

View File

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

View File

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

View File

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

View File

@ -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 classname = "winxp";
var class = "winxp";
}
else if (/Linux/.test(ua))
id = "linux";
@ -24,5 +24,5 @@ else
document.documentElement.appendChild(
document.createTextNode("Unrecognized platform")
);
if (classname)
document.documentElement.setAttribute("class", classname);
if (class)
document.documentElement.setAttribute("class", class);

View File

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

View File

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

View File

@ -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, classname, stack)
function do_check_class(obj, class, stack)
{
if (!stack)
stack = Components.stack.caller;
do_check_eq(Object.prototype.toString.call(obj), "[object " + classname + "]", stack);
do_check_eq(Object.prototype.toString.call(obj), "[object " + class + "]", stack);
}
function run_test()

View File

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

View File

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

View File

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

View File

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