(
&mut self,
ctx: &Ctx<'js>,
value: Value<'js>,
size: SizeValue<'js>,
)
| 21 | } |
| 22 | |
| 23 | pub(crate) fn enqueue_value_with_size( |
| 24 | &mut self, |
| 25 | ctx: &Ctx<'js>, |
| 26 | value: Value<'js>, |
| 27 | size: SizeValue<'js>, |
| 28 | ) -> Result<()> { |
| 29 | let size = match is_non_negative_number(size) { |
| 30 | None => { |
| 31 | // If ! IsNonNegativeNumber(size) is false, throw a RangeError exception. |
| 32 | return Err(Exception::throw_range( |
| 33 | ctx, |
| 34 | "Size must be a finite, non-NaN, non-negative number.", |
| 35 | )); |
| 36 | }, |
| 37 | Some(size) => size, |
| 38 | }; |
| 39 | |
| 40 | // If size is +∞, throw a RangeError exception. |
| 41 | if size.is_infinite() { |
| 42 | return Err(Exception::throw_range( |
| 43 | ctx, |
| 44 | "Size must be a finite, non-NaN, non-negative number.", |
| 45 | )); |
| 46 | }; |
| 47 | |
| 48 | // Append a new value-with-size with value value and size size to container.[[queue]]. |
| 49 | self.queue.push_back(ValueWithSize { value, size }); |
| 50 | |
| 51 | // Set container.[[queueTotalSize]] to container.[[queueTotalSize]] + size. |
| 52 | self.queue_total_size += size; |
| 53 | |
| 54 | Ok(()) |
| 55 | } |
| 56 | |
| 57 | pub fn dequeue_value(&mut self) -> Value<'js> { |
| 58 | // Let valueWithSize be container.[[queue]][0]. |
no test coverage detected