Bug 1598752 - Provide useful information while constructing JSWindowActor; r=nika

Differential Revision: https://phabricator.services.mozilla.com/D60170

--HG--
extra : moz-landing-system : lando
This commit is contained in:
John Dai 2020-01-20 15:20:12 +00:00
parent 6437917bea
commit 4e3e74af76

View File

@ -115,6 +115,13 @@ void WindowGlobalActor::ConstructActor(const nsAString& aName,
return;
}
if (NS_WARN_IF(!ctor.isObject())) {
nsPrintfCString message("Could not find actor constructor '%s'",
NS_ConvertUTF16toUTF8(ctorName).get());
aRv.ThrowDOMException(NS_ERROR_DOM_NOT_FOUND_ERR, message);
return;
}
// Invoke the constructor loaded from the module.
if (!JS::Construct(cx, ctor, JS::HandleValueArray::empty(), aActor)) {
aRv.NoteJSContextException(cx);