mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Require JSFunction::inStrictMode() callers to check for isInterpreted() first, since most already know that the function in question is interpreted. r=dmandelin
This commit is contained in:
parent
59814e4551
commit
e2834ef56d
@ -1580,12 +1580,15 @@ fun_getProperty(JSContext *cx, JSObject *obj, jsid id, Value *vp)
|
|||||||
/* Censor the caller if it is from another compartment. */
|
/* Censor the caller if it is from another compartment. */
|
||||||
if (caller.getCompartment() != cx->compartment) {
|
if (caller.getCompartment() != cx->compartment) {
|
||||||
vp->setNull();
|
vp->setNull();
|
||||||
} else if (caller.isFunction() && caller.getFunctionPrivate()->inStrictMode()) {
|
} else if (caller.isFunction()) {
|
||||||
|
JSFunction *callerFun = caller.getFunctionPrivate();
|
||||||
|
if (callerFun->isInterpreted() && callerFun->inStrictMode()) {
|
||||||
JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, js_GetErrorMessage, NULL,
|
JS_ReportErrorFlagsAndNumber(cx, JSREPORT_ERROR, js_GetErrorMessage, NULL,
|
||||||
JSMSG_CALLER_IS_STRICT);
|
JSMSG_CALLER_IS_STRICT);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -1753,7 +1756,7 @@ fun_resolve(JSContext *cx, JSObject *obj, jsid id, uintN flags,
|
|||||||
|
|
||||||
PropertyOp getter, setter;
|
PropertyOp getter, setter;
|
||||||
uintN attrs = JSPROP_PERMANENT;
|
uintN attrs = JSPROP_PERMANENT;
|
||||||
if (fun->inStrictMode() || obj->isBoundFunction()) {
|
if (fun->isInterpreted() ? fun->inStrictMode() : obj->isBoundFunction()) {
|
||||||
JSObject *throwTypeError = obj->getThrowTypeError();
|
JSObject *throwTypeError = obj->getThrowTypeError();
|
||||||
|
|
||||||
getter = CastAsPropertyOp(throwTypeError);
|
getter = CastAsPropertyOp(throwTypeError);
|
||||||
|
@ -180,6 +180,7 @@ struct JSFunction : public JSObject_Slots2
|
|||||||
|
|
||||||
bool isFunctionPrototype() const { return flags & JSFUN_PROTOTYPE; }
|
bool isFunctionPrototype() const { return flags & JSFUN_PROTOTYPE; }
|
||||||
|
|
||||||
|
/* Returns the strictness of this function, which must be interpreted. */
|
||||||
inline bool inStrictMode() const;
|
inline bool inStrictMode() const;
|
||||||
|
|
||||||
uintN countVars() const {
|
uintN countVars() const {
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
inline bool
|
inline bool
|
||||||
JSFunction::inStrictMode() const
|
JSFunction::inStrictMode() const
|
||||||
{
|
{
|
||||||
return isInterpreted() && u.i.script->strictModeCode;
|
return script()->strictModeCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* jsfuninlines_h___ */
|
#endif /* jsfuninlines_h___ */
|
||||||
|
@ -9970,7 +9970,7 @@ TraceRecorder::getThis(LIns*& this_ins)
|
|||||||
JS_ASSERT(fp->callee().getGlobal() == globalObj);
|
JS_ASSERT(fp->callee().getGlobal() == globalObj);
|
||||||
Value& thisv = fp->thisValue();
|
Value& thisv = fp->thisValue();
|
||||||
|
|
||||||
if (fp->fun()->inStrictMode() || thisv.isObject()) {
|
if (thisv.isObject() || fp->fun()->inStrictMode()) {
|
||||||
/*
|
/*
|
||||||
* fp->thisValue() has already been computed. Since the
|
* fp->thisValue() has already been computed. Since the
|
||||||
* type-specialization of traces distinguishes between computed and
|
* type-specialization of traces distinguishes between computed and
|
||||||
|
Loading…
Reference in New Issue
Block a user