Bug 901106 - Make sure sure the nsDOMScriptObjectFactory gets instantiated.

This used to happen implicitly when we created the first nsJSContext, but that
goes away in the next patch. Without this, we get a couple of odd exception-
related failures in the IPC indexedDB tests.
This commit is contained in:
Bobby Holley 2013-08-19 16:24:28 -07:00
Родитель b4dde9a0ba
Коммит c334ce29a3
1 изменённых файлов: 11 добавлений и 0 удалений

Просмотреть файл

@ -2748,6 +2748,8 @@ NS_DOMStructuredCloneError(JSContext* cx,
xpc::Throw(cx, NS_ERROR_DOM_DATA_CLONE_ERR);
}
static NS_DEFINE_CID(kDOMScriptObjectFactoryCID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
//static
nsresult
nsJSRuntime::Init()
@ -2857,6 +2859,15 @@ nsJSRuntime::Init()
obs->AddObserver(observer, "memory-pressure", false);
obs->AddObserver(observer, "quit-application", false);
// We need to explicitly get the nsIDOMScriptObjectFactory service in order
// to force its constructor to run, which registers various exceptions
// providers and other things. It would be nice to make this more explicit
// and less side-effect-y.
nsCOMPtr<nsIDOMScriptObjectFactory> factory = do_GetService(kDOMScriptObjectFactoryCID);
if (!factory) {
MOZ_CRASH();
}
sIsInitialized = true;
return NS_OK;