mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 857439 Followup: Add null-checks for WrapObject failing and assert that the JSObject took ownership if WrapObject succeeded r=bz
This commit is contained in:
parent
d572cd5e8f
commit
5dda7256e6
@ -630,6 +630,10 @@ WrapNewBindingNonWrapperCachedObject(JSContext* cx, JSObject* scope, T* value,
|
||||
obj = value->WrapObject(cx, scope);
|
||||
}
|
||||
|
||||
if (!obj) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// We can end up here in all sorts of compartments, per above. Make
|
||||
// sure to JS_WrapValue!
|
||||
*vp = JS::ObjectValue(*obj);
|
||||
@ -660,11 +664,18 @@ WrapNewBindingNonWrapperCachedOwnedObject(JSContext* cx, JSObject* scope,
|
||||
|
||||
bool tookOwnership = false;
|
||||
obj = value->WrapObject(cx, scope, &tookOwnership);
|
||||
if (obj) {
|
||||
MOZ_ASSERT(tookOwnership);
|
||||
}
|
||||
if (tookOwnership) {
|
||||
value.forget();
|
||||
}
|
||||
}
|
||||
|
||||
if (!obj) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// We can end up here in all sorts of compartments, per above. Make
|
||||
// sure to JS_WrapValue!
|
||||
*vp = JS::ObjectValue(*obj);
|
||||
|
Loading…
Reference in New Issue
Block a user