Skip to content
This repository was archived by the owner on Nov 12, 2022. It is now read-only.

Commit 3f1feac

Browse files
committed
Update SpiderMonkey (WIP)
1 parent eb411fc commit 3f1feac

11 files changed

+360
-380
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,4 @@ lazy_static = "1"
5353
libc = "0.2"
5454
log = "0.4"
5555
num-traits = "0.2"
56-
mozjs_sys = { git = "https://github.com/servo/mozjs", rev = "bc4935b668171863e537d3fb0d911001a6742013" }
56+
mozjs_sys = { git = "https://github.com/servo/mozjs", rev = "8ed3c4301df6377f97387d0b7571d3a73d3d4d7e" }

src/generate_wrappers.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ grep_heur() {
2323
sed 's/Handle<\*mut JSObject>/HandleObject/g'
2424
}
2525

26-
grep_heur ../target/debug/build/mozjs_sys-*/out/jsapi.rs | sed 's/\(.*\)/wrap!(jsapi: \1);/g' > jsapi_wrappers.in
26+
grep_heur ../target/debug/build/mozjs_sys-*/out/build/jsapi.rs | sed 's/\(.*\)/wrap!(jsapi: \1);/g' > jsapi_wrappers.in
2727
grep_heur glue.rs | sed 's/\(.*\)/wrap!(glue: \1);/g' > glue_wrappers.in

src/glue.rs

+14-22
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub struct ProxyTraps {
4848
pub ownPropertyKeys: ::std::option::Option<unsafe extern "C" fn
4949
(cx: *mut JSContext,
5050
proxy: HandleObject,
51-
props: *mut AutoIdVector)
51+
props: MutableHandleIdVector)
5252
-> bool>,
5353
pub delete_: ::std::option::Option<unsafe extern "C" fn
5454
(cx: *mut JSContext,
@@ -58,7 +58,7 @@ pub struct ProxyTraps {
5858
pub enumerate: ::std::option::Option<unsafe extern "C" fn
5959
(cx: *mut JSContext,
6060
proxy: HandleObject,
61-
props: *mut AutoIdVector)
61+
props: MutableHandleIdVector)
6262
-> bool>,
6363
pub getPrototypeIfOrdinary: ::std::option::Option<unsafe extern "C" fn
6464
(cx: *mut JSContext,
@@ -109,7 +109,7 @@ pub struct ProxyTraps {
109109
proxy:
110110
HandleObject,
111111
props:
112-
*mut AutoIdVector)
112+
MutableHandleIdVector)
113113
-> bool>,
114114
pub nativeCall: ::std::option::Option<unsafe extern "C" fn
115115
(cx: *mut JSContext,
@@ -211,16 +211,6 @@ extern "C" {
211211
-> *const ::libc::c_void;
212212
pub fn CreateWrapperProxyHandler(aTraps: *const ProxyTraps)
213213
-> *const ::libc::c_void;
214-
pub fn CreateRustJSPrincipal(origin: *const ::libc::c_void,
215-
destroy: Option<unsafe extern "C" fn
216-
(principal: *mut JSPrincipals)>,
217-
write: Option<unsafe extern "C" fn
218-
(cx: *mut JSContext,
219-
writer: *mut JSStructuredCloneWriter)
220-
-> bool>)
221-
-> *mut JSPrincipals;
222-
pub fn GetPrincipalOrigin(principal: *const JSPrincipals)
223-
-> *const ::libc::c_void;
224214
pub fn GetCrossCompartmentWrapper() -> *const ::libc::c_void;
225215
pub fn GetSecurityWrapper() -> *const ::libc::c_void;
226216
pub fn NewCompileOptions(aCx: *mut JSContext, aFile: *const ::libc::c_char,
@@ -240,7 +230,7 @@ extern "C" {
240230
pub fn NewWindowProxy(aCx: *mut JSContext, aObj: HandleObject,
241231
aHandler: *const ::libc::c_void)
242232
-> *mut JSObject;
243-
pub fn GetWindowProxyClass() -> *const Class;
233+
pub fn GetWindowProxyClass() -> *const JSClass;
244234
pub fn GetProxyReservedSlot(obj: *mut JSObject, slot: u32, dest: *mut JS::Value);
245235
pub fn GetProxyPrivate(obj: *mut JSObject, dest: *mut JS::Value);
246236
pub fn SetProxyReservedSlot(obj: *mut JSObject, slot: u32, val: *const JS::Value);
@@ -269,15 +259,17 @@ extern "C" {
269259
pub fn UnwrapObjectStatic(obj: *mut JSObject) -> *mut JSObject;
270260
pub fn UnwrapObjectDynamic(obj: *mut JSObject, cx: *mut JSContext, stopAtOuter: u8) -> *mut JSObject;
271261
pub fn UncheckedUnwrapObject(obj: *mut JSObject, stopAtOuter: u8) -> *mut JSObject;
272-
pub fn CreateAutoIdVector(cx: *mut JSContext) -> *mut AutoIdVector;
273-
pub fn AppendToAutoIdVector(v: *mut AutoIdVector, id: HandleId) -> bool;
274-
pub fn SliceAutoIdVector(v: *const AutoIdVector, length: *mut usize) -> *const jsid;
275-
pub fn DestroyAutoIdVector(v: *mut AutoIdVector);
276-
pub fn CreateAutoObjectVector(aCx: *mut JSContext)
277-
-> *mut AutoObjectVector;
278-
pub fn AppendToAutoObjectVector(v: *mut AutoObjectVector,
262+
pub fn CreateRootedIdVector(cx: *mut JSContext) -> *mut PersistentRootedIdVector;
263+
pub fn GetMutableHandleIdVector(v: *mut PersistentRootedIdVector) -> MutableHandleIdVector;
264+
pub fn SliceRootedIdVector(v: *const PersistentRootedIdVector, length: *mut usize) -> *const jsid;
265+
pub fn AppendToIdVector(v: MutableHandleIdVector, id: HandleId) -> bool;
266+
pub fn DestroyRootedIdVector(v: *mut PersistentRootedIdVector);
267+
pub fn CreateRootedObjectVector(aCx: *mut JSContext)
268+
-> *mut PersistentRootedObjectVector;
269+
pub fn AppendToRootedObjectVector(v: *mut PersistentRootedObjectVector,
279270
obj: *mut JSObject) -> bool;
280-
pub fn DeleteAutoObjectVector(v: *mut AutoObjectVector);
271+
pub fn GetHandleObjectVector(v: *mut PersistentRootedObjectVector) -> HandleObjectVector;
272+
pub fn DeleteRootedObjectVector(v: *mut PersistentRootedObjectVector);
281273
pub fn CollectServoSizes(cx: *mut JSContext, sizes: *mut ServoSizes, get_size: Option<unsafe extern "C" fn (obj: *mut JSObject) -> usize>) -> bool;
282274
pub fn InitializeMemoryReporter(want_to_measure: Option<unsafe extern "C" fn (obj: *mut JSObject) -> bool>);
283275
pub fn CallIdTracer(trc: *mut JSTracer, idp: *mut Heap<jsid>,

src/glue_wrappers.in

+5-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@ wrap!(glue: pub fn WrapperNew(aCx: *mut JSContext, aObj: HandleObject, aHandler:
88
wrap!(glue: pub fn NewWindowProxy(aCx: *mut JSContext, aObj: HandleObject, aHandler: *const ::libc::c_void) -> *mut JSObject);
99
wrap!(glue: pub fn RUST_JSID_IS_INT(id: HandleId) -> bool);
1010
wrap!(glue: pub fn RUST_JSID_TO_INT(id: HandleId) -> i32);
11+
wrap!(glue: pub fn int_to_jsid(i: i32, id: MutableHandleId));
1112
wrap!(glue: pub fn RUST_JSID_IS_STRING(id: HandleId) -> bool);
1213
wrap!(glue: pub fn RUST_JSID_TO_STRING(id: HandleId) -> *mut JSString);
1314
wrap!(glue: pub fn RUST_SYMBOL_TO_JSID(sym: *mut Symbol, id: MutableHandleId));
14-
wrap!(glue: pub fn int_to_jsid(i: i32, id: MutableHandleId));
15+
wrap!(glue: pub fn RUST_JSID_IS_VOID(id: HandleId) -> bool);
1516
wrap!(glue: pub fn RUST_INTERNED_STRING_TO_JSID(cx: *mut JSContext, str: *mut JSString, id: MutableHandleId));
16-
wrap!(glue: pub fn AppendToAutoIdVector(v: *mut AutoIdVector, id: HandleId) -> bool);
17+
wrap!(glue: pub fn GetMutableHandleIdVector(v: *mut PersistentRootedIdVector) -> MutableHandleIdVector);
18+
wrap!(glue: pub fn AppendToIdVector(v: MutableHandleIdVector, id: HandleId) -> bool);
19+
wrap!(glue: pub fn GetHandleObjectVector(v: *mut PersistentRootedObjectVector) -> HandleObjectVector);
1720
wrap!(glue: pub fn JS_GetPromiseResult (promise: HandleObject, dest: MutableHandleValue));
1821
wrap!(glue: pub fn EncodeStringToUTF8(cx: *mut JSContext, str: HandleString, cb: fn(*const c_char)));

0 commit comments

Comments
 (0)