Conversation
|
☔ The latest upstream changes (presumably #17104) made this pull request unmergeable. Please resolve the merge conflicts. |
|
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
Compare
|
Huh, autospider is requiring gcc 4.9 or newer, and travis CI uses 4.8.4... |
|
☔ The latest upstream changes (presumably #17472) made this pull request unmergeable. Please resolve the merge conflicts. |
jdm
left a comment
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
let ptr = Box::into_raw(Box::new(t));
| 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 _);""" |
| 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 _)""")) |
| unsafe extern "C" fn(*mut jsapi::JSContext, | ||
| jsapi::JS::HandleObject, | ||
| _, | ||
| _) -> bool) }, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
| //! | USVString | `USVString` | | ||
| //! | ByteString | `ByteString` | | ||
| //! | object | `*mut JSObject` | | ||
| //! | object | `*mut jsapi::JSObject` | |
There was a problem hiding this comment.
nit: the alignment in this table is now off.
| 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 _); |
| }); | ||
| 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 _); |
| // 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 _); |
components/script/dom/windowproxy.rs
Outdated
| 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); |
There was a problem hiding this comment.
Perhaps we should use the new helper that was added for this.
components/script/script_runtime.rs
Outdated
| let mode = if val { | ||
| JSGCMode::JSGC_MODE_INCREMENTAL | ||
| jsapi::JSGCMode::JSGC_MODE_INCREMENTAL | ||
| } else if compartment { |
|
☔ The latest upstream changes (presumably #18361) made this pull request unmergeable. Please resolve the merge conflicts. |
|
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. |
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