Yesterday was Labor Day, so we celebrated it by not working! Woohoo! Malisa is traveling back today, so I (Jeena) worked alone today.
Things we did:
- Promise in Fetch
- jdm is back! He rebased his promises branch! The rust compiler still panics instead of throwing error as it uses the older rust version, but that’s ok! I can work around it.
- It turns out there’s a lot more to do with implementing promise in
fetch
so I spent the day trying to understand what I need to do. Roughly, there are two things I can do:- figure out how to reject/resolve Promise in
fetch
.Promise::maybe_resolve_native
is probably a better choice thanPromise::maybe_resolve
because they take regular DOM objects. This seems partially dependent on the next thing. - implement
FetchResponseListener
infetch.rs
. This turns out to have a lot more pre-requisite infrastructure!fetch.rs
needs aFetchContext
struct that will store the intermediate fetch.XMLHttpRequest
is done very similarly tofetch
, so I should look into how XHR is implemented in Servo. How XHR implementsFetchResponseListener
is here.
- figure out how to reject/resolve Promise in
Things we learned:
- jdm drew a great diagram describing how
XMLHttpRequest
interacts with resource thread andXHRContext
- Promise doesn’t have to be rooted! Whaaaat. jdm says “Rc
would usually be unsafe but Promise is designed in such a way that it's safe, whereas Rooted would be incorrect." Whaaaat? I don't even understand! We'll find out the reason later...
TODO:
- Promise in Fetch
- make
FetchContext
struct -
Impl FetchResponseListener for FetchContext
(may require helper functions) - resolve/reject promise in fetch
- make