Set right compartment in ipc test shell (600022, r=jst).

This commit is contained in:
Andreas Gal
2010-09-30 00:14:37 -07:00
parent 91dbe03ebd
commit 494c149a04
2 changed files with 30 additions and 0 deletions

View File

@@ -122,6 +122,12 @@ TestShellCommandParent::RunCallback(const nsString& aResponse)
JSObject* global = JS_GetGlobalObject(mCx);
NS_ENSURE_TRUE(global, JS_FALSE);
JSAutoEnterCompartment ac;
if (!ac.enter(cx, global)) {
NS_ERROR("Failed to enter compartment!");
return false;
}
JSString* str = JS_NewUCStringCopyN(mCx, aResponse.get(), aResponse.Length());
NS_ENSURE_TRUE(str, JS_FALSE);