зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1479712 part 1 - Require a plain function in xpcshell setInterruptCallback. r=bholley
The head_watchdog.js test always calls this with a function argument. This lets us use JSAutoRealm instead of JSAutoRealmAllowCCW.
This commit is contained in:
Родитель
6d85c982d8
Коммит
f672f4f7b6
|
@ -542,7 +542,9 @@ XPCShellInterruptCallback(JSContext* cx)
|
|||
if (callback.isUndefined())
|
||||
return true;
|
||||
|
||||
JSAutoRealmAllowCCW ar(cx, &callback.toObject());
|
||||
MOZ_ASSERT(js::IsFunctionObject(&callback.toObject()));
|
||||
|
||||
JSAutoRealm ar(cx, &callback.toObject());
|
||||
RootedValue rv(cx);
|
||||
if (!JS_CallFunctionValue(cx, nullptr, callback, JS::HandleValueArray::empty(), &rv) ||
|
||||
!rv.isBoolean())
|
||||
|
@ -573,9 +575,9 @@ SetInterruptCallback(JSContext* cx, unsigned argc, Value* vp)
|
|||
return true;
|
||||
}
|
||||
|
||||
// Otherwise, we should have a callable object.
|
||||
if (!args[0].isObject() || !JS::IsCallable(&args[0].toObject())) {
|
||||
JS_ReportErrorASCII(cx, "Argument must be callable");
|
||||
// Otherwise, we should have a function object.
|
||||
if (!args[0].isObject() || !js::IsFunctionObject(&args[0].toObject())) {
|
||||
JS_ReportErrorASCII(cx, "Argument must be a function");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче