Adapt Servo for mozjs 0.6 and the changes introduced in servo/rust-mozjs#393

This commit is contained in:
Marcin Mielniczuk 2018-03-28 21:28:30 +02:00
parent e04d517bff
commit 356c57e628
48 changed files with 403 additions and 307 deletions

View file

@ -11,13 +11,17 @@ use dom::bindings::reflector::DomObject;
use dom::bindings::root::DomRoot;
use dom::blob::{Blob, BlobImpl};
use dom::globalscope::GlobalScope;
use js::jsapi::{Handle, HandleObject, HandleValue, MutableHandleValue, JSAutoCompartment, JSContext};
use js::jsapi::{JSAutoCompartment, JSContext};
use js::jsapi::{JSStructuredCloneCallbacks, JSStructuredCloneReader, JSStructuredCloneWriter};
use js::jsapi::{JS_ClearPendingException, JSObject, JS_ReadStructuredClone};
use js::jsapi::{JS_ClearPendingException, JSObject};
use js::jsapi::{JS_ReadBytes, JS_WriteBytes};
use js::jsapi::{JS_ReadUint32Pair, JS_WriteUint32Pair};
use js::jsapi::{JS_STRUCTURED_CLONE_VERSION, JS_WriteStructuredClone};
use js::jsapi::{MutableHandleObject, TransferableOwnership};
use js::jsapi::HandleObject as RawHandleObject;
use js::jsapi::JS_STRUCTURED_CLONE_VERSION;
use js::jsapi::MutableHandleObject as RawMutableHandleObject;
use js::jsapi::TransferableOwnership;
use js::rust::{Handle, HandleValue, MutableHandleValue};
use js::rust::wrappers::{JS_WriteStructuredClone, JS_ReadStructuredClone};
use libc::size_t;
use std::os::raw;
use std::ptr;
@ -137,10 +141,10 @@ unsafe extern "C" fn read_callback(cx: *mut JSContext,
unsafe extern "C" fn write_callback(_cx: *mut JSContext,
w: *mut JSStructuredCloneWriter,
obj: HandleObject,
obj: RawHandleObject,
_closure: *mut raw::c_void)
-> bool {
if let Ok(blob) = root_from_handleobject::<Blob>(obj) {
if let Ok(blob) = root_from_handleobject::<Blob>(Handle::from_raw(obj)) {
return write_blob(blob, w).is_ok()
}
return false
@ -152,13 +156,13 @@ unsafe extern "C" fn read_transfer_callback(_cx: *mut JSContext,
_content: *mut raw::c_void,
_extra_data: u64,
_closure: *mut raw::c_void,
_return_object: MutableHandleObject)
_return_object: RawMutableHandleObject)
-> bool {
false
}
unsafe extern "C" fn write_transfer_callback(_cx: *mut JSContext,
_obj: Handle<*mut JSObject>,
_obj: RawHandleObject,
_closure: *mut raw::c_void,
_tag: *mut u32,
_ownership: *mut TransferableOwnership,