Bug 1255800 - Make computeThis return a boolean for easier error handling. r=jorendorff

This commit is contained in:
Tom Schuster
2018-03-23 13:09:04 +01:00
parent 9f4fa41252
commit d9af6f9cfe
7 changed files with 41 additions and 31 deletions

View File

@@ -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;
}