mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
updated websocket buffered_amount to be u64 instead of u32
This commit is contained in:
parent
b26cd498c6
commit
20edf21352
2 changed files with 4 additions and 14 deletions
|
@ -15,7 +15,7 @@ interface WebSocket : EventTarget {
|
||||||
const unsigned short CLOSING = 2;
|
const unsigned short CLOSING = 2;
|
||||||
const unsigned short CLOSED = 3;
|
const unsigned short CLOSED = 3;
|
||||||
readonly attribute unsigned short readyState;
|
readonly attribute unsigned short readyState;
|
||||||
readonly attribute unsigned long bufferedAmount;
|
readonly attribute unsigned long long bufferedAmount;
|
||||||
|
|
||||||
//networking
|
//networking
|
||||||
attribute EventHandler onopen;
|
attribute EventHandler onopen;
|
||||||
|
|
|
@ -138,7 +138,7 @@ pub struct WebSocket {
|
||||||
url: Url,
|
url: Url,
|
||||||
global: GlobalField,
|
global: GlobalField,
|
||||||
ready_state: Cell<WebSocketRequestState>,
|
ready_state: Cell<WebSocketRequestState>,
|
||||||
buffered_amount: Cell<u32>,
|
buffered_amount: Cell<u64>,
|
||||||
clearing_buffer: Cell<bool>, //Flag to tell if there is a running task to clear buffered_amount
|
clearing_buffer: Cell<bool>, //Flag to tell if there is a running task to clear buffered_amount
|
||||||
#[ignore_heap_size_of = "Defined in std"]
|
#[ignore_heap_size_of = "Defined in std"]
|
||||||
sender: DOMRefCell<Option<IpcSender<WebSocketDomAction>>>,
|
sender: DOMRefCell<Option<IpcSender<WebSocketDomAction>>>,
|
||||||
|
@ -299,17 +299,7 @@ impl WebSocket {
|
||||||
let chan = global.r().networking_task_source();
|
let chan = global.r().networking_task_source();
|
||||||
let address = Trusted::new(self, chan.clone());
|
let address = Trusted::new(self, chan.clone());
|
||||||
|
|
||||||
let new_buffer_amount = (self.buffered_amount.get() as u64) + data_byte_len;
|
self.buffered_amount.set(self.buffered_amount.get() + data_byte_len);
|
||||||
if new_buffer_amount > (u32::max_value() as u64) {
|
|
||||||
self.buffered_amount.set(u32::max_value());
|
|
||||||
self.full.set(true);
|
|
||||||
|
|
||||||
let _ = self.Close(None, None);
|
|
||||||
return Ok(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
self.buffered_amount.set(new_buffer_amount as u32);
|
|
||||||
|
|
||||||
if return_after_buffer {
|
if return_after_buffer {
|
||||||
return Ok(false);
|
return Ok(false);
|
||||||
|
@ -353,7 +343,7 @@ impl WebSocketMethods for WebSocket {
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-websocket-bufferedamount
|
// https://html.spec.whatwg.org/multipage/#dom-websocket-bufferedamount
|
||||||
fn BufferedAmount(&self) -> u32 {
|
fn BufferedAmount(&self) -> u64 {
|
||||||
self.buffered_amount.get()
|
self.buffered_amount.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue