mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
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:
parent
ea06c3d7e0
commit
18c1d08a65
@ -2648,10 +2648,11 @@ XPCJSRuntime::OnJSContextNew(JSContext *cx)
|
|||||||
RootedString str(cx);
|
RootedString str(cx);
|
||||||
for (unsigned i = 0; i < IDX_TOTAL_COUNT; i++) {
|
for (unsigned i = 0; i < IDX_TOTAL_COUNT; i++) {
|
||||||
str = JS_InternString(cx, mStrings[i]);
|
str = JS_InternString(cx, mStrings[i]);
|
||||||
if (!str || !JS_ValueToId(cx, STRING_TO_JSVAL(str), &mStrIDs[i])) {
|
if (!str) {
|
||||||
mStrIDs[0] = JSID_VOID;
|
mStrIDs[0] = JSID_VOID;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
mStrIDs[i] = INTERNED_STRING_TO_JSID(cx, str);
|
||||||
mStrJSVals[i] = STRING_TO_JSVAL(str);
|
mStrJSVals[i] = STRING_TO_JSVAL(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user