mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Clarify some code in do_create_interface_objects
rval.get() is believed to be always null upon entering this function. This assumption is verified by the added assertion. It makes more sense to move the block of code that was moved inside the if statement which is the only place where it can be initialized. Fixes #7941.
This commit is contained in:
parent
9cccd98254
commit
a6a685e954
1 changed files with 10 additions and 9 deletions
|
@ -218,20 +218,21 @@ pub fn do_create_interface_objects(cx: *mut JSContext,
|
|||
dom_class: Option<&'static DOMClass>,
|
||||
members: &'static NativeProperties,
|
||||
rval: MutableHandleObject) {
|
||||
assert!(rval.get().is_null());
|
||||
if let Some(proto_class) = proto_class {
|
||||
create_interface_prototype_object(cx, proto_proto,
|
||||
proto_class, members, rval);
|
||||
}
|
||||
|
||||
if !rval.get().is_null() {
|
||||
let dom_class_ptr = match dom_class {
|
||||
Some(dom_class) => dom_class as *const DOMClass as *const libc::c_void,
|
||||
None => ptr::null() as *const libc::c_void,
|
||||
};
|
||||
if !rval.get().is_null() {
|
||||
let dom_class_ptr = match dom_class {
|
||||
Some(dom_class) => dom_class as *const DOMClass as *const libc::c_void,
|
||||
None => ptr::null() as *const libc::c_void,
|
||||
};
|
||||
|
||||
unsafe {
|
||||
JS_SetReservedSlot(rval.get(), DOM_PROTO_INSTANCE_CLASS_SLOT,
|
||||
PrivateValue(dom_class_ptr));
|
||||
unsafe {
|
||||
JS_SetReservedSlot(rval.get(), DOM_PROTO_INSTANCE_CLASS_SLOT,
|
||||
PrivateValue(dom_class_ptr));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue