diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-01-14 18:24:03 +0530 |
---|---|---|
committer | bors-servo <lbergstrom+bors@mozilla.com> | 2016-01-14 18:24:03 +0530 |
commit | a28b5cb43859b6300c0b157c6b3d25d78606dda8 (patch) | |
tree | 781e88204c27d2e1f1aff837d8b8be79baa8ed07 | |
parent | d28fb42201dd743c470fcc1f43bf2e13f1c8cddc (diff) | |
parent | e2160cb3b92843633659d4bc099e6c3d0967f5fa (diff) | |
download | servo-a28b5cb43859b6300c0b157c6b3d25d78606dda8.tar.gz servo-a28b5cb43859b6300c0b157c6b3d25d78606dda8.zip |
Auto merge of #9296 - apopiak:implement_as_class_9287, r=ecoal95
implement NonCallbackInterfaceObjectClass::as_jsclass()
close #9287
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9296)
<!-- Reviewable:end -->
-rw-r--r-- | components/script/dom/bindings/interface.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/components/script/dom/bindings/interface.rs b/components/script/dom/bindings/interface.rs index 96f4d7c470a..457eba22236 100644 --- a/components/script/dom/bindings/interface.rs +++ b/components/script/dom/bindings/interface.rs @@ -105,6 +105,13 @@ impl NonCallbackInterfaceObjectClass { }, } } + + /// cast own reference to `JSClass` reference + pub fn as_jsclass(&self) -> &JSClass { + unsafe { + &*(self as *const _ as *const JSClass) + } + } } /// Create and define the interface object of a callback interface. @@ -148,7 +155,7 @@ pub unsafe fn create_noncallback_interface_object( rval: MutableHandleObject) { create_object(cx, proto, - &*(class as *const _ as *const JSClass), + class.as_jsclass(), static_methods, static_properties, constants, |