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 upWIP smup #17143
WIP smup #17143
Conversation
|
|
|
Fixed some issues in CodegenRust.py causing bad |
|
Ok, fixed some more things to do with proxies, which upstream SpiderMonkey had changed where expandos and private objects are stored and I got subtly wrong when rebasing. New dom WPT results are pretty close to passing:
|
|
No more crashes!
|
|
Seems like the timeouts and unexpected results were because I was using a
|
f4aefda
to
ecde05f
|
Huh, autospider is requiring gcc 4.9 or newer, and travis CI uses 4.8.4... |
|
|
|
All pretty minor changes that I've suggested. |
| pub fn leak_as_static<T>(t: T) -> &'static T { | ||
| let boxed = Box::new(t); | ||
| let ptr = &*boxed as *const T; | ||
| mem::forget(boxed); |
This comment has been minimized.
This comment has been minimized.
| if descriptor.weakReferenceable: | ||
| create += """ | ||
| JS_SetReservedSlot(obj.get(), DOM_WEAK_SLOT, PrivateValue(ptr::null()));""" | ||
| jsapi::JS_SetReservedSlot(obj.get(), DOM_WEAK_SLOT, &PrivateValue(ptr::null()) as *const _);""" |
This comment has been minimized.
This comment has been minimized.
| JS_SetReservedSlot(prototype.get(), DOM_PROTO_UNFORGEABLE_HOLDER_SLOT, | ||
| ObjectValue(unforgeable_holder.get()))""")) | ||
| jsapi::JS_SetReservedSlot(prototype.get(), DOM_PROTO_UNFORGEABLE_HOLDER_SLOT, | ||
| &ObjectValue(unforgeable_holder.get()) as *const _)""")) |
This comment has been minimized.
This comment has been minimized.
| unsafe extern "C" fn(*mut jsapi::JSContext, | ||
| jsapi::JS::HandleObject, | ||
| _, | ||
| _) -> bool) }, |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
fitzgen
Sep 20, 2017
Author
Member
It's there to change the *const ActualType parameter into a *const std::os::raw::c_void. Upon reflection this is better done with as.
This comment has been minimized.
This comment has been minimized.
fitzgen
Sep 20, 2017
Author
Member
hmmm nevermind, as doesn't work here:
error[E0605]: non-primitive cast: `unsafe extern "C" fn(*mut js::jsapi::JSContext, js::jsapi::JS::Handle<*mut js::jsapi::JSObject>, *const dom::xmlhttprequesteventtarget::XMLHttpRequestEventTarget, js::jsapi::JSJitSetterCallArgs) -> bool {dom::bindings::codegen::Bindings::XMLHttpRequestEventTargetBinding::XMLHttpRequestEventTargetBinding::set_onloadend}` as `unsafe extern "C" fn(*mut js::jsapi::JSContext, js::jsapi::JS::Handle<*mut js::jsapi::JSObject>, *mut std::os::raw::c_void, *const js::jsapi::JSJitMethodCallArgs) -> bool`
--> /home/fitzgen/servo/target/debug/build/script-11a815433a47bb39/out/Bindings/XMLHttpRequestEventTargetBinding.rs:885:22
|
885 | method: Some(set_onloadend as
| ______________________^
886 | | unsafe extern "C" fn(*mut jsapi::JSContext,
887 | | jsapi::JS::Handle<*mut jsapi::JSObject>,
888 | | _,
889 | | _) -> bool),
| |___________________________________________^
|
= note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
| @@ -23,7 +23,7 @@ | |||
| //! | DOMString | `DOMString` | | |||
| //! | USVString | `USVString` | | |||
| //! | ByteString | `ByteString` | | |||
| //! | object | `*mut JSObject` | | |||
| //! | object | `*mut jsapi::JSObject` | | |||
This comment has been minimized.
This comment has been minimized.
| let proto_array = PrivateValue(Box::into_raw(proto_array) as *const libc::c_void); | ||
| jsapi::JS_SetReservedSlot(rval.get(), | ||
| DOM_PROTOTYPE_SLOT, | ||
| &proto_array as *const _); |
This comment has been minimized.
This comment has been minimized.
| @@ -60,7 +60,8 @@ pub trait WeakReferenceable: DomObject + Sized { | |||
| count: Cell::new(1), | |||
| value: Cell::new(Some(NonZero::new(self))), | |||
| }); | |||
| JS_SetReservedSlot(object, DOM_WEAK_SLOT, PrivateValue(ptr as *const c_void)); | |||
| let ptr = PrivateValue(ptr as *const c_void); | |||
| jsapi::JS_SetReservedSlot(object, DOM_WEAK_SLOT, &ptr as *const _); | |||
This comment has been minimized.
This comment has been minimized.
| @@ -123,10 +114,11 @@ impl WindowProxy { | |||
|
|
|||
| // The window proxy owns the browsing context. | |||
| // When we finalize the window proxy, it drops the browsing context it owns. | |||
| SetProxyExtra(js_proxy.get(), 0, &PrivateValue((&*window_proxy).as_void_ptr())); | |||
| let private = js::jsval::PrivateValue((&*window_proxy).as_void_ptr()); | |||
| SetProxyReservedSlot(js_proxy.get(), 0, &private as *const _); | |||
This comment has been minimized.
This comment has been minimized.
| @@ -159,19 +151,19 @@ impl WindowProxy { | |||
| let window = DissimilarOriginWindow::new(global_to_clone_from, &*window_proxy); | |||
| let window_jsobject = window.reflector().get_jsobject(); | |||
| assert!(!window_jsobject.get().is_null()); | |||
| assert!(((*get_object_class(window_jsobject.get())).flags & JSCLASS_IS_GLOBAL) != 0); | |||
| let _ac = JSAutoCompartment::new(cx, window_jsobject.get()); | |||
| assert!(((*js::rust::get_object_class(window_jsobject.get())).flags & jsapi::JSCLASS_IS_GLOBAL) != 0); | |||
This comment has been minimized.
This comment has been minimized.
| @@ -233,89 +229,84 @@ pub unsafe fn new_rt_and_cx() -> Runtime { | |||
| false | |||
| }; | |||
| let mode = if val { | |||
| JSGCMode::JSGC_MODE_INCREMENTAL | |||
| jsapi::JSGCMode::JSGC_MODE_INCREMENTAL | |||
| } else if compartment { | |||
This comment has been minimized.
This comment has been minimized.
|
|
|
Feedback addressed. Need to rebase again. Still blocked on windows stuff in servo/mozjs#119. |
|
Could you please revert all the qualified paths to |
|
Is anyone still working on that? |
|
@fabricedesre @asajeffrey is going to be resuming this work. |
|
I'm going to talk to @nox in Berlin about how to move forward; I'm happy to look at smup, but the problem is that I have approximately zero windows experience. |
|
@asajeffrey For Windows support I haven't much to say but "good luck". |
|
Er, thanks. |
|
Superseded. |
fitzgen commentedJun 2, 2017
•
edited by larsbergstrom
So this compiles and stuff, but not yet passing tests.
Here are the results of the DOM wpt, which I haven't started digging into yet:
This change is