Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0ce3133
implement basic internal slots, with todos
gterzian Jul 8, 2024
f2e23dd
enum for controller
gterzian Jul 9, 2024
0a298b7
re-implement native controller methods
gterzian Jul 9, 2024
0b6f761
add calling into pull algo
gterzian Jul 10, 2024
7ee16c2
more details on chunk enqueuing
gterzian Jul 10, 2024
46f9582
add fulfill read request, clean-up warnings
gterzian Jul 10, 2024
270b75d
read request and reader typing
gterzian Jul 10, 2024
34a5e9b
allow for more than one non-native underlying source type
gterzian Jul 10, 2024
089c3e6
add todo for should pull
gterzian Jul 11, 2024
84d52d9
add underlying source dom struct container
gterzian Jul 11, 2024
200a2ad
remove rc around source type
gterzian Jul 11, 2024
d26d95b
add default controller init in stream constructor
gterzian Jul 11, 2024
388cbdc
setup source container with prototype of source dict
gterzian Jul 12, 2024
b21adf5
clean-up docs, dispatch of controller in pull algo call
gterzian Jul 12, 2024
81e1793
turn off SM streams
gterzian Jul 12, 2024
545423c
remove prototype setting on underlying source container
gterzian Jul 12, 2024
94b7142
fix read request promise resolving
gterzian Jul 12, 2024
997259f
tidy
gterzian Jul 12, 2024
2d2513a
clean-up js conversions in read req handlers
gterzian Jul 12, 2024
24fcefc
add queue with sizes concept
gterzian Jul 15, 2024
09f1360
use dom in pull promise handlers
gterzian Jul 15, 2024
b65ba8d
Demonstrate using dictionary as callback this object.
jdm Jul 15, 2024
d02783b
move value with size to a struct
gterzian Jul 15, 2024
17d5862
fmt
gterzian Jul 15, 2024
a58fcb8
put readable stream state in a cell
gterzian Jul 15, 2024
b1488c0
nits in expectations
gterzian Jul 15, 2024
53a1051
remove allow unroot by passing read result directly to promise resolving
gterzian Jul 15, 2024
0befa08
tidy
gterzian Jul 15, 2024
79b7f15
root default controller inside call_pull_if_needed
gterzian Jul 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/script/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ image = { workspace = true }
indexmap = { workspace = true }
ipc-channel = { workspace = true }
itertools = { workspace = true }
js = { package = "mozjs", git = "https://github.com/servo/mozjs", features = ["streams"] }
js = { package = "mozjs", git = "https://github.com/servo/mozjs" }
jstraceable_derive = { path = "../jstraceable_derive" }
keyboard-types = { workspace = true }
lazy_static = { workspace = true }
Expand Down
26 changes: 23 additions & 3 deletions components/script/dom/bindings/callback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use js::jsapi::{
};
use js::jsval::{JSVal, ObjectValue, UndefinedValue};
use js::rust::wrappers::{JS_GetProperty, JS_WrapObject};
use js::rust::{MutableHandleObject, Runtime};
use js::rust::{HandleObject, MutableHandleObject, Runtime};

use crate::dom::bindings::codegen::Bindings::WindowBinding::Window_Binding::WindowMethods;
use crate::dom::bindings::error::{report_pending_exception, Error, Fallible};
Expand Down Expand Up @@ -206,9 +206,29 @@ impl CallbackInterface {
}
}

pub trait ThisReflector {
fn jsobject(&self) -> *mut JSObject;
}

impl<T: DomObject> ThisReflector for T {
fn jsobject(&self) -> *mut JSObject {
self.reflector().get_jsobject().get()
}
}

impl<'a> ThisReflector for HandleObject<'a> {
fn jsobject(&self) -> *mut JSObject {
self.get()
}
}

/// Wraps the reflector for `p` into the realm of `cx`.
pub fn wrap_call_this_object<T: DomObject>(cx: JSContext, p: &T, mut rval: MutableHandleObject) {
rval.set(p.reflector().get_jsobject().get());
pub fn wrap_call_this_object<T: ThisReflector>(
cx: JSContext,
p: &T,
mut rval: MutableHandleObject,
) {
rval.set(p.jsobject());
assert!(!rval.get().is_null());

unsafe {
Expand Down
2 changes: 1 addition & 1 deletion components/script/dom/bindings/codegen/CodegenRust.py
Original file line number Diff line number Diff line change
Expand Up @@ -7212,7 +7212,7 @@ def getMethodImpls(self, method):
})
return [ClassMethod(method.name + '_', method.returnType, args,
bodyInHeader=True,
templateArgs=["T: DomObject"],
templateArgs=["T: ThisReflector"],
body=bodyWithThis,
visibility='pub'),
ClassMethod(method.name + '__', method.returnType, argsWithoutThis,
Expand Down
2 changes: 1 addition & 1 deletion components/script/dom/bindings/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub mod base {

pub use crate::dom::bindings::callback::{
wrap_call_this_object, CallSetup, CallbackContainer, CallbackFunction, CallbackInterface,
CallbackObject, ExceptionHandling,
CallbackObject, ExceptionHandling, ThisReflector,
};
pub use crate::dom::bindings::codegen::Bindings::AudioNodeBinding::{
ChannelCountMode, ChannelCountModeValues, ChannelInterpretation,
Expand Down
1 change: 0 additions & 1 deletion components/script/dom/bindings/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ pub unsafe fn create_global_object(
let mut options = RealmOptions::default();
options.creationOptions_.traceGlobal_ = Some(trace);
options.creationOptions_.sharedMemoryAndAtomics_ = false;
options.creationOptions_.streams_ = true;
select_compartment(cx, &mut options);

let principal = ServoJSPrincipals::new(origin);
Expand Down
5 changes: 3 additions & 2 deletions components/script/dom/globalscope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,10 @@ use crate::dom::paintworkletglobalscope::PaintWorkletGlobalScope;
use crate::dom::performance::Performance;
use crate::dom::performanceobserver::VALID_ENTRY_TYPES;
use crate::dom::promise::Promise;
use crate::dom::readablestream::{ExternalUnderlyingSource, ReadableStream};
use crate::dom::readablestream::ReadableStream;
use crate::dom::serviceworker::ServiceWorker;
use crate::dom::serviceworkerregistration::ServiceWorkerRegistration;
use crate::dom::underlyingsourcecontainer::UnderlyingSourceType;
use crate::dom::window::Window;
use crate::dom::workerglobalscope::WorkerGlobalScope;
use crate::dom::workletglobalscope::WorkletGlobalScope;
Expand Down Expand Up @@ -2023,7 +2024,7 @@ impl GlobalScope {

let stream = ReadableStream::new_with_external_underlying_source(
self,
ExternalUnderlyingSource::Blob(size),
UnderlyingSourceType::Blob(size),
);

let recv = self.send_msg(file_id);
Expand Down
1 change: 1 addition & 0 deletions components/script/dom/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,7 @@ pub mod trackevent;
pub mod transitionevent;
pub mod treewalker;
pub mod uievent;
pub mod underlyingsourcecontainer;
pub mod url;
pub mod urlhelper;
pub mod urlsearchparams;
Expand Down
Loading