Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Default implementation for PropertyDescriptor #407

Merged
merged 2 commits into from Mar 24, 2018

Conversation

@taki-jaro
Copy link
Contributor

taki-jaro commented Mar 24, 2018

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
Copy link
Member

jdm commented Mar 24, 2018

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
Copy link
Contributor Author

taki-jaro commented Mar 24, 2018

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

@jdm
Copy link
Member

jdm commented Mar 24, 2018

@bors-servo
Copy link
Contributor

bors-servo commented Mar 24, 2018

📌 Commit 57661a5 has been approved by jdm

@bors-servo
Copy link
Contributor

bors-servo commented Mar 24, 2018

Testing commit 57661a5 with merge 33f5ee9...

bors-servo added a commit that referenced this pull request Mar 24, 2018
Added Default implementation for PropertyDescriptor

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

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-mozjs/407)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Mar 24, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: jdm
Pushing 33f5ee9 to master...

@bors-servo bors-servo merged commit 57661a5 into servo:master Mar 24, 2018
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.