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

Add proxy handler deriving from DirectWrapper and related methods, along... #52

Closed
wants to merge 1 commit into from

Conversation

@jdm
Copy link
Member

jdm commented Mar 5, 2014

... with extended js::Class FFI.

Needed for servo/servo#1818.

@jdm
Copy link
Member Author

jdm commented Mar 5, 2014

It sucks to introduce js::Class here, but so it goes.

glue.rs Outdated
defineProperty: extern "C" fn(*JSContext, *JSObject, jsid, *JSPropertyDescriptor) -> JSBool,
getPropertyDescriptor: Option<extern "C" fn(*JSContext, *JSObject, jsid, c_bool, *mut JSPropertyDescriptor) -> c_bool>,
getOwnPropertyDescriptor: Option<extern "C" fn(*JSContext, *JSObject, jsid, JSBool, *mut JSPropertyDescriptor) -> JSBool>,
defineProperty: Option<extern "C" fn(*JSContext, *JSObject, jsid, *JSPropertyDescriptor) -> JSBool>,
getOwnPropertyNames: *u8,

This comment has been minimized.

@bholley

bholley Mar 19, 2014

I don't grok the logic behind what gets stubbed out as *u8 and what gets a signature. In particular, any proxy implementation that does something special with |hasOwn| almost certainly needs to override getOwnPropertyNames.

This comment has been minimized.

@jdm

jdm Mar 19, 2014

Author Member

The *u8 stubs are there because writing out each type is annoying and I haven't needed them yet. That's all.

jsglue.cpp Outdated
class WrapperProxyHandler : public js::DirectWrapper
{
ProxyTraps mTraps;
void* mExtra;

This comment has been minimized.

@bholley

bholley Mar 19, 2014

What's this about?

This comment has been minimized.

@jdm

jdm Mar 19, 2014

Author Member

Copypasta.

return mTraps.getPropertyDescriptor ?
mTraps.getPropertyDescriptor(cx, proxy, id, set, desc) :
DirectWrapper::getPropertyDescriptor(cx, proxy, id, set, desc);
}

This comment has been minimized.

@bholley

bholley Mar 19, 2014

In general, anybody implemented a wrapper-ish proxy (like outer window) is going to want to bounce to the base handler after potentially doing some special handing. It looks like this setup is either-or, which isn't going to work very well.

This comment has been minimized.

@jdm

jdm Mar 19, 2014

Author Member

Yeah, there are methods further down for invoking other base handlers; I can add more for the rest of them.

@jdm jdm closed this Apr 22, 2014
@jdm jdm deleted the jdm:windowproxy branch Apr 22, 2014
@jdm jdm restored the jdm:windowproxy branch Apr 22, 2014
@jdm jdm deleted the jdm:windowproxy branch Apr 22, 2014
mmatyas pushed a commit to mmatyas/rust-mozjs that referenced this pull request Jul 30, 2015
tschneidereit pushed a commit to tschneidereit/rust-mozjs that referenced this pull request Aug 26, 2017
Better static linking

r? @metajack @mbrubeck 

CC @alexcrichton

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/mozjs/52)
<!-- Reviewable:end -->
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

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