JS_VERSION_IS_ECMA is removed as always-true-macro since SpiderMonkey no longer supports any version less than JavaScript1.5 bug=353315 r=brendan
git-svn-id: svn://10.0.0.236/trunk@212056 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
19eeeba991
commit
8ab32a68fe
@ -116,7 +116,7 @@ MSG_DEF(JSMSG_BAD_RADIX, 33, 1, JSEXN_ERR, "illegal radix {0}")
|
||||
MSG_DEF(JSMSG_PAREN_BEFORE_LET, 34, 0, JSEXN_SYNTAXERR, "missing ( before let head")
|
||||
MSG_DEF(JSMSG_CANT_CONVERT, 35, 1, JSEXN_ERR, "can't convert {0} to an integer")
|
||||
MSG_DEF(JSMSG_CYCLIC_VALUE, 36, 1, JSEXN_ERR, "cyclic {0} value")
|
||||
MSG_DEF(JSMSG_PERMANENT, 37, 1, JSEXN_ERR, "{0} is permanent")
|
||||
MSG_DEF(JSMSG_UNUSED37, 37, 0, JSEXN_ERR, "")
|
||||
MSG_DEF(JSMSG_CANT_CONVERT_TO, 38, 2, JSEXN_TYPEERR, "can't convert {0} to {1}")
|
||||
MSG_DEF(JSMSG_NO_PROPERTIES, 39, 1, JSEXN_TYPEERR, "{0} has no properties")
|
||||
MSG_DEF(JSMSG_CANT_FIND_CLASS, 40, 1, JSEXN_TYPEERR, "can't find class id {0}")
|
||||
|
||||
@ -201,15 +201,7 @@ js_ValueToBoolean(JSContext *cx, jsval v, JSBool *bp)
|
||||
if (JSVAL_IS_NULL(v) || JSVAL_IS_VOID(v)) {
|
||||
b = JS_FALSE;
|
||||
} else if (JSVAL_IS_OBJECT(v)) {
|
||||
if (!JS_VERSION_IS_ECMA(cx)) {
|
||||
if (!OBJ_DEFAULT_VALUE(cx, JSVAL_TO_OBJECT(v), JSTYPE_BOOLEAN, &v))
|
||||
return JS_FALSE;
|
||||
if (!JSVAL_IS_BOOLEAN(v))
|
||||
v = JSVAL_TRUE; /* non-null object is true */
|
||||
b = JSVAL_TO_BOOLEAN(v);
|
||||
} else {
|
||||
b = JS_TRUE;
|
||||
}
|
||||
b = JS_TRUE;
|
||||
} else if (JSVAL_IS_STRING(v)) {
|
||||
b = JSSTRING_LENGTH(JSVAL_TO_STRING(v)) ? JS_TRUE : JS_FALSE;
|
||||
} else if (JSVAL_IS_INT(v)) {
|
||||
|
||||
@ -780,12 +780,6 @@ class JSAutoTempValueRooter
|
||||
#define JS_HAS_NATIVE_BRANCH_CALLBACK_OPTION(cx) \
|
||||
JS_HAS_OPTION(cx, JSOPTION_NATIVE_BRANCH_CALLBACK)
|
||||
|
||||
/*
|
||||
* Wrappers for the JSVERSION_IS_* macros from jspubtd.h taking JSContext *cx
|
||||
* and masking off the XML flag and any other high order bits.
|
||||
*/
|
||||
#define JS_VERSION_IS_ECMA(cx) JSVERSION_IS_ECMA(JSVERSION_NUMBER(cx))
|
||||
|
||||
/*
|
||||
* Common subroutine of JS_SetVersion and js_SetVersion, to update per-context
|
||||
* data that depends on version.
|
||||
|
||||
@ -427,10 +427,7 @@ args_resolve(JSContext *cx, JSObject *obj, jsval id, uintN flags,
|
||||
if (!js_DefineProperty(cx, obj, INT_JSVAL_TO_JSID(id),
|
||||
fp->argv[slot],
|
||||
args_getProperty, args_setProperty,
|
||||
JS_VERSION_IS_ECMA(cx)
|
||||
? 0
|
||||
: JSPROP_ENUMERATE,
|
||||
NULL)) {
|
||||
0, NULL)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
*objp = obj;
|
||||
|
||||
@ -3519,7 +3519,7 @@ js_SetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
|
||||
* read_only_error;' case.
|
||||
*/
|
||||
flags = JSREPORT_ERROR;
|
||||
if ((attrs & JSPROP_READONLY) && JS_VERSION_IS_ECMA(cx)) {
|
||||
if (attrs & JSPROP_READONLY) {
|
||||
if (!JS_HAS_STRICT_OPTION(cx)) {
|
||||
/* Just return true per ECMA if not in strict mode. */
|
||||
return JS_TRUE;
|
||||
@ -3720,7 +3720,6 @@ js_DeleteProperty(JSContext *cx, JSObject *obj, jsid id, jsval *rval)
|
||||
JSObject *proto;
|
||||
JSProperty *prop;
|
||||
JSScopeProperty *sprop;
|
||||
JSString *str;
|
||||
JSScope *scope;
|
||||
JSBool ok;
|
||||
|
||||
@ -3764,17 +3763,8 @@ js_DeleteProperty(JSContext *cx, JSObject *obj, jsid id, jsval *rval)
|
||||
sprop = (JSScopeProperty *)prop;
|
||||
if (sprop->attrs & JSPROP_PERMANENT) {
|
||||
OBJ_DROP_PROPERTY(cx, obj, prop);
|
||||
if (JS_VERSION_IS_ECMA(cx)) {
|
||||
*rval = JSVAL_FALSE;
|
||||
return JS_TRUE;
|
||||
}
|
||||
str = js_DecompileValueGenerator(cx, JSDVG_IGNORE_STACK,
|
||||
ID_TO_VALUE(id), NULL);
|
||||
if (str) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
|
||||
JSMSG_PERMANENT, JS_GetStringBytes(str));
|
||||
}
|
||||
return JS_FALSE;
|
||||
*rval = JSVAL_FALSE;
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
/* XXXbe called with obj locked */
|
||||
|
||||
@ -1496,7 +1496,7 @@ Statements(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc)
|
||||
static JSParseNode *
|
||||
Condition(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc)
|
||||
{
|
||||
JSParseNode *pn, *pn2;
|
||||
JSParseNode *pn;
|
||||
|
||||
MUST_MATCH_TOKEN(TOK_LP, JSMSG_PAREN_BEFORE_COND);
|
||||
pn = Expr(cx, ts, tc);
|
||||
@ -1505,43 +1505,21 @@ Condition(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc)
|
||||
MUST_MATCH_TOKEN(TOK_RP, JSMSG_PAREN_AFTER_COND);
|
||||
|
||||
/*
|
||||
* Check for (a = b) and "correct" it to (a == b) iff b's operator has
|
||||
* greater precedence than ==.
|
||||
* XXX not ECMA, but documented in several books -- now a strict warning.
|
||||
* Check for (a = b) and warn about possible (a == b) mistype iff b's
|
||||
* operator has greater precedence than ==.
|
||||
*/
|
||||
if (pn->pn_type == TOK_ASSIGN &&
|
||||
pn->pn_op == JSOP_NOP &&
|
||||
pn->pn_right->pn_type > TOK_EQOP)
|
||||
{
|
||||
JSBool rewrite = !JS_VERSION_IS_ECMA(cx);
|
||||
if (!js_ReportCompileErrorNumber(cx, ts,
|
||||
JSREPORT_TS |
|
||||
JSREPORT_WARNING |
|
||||
JSREPORT_STRICT,
|
||||
JSMSG_EQUAL_AS_ASSIGN,
|
||||
rewrite
|
||||
? "\nAssuming equality test"
|
||||
: "")) {
|
||||
"")) {
|
||||
return NULL;
|
||||
}
|
||||
if (rewrite) {
|
||||
pn->pn_type = TOK_EQOP;
|
||||
pn->pn_op = (JSOp)cx->jsop_eq;
|
||||
pn2 = pn->pn_left;
|
||||
switch (pn2->pn_op) {
|
||||
case JSOP_SETNAME:
|
||||
pn2->pn_op = JSOP_NAME;
|
||||
break;
|
||||
case JSOP_SETPROP:
|
||||
pn2->pn_op = JSOP_GETPROP;
|
||||
break;
|
||||
case JSOP_SETELEM:
|
||||
pn2->pn_op = JSOP_GETELEM;
|
||||
break;
|
||||
default:
|
||||
JS_ASSERT(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
return pn;
|
||||
}
|
||||
|
||||
@ -1493,7 +1493,7 @@ retry:
|
||||
c = (JS7_UNHEX(cp[0]) << 4) + JS7_UNHEX(cp[1]);
|
||||
SkipChars(ts, 2);
|
||||
}
|
||||
} else if (c == '\n' && JS_VERSION_IS_ECMA(cx)) {
|
||||
} else if (c == '\n') {
|
||||
/* ECMA follows C by removing escaped newlines. */
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1768,14 +1768,6 @@ find_split(JSContext *cx, JSString *str, JSRegExp *re, jsint *ip,
|
||||
return i - sep->length;
|
||||
}
|
||||
|
||||
/*
|
||||
* Deviate from ECMA by never splitting an empty string by any separator
|
||||
* string into a non-empty array (an array of length 1 that contains the
|
||||
* empty string).
|
||||
*/
|
||||
if (!JS_VERSION_IS_ECMA(cx) && length == 0)
|
||||
return -1;
|
||||
|
||||
/*
|
||||
* Special case: if sep is the empty string, split str into one character
|
||||
* substrings. Let our caller worry about whether to split once at end of
|
||||
@ -1902,16 +1894,7 @@ str_split(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
}
|
||||
sep->chars = NULL;
|
||||
}
|
||||
|
||||
i = j + sep->length;
|
||||
if (!JS_VERSION_IS_ECMA(cx)) {
|
||||
/*
|
||||
* Deviate from ECMA to imitate Perl, which omits a final
|
||||
* split unless a limit argument is given and big enough.
|
||||
*/
|
||||
if (!limited && (size_t)i == JSSTRING_LENGTH(str))
|
||||
break;
|
||||
}
|
||||
}
|
||||
ok = (j != -2);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user