aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/codegen
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2015-10-28 17:24:36 +0530
committerbors-servo <lbergstrom+bors@mozilla.com>2015-10-28 17:24:36 +0530
commit3efa74997626afb3eda0f34842a4969da468dff0 (patch)
treeb53950d7cd9c76a9877ced131f092b61f99f7a48 /components/script/dom/bindings/codegen
parent8cc6ce4b86d35625a90546f3d5829e3be4a33db9 (diff)
parentc82b6ce8431e1379b7bd4689c2aadadbdc65c8b7 (diff)
downloadservo-3efa74997626afb3eda0f34842a4969da468dff0.tar.gz
servo-3efa74997626afb3eda0f34842a4969da468dff0.zip
Auto merge of #8226 - froydnj:gc-zeal, r=Ms2ger
unblock using JS_GC_ZEAL I think these patches move the `JS_SetReservedSlot` call to the right place for #6057. I'm not sure that the interface to `create_dom_global` is the best; passing a `JSVal` or a `*libc::c_void` seemed about equal, so I'd welcome feedback there. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8226) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/bindings/codegen')
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py40
1 files changed, 20 insertions, 20 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index 2350203d549..51a4653279f 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -2161,27 +2161,27 @@ let obj = {
assert!(!obj.is_null());
let obj = RootedObject::new(cx, obj);\
""" % (descriptor.name, parent)
+ elif descriptor.isGlobal():
+ create += ("let obj = RootedObject::new(\n"
+ " cx,\n"
+ " create_dom_global(\n"
+ " cx,\n"
+ " &Class.base as *const js::jsapi::Class as *const JSClass,\n"
+ " raw as *const libc::c_void,\n"
+ " Some(%s))\n"
+ ");\n"
+ "assert!(!obj.ptr.is_null());" % TRACE_HOOK_NAME)
else:
- if descriptor.isGlobal():
- create += ("let obj = RootedObject::new(\n"
- " cx,\n"
- " create_dom_global(\n"
- " cx,\n"
- " &Class.base as *const js::jsapi::Class as *const JSClass,\n"
- " Some(%s))\n"
- ");\n" % TRACE_HOOK_NAME)
- else:
- create += ("let obj = {\n"
- " let _ac = JSAutoCompartment::new(cx, proto.ptr);\n"
- " JS_NewObjectWithGivenProto(\n"
- " cx, &Class.base as *const js::jsapi::Class as *const JSClass, proto.handle())\n"
- "};\n"
- "let obj = RootedObject::new(cx, obj);\n")
- create += """\
-assert!(!obj.ptr.is_null());
-
-JS_SetReservedSlot(obj.ptr, DOM_OBJECT_SLOT,
- PrivateValue(raw as *const libc::c_void));"""
+ create += ("let obj = {\n"
+ " let _ac = JSAutoCompartment::new(cx, proto.ptr);\n"
+ " JS_NewObjectWithGivenProto(\n"
+ " cx, &Class.base as *const js::jsapi::Class as *const JSClass, proto.handle())\n"
+ "};\n"
+ "let obj = RootedObject::new(cx, obj);\n"
+ "assert!(!obj.ptr.is_null());\n"
+ "\n"
+ "JS_SetReservedSlot(obj.ptr, DOM_OBJECT_SLOT,\n"
+ " PrivateValue(raw as *const libc::c_void));")
return create