mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
integrate readablestream with fetch and blob
This commit is contained in:
parent
0281acea95
commit
bd5796c90b
74 changed files with 2219 additions and 899 deletions
|
@ -7,13 +7,14 @@ use crate::dom::bindings::root::DomRoot;
|
|||
use crate::dom::bindings::trace::JSTraceable;
|
||||
use crate::dom::globalscope::GlobalScope;
|
||||
use crate::realms::InRealm;
|
||||
use crate::script_runtime::JSContext as SafeJSContext;
|
||||
use dom_struct::dom_struct;
|
||||
use js::jsapi::JSContext;
|
||||
use js::rust::HandleValue;
|
||||
use malloc_size_of::MallocSizeOf;
|
||||
|
||||
pub trait Callback: JSTraceable + MallocSizeOf {
|
||||
fn callback(&self, cx: *mut JSContext, v: HandleValue, realm: InRealm);
|
||||
fn callback(&self, cx: SafeJSContext, v: HandleValue, realm: InRealm);
|
||||
}
|
||||
|
||||
#[dom_struct]
|
||||
|
@ -39,12 +40,14 @@ impl PromiseNativeHandler {
|
|||
)
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
fn callback(
|
||||
callback: &Option<Box<dyn Callback>>,
|
||||
cx: *mut JSContext,
|
||||
v: HandleValue,
|
||||
realm: InRealm,
|
||||
) {
|
||||
let cx = unsafe { SafeJSContext::from_ptr(cx) };
|
||||
if let Some(ref callback) = *callback {
|
||||
callback.callback(cx, v, realm)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue