Bug 1255800 - Make computeThis return a boolean for easier error handling. r=jorendorff
This commit is contained in:
@@ -132,8 +132,10 @@ Load(JSContext *cx,
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
|
||||
JS::RootedValue thisv(cx, args.computeThis(cx));
|
||||
if (!thisv.isObject() || !JS_IsGlobalObject(&thisv.toObject())) {
|
||||
JS::RootedObject thisObject(cx);
|
||||
if (!args.computeThis(cx, &thisObject))
|
||||
return false;
|
||||
if (!JS_IsGlobalObject(thisObject)) {
|
||||
JS_ReportErrorASCII(cx, "Trying to load() into a non-global object");
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user