mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
fix: ReadableStream::get_in_memory_bytes
too large (#36914)
Fix a IPC hang due to `ReadableStream::get_in_memory_bytes` could return really huge chunk. Testing: WPT on ReadableStream should pass Fixes: IPC hang when transferring huge chunk bytes from `ReadableStream` cc @gterzian @Taym95 since this is also related to ReadableStream. --------- Signed-off-by: Yu Wei Wu <yuweiwu@YunoMacBook-Air.local> Co-authored-by: Yu Wei Wu <yuweiwu@YunoMacBook-Air.local>
This commit is contained in:
parent
c37d5572fd
commit
aa4ad0f2be
5 changed files with 29 additions and 20 deletions
|
@ -31,7 +31,7 @@ use http::{HeaderName, Method, StatusCode};
|
|||
use http_body_util::combinators::BoxBody;
|
||||
use hyper::body::{Body, Bytes, Incoming};
|
||||
use hyper::{Request as HyperRequest, Response as HyperResponse};
|
||||
use ipc_channel::ipc;
|
||||
use ipc_channel::ipc::{self, IpcSharedMemory};
|
||||
use ipc_channel::router::ROUTER;
|
||||
use net::cookie::ServoCookie;
|
||||
use net::cookie_storage::CookieStorage;
|
||||
|
@ -100,7 +100,7 @@ pub fn expect_devtools_http_response(
|
|||
}
|
||||
}
|
||||
|
||||
fn create_request_body_with_content(content: Vec<u8>) -> RequestBody {
|
||||
fn create_request_body_with_content(content: IpcSharedMemory) -> RequestBody {
|
||||
let content_len = content.len();
|
||||
|
||||
let (chunk_request_sender, chunk_request_receiver) = ipc::channel().unwrap();
|
||||
|
@ -592,7 +592,7 @@ fn test_load_doesnt_send_request_body_on_any_redirect() {
|
|||
let (pre_server, pre_url) = make_server(pre_handler);
|
||||
|
||||
let content = b"Body on POST!";
|
||||
let request_body = create_request_body_with_content(content.to_vec());
|
||||
let request_body = create_request_body_with_content(IpcSharedMemory::from_bytes(content));
|
||||
|
||||
let request = RequestBuilder::new(None, pre_url.clone(), Referrer::NoReferrer)
|
||||
.body(Some(request_body))
|
||||
|
@ -904,7 +904,7 @@ fn test_load_sets_content_length_to_length_of_request_body() {
|
|||
};
|
||||
let (server, url) = make_server(handler);
|
||||
|
||||
let request_body = create_request_body_with_content(content.to_vec());
|
||||
let request_body = create_request_body_with_content(IpcSharedMemory::from_bytes(content));
|
||||
|
||||
let request = RequestBuilder::new(None, url.clone(), Referrer::NoReferrer)
|
||||
.method(Method::POST)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue