servo / rust-mozjs

DEPRECATED - moved to servo/mozjs instead.
Mozilla Public License 2.0
293 stars 117 forks source link

Added Default implementation for PropertyDescriptor #407

Closed taki-jaro closed 6 years ago

taki-jaro commented 6 years ago

It is needed for servo to be able to use JS_GetOwnPropertyDescriptorById method as it needs MutableHandle<PropertyDescriptor> as output parameter. To get the MutableHandle one should do sth like rooted!(in(cx) let mut desc = dummyPropertyDescriptor) and then desc.handle_mut(). Now there are no easy ways to get dummyPropertyDescriptor.

I am not sure if it is the proper way. AFAIK the jsapi_* files are automatically generated they shouldn't be modified and I don't know how to make bindgen generate derive(Default) for PropertyDescriptor


This change is Reviewable

jdm commented 6 years ago

I would just add this to rust.rs. Right now this code won't be compiled unless lib.rs is modified to include the new module.

taki-jaro commented 6 years ago

Done. So stupid of me, I forgot to update lib.rs

jdm commented 6 years ago

@bors-servo r+

bors-servo commented 6 years ago

:pushpin: Commit 57661a5 has been approved by jdm

bors-servo commented 6 years ago

:hourglass: Testing commit 57661a5b834de1cd912a8dd59a16e763811717b3 with merge 33f5ee9992f2d0274bfb1c174008318e87d94ff6...

bors-servo commented 6 years ago

:sunny: Test successful - status-appveyor, status-travis Approved by: jdm Pushing 33f5ee9992f2d0274bfb1c174008318e87d94ff6 to master...