mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
ReadableStream: remove the use of get_js_stream and use DomRoot<ReadableStream> (#34836)
* Remove the use of get_js_stream and use DomRoot<ReadableStream> Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> * return an error instead of Option Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com> --------- Signed-off-by: Taym Haddadi <haddadi.taym@gmail.com>
This commit is contained in:
parent
15eb405f36
commit
bcad0d50e9
9 changed files with 43 additions and 52 deletions
|
@ -2,7 +2,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use std::ptr::NonNull;
|
||||
use std::rc::Rc;
|
||||
use std::str::FromStr;
|
||||
|
||||
|
@ -11,7 +10,6 @@ use dom_struct::dom_struct;
|
|||
use http::header::{HeaderName, HeaderValue};
|
||||
use http::method::InvalidMethod;
|
||||
use http::Method as HttpMethod;
|
||||
use js::jsapi::JSObject;
|
||||
use js::rust::HandleObject;
|
||||
use net_traits::fetch::headers::is_forbidden_method;
|
||||
use net_traits::request::{
|
||||
|
@ -40,7 +38,7 @@ use crate::dom::globalscope::GlobalScope;
|
|||
use crate::dom::headers::{Guard, Headers};
|
||||
use crate::dom::promise::Promise;
|
||||
use crate::dom::readablestream::ReadableStream;
|
||||
use crate::script_runtime::{CanGc, JSContext as SafeJSContext};
|
||||
use crate::script_runtime::CanGc;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct Request {
|
||||
|
@ -598,8 +596,8 @@ impl RequestMethods<crate::DomTypeHolder> for Request {
|
|||
}
|
||||
|
||||
/// <https://fetch.spec.whatwg.org/#dom-body-body>
|
||||
fn GetBody(&self, _cx: SafeJSContext) -> Option<NonNull<JSObject>> {
|
||||
self.body().map(|stream| stream.get_js_stream())
|
||||
fn GetBody(&self) -> Option<DomRoot<ReadableStream>> {
|
||||
self.body()
|
||||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#dom-body-bodyused
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue