Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upadded servojsprincipal skeleton #353
Conversation
| @@ -332,6 +332,30 @@ class WrapperProxyHandler : public js::Wrapper | |||
| } | |||
| }; | |||
|
|
|||
| //http://searchfox.org/mozilla-central/source/js/public/Principals.h#24 | |||
This comment has been minimized.
This comment has been minimized.
| { | ||
| const void* origin; //box with origin in it | ||
| public: | ||
| ServoJSPrincipal(const void* origin) |
This comment has been minimized.
This comment has been minimized.
jdm
Apr 18, 2017
Member
We will need to accept two function pointers as arguments here - one for destroy (that accepts a *mut JSPrincipals argument), and one for write. This will allow Rust code to provide callbacks that those C++ methods can invoke.
| } | ||
|
|
||
| const void* | ||
| getPrincipalOrigin(JSPrincipals* principal) { |
This comment has been minimized.
This comment has been minimized.
| @@ -407,6 +431,16 @@ class ForwardingProxyHandler : public js::BaseProxyHandler | |||
|
|
|||
| extern "C" { | |||
|
|
|||
| JSPrincipals * | |||
This comment has been minimized.
This comment has been minimized.
2e7ae3c
to
3fde743
| @@ -201,7 +202,14 @@ extern "C" { | |||
| -> *const ::libc::c_void; | |||
| pub fn CreateWrapperProxyHandler(aTraps: *const ProxyTraps) | |||
| -> *const ::libc::c_void; | |||
| pub fn CreateServoJSPrincipal(origin: *const ::libc::c_void, | |||
| destroy: Option<*const ::libc::c_void>, | |||
| write: Option<bool>) | |||
This comment has been minimized.
This comment has been minimized.
jdm
Apr 18, 2017
Member
The destroy and write arguments don't match the C types. See the ones in ProxyTypes for good models.
This comment has been minimized.
This comment has been minimized.
|
Annoying bikeshedding... is |
|
RustJSPrincipal would be fine. |
|
Squash and r=me. |
added null checks to write/destroy jsprincipal functions fixed function callbacks and changed name to be less Servo specific
|
r=@jdm |
|
@bors-servo r=jdm |
|
|
added servojsprincipal skeleton Cross origin wrappers (servo/servo#16501) require JSPrincipals. This PR adds the skeleton and basic functionality required. CC: @jdm <!-- 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/353) <!-- Reviewable:end -->
|
|
Eventually, it should be for general SM embedding. There is a fair amount of work that needs to happen to make this a reality after the bindings land in m-c, still. A lot of the generic GC-related infrastructure is in Servo's dom component, for example. |
avadacatavra commentedApr 18, 2017
•
edited by larsbergstrom
Cross origin wrappers (servo/servo#16501) require JSPrincipals. This PR adds the skeleton and basic functionality required.
CC: @jdm
This change is