Bug 887334 - Rejigger the string manipulation in OnJSContextNew to avoid depending on being in a compartment. r=luke

The current code makes calls that assume (implicitly, via assertions) that |cx|
is in a compartment, which isn't a valid assumption going forward.
This commit is contained in:
Bobby Holley 2013-07-17 11:53:51 -07:00
parent ea06c3d7e0
commit 18c1d08a65

View File

@ -2648,10 +2648,11 @@ XPCJSRuntime::OnJSContextNew(JSContext *cx)
RootedString str(cx);
for (unsigned i = 0; i < IDX_TOTAL_COUNT; i++) {
str = JS_InternString(cx, mStrings[i]);
if (!str || !JS_ValueToId(cx, STRING_TO_JSVAL(str), &mStrIDs[i])) {
if (!str) {
mStrIDs[0] = JSID_VOID;
return false;
}
mStrIDs[i] = INTERNED_STRING_TO_JSID(cx, str);
mStrJSVals[i] = STRING_TO_JSVAL(str);
}