mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
script: make Error::to_jsval safe (#35411)
Signed-off-by: Stephen Muss <stephenmuss@gmail.com>
This commit is contained in:
parent
8486e585f5
commit
cb588bab6a
8 changed files with 41 additions and 64 deletions
|
@ -417,11 +417,10 @@ impl ReadableStream {
|
|||
|
||||
/// <https://streams.spec.whatwg.org/#readable-stream-error>
|
||||
/// Note: in other use cases this call happens via the controller.
|
||||
#[allow(unsafe_code)]
|
||||
pub(crate) fn error_native(&self, error: Error) {
|
||||
let cx = GlobalScope::get_cx();
|
||||
rooted!(in(*cx) let mut error_val = UndefinedValue());
|
||||
unsafe { error.to_jsval(*cx, &self.global(), error_val.handle_mut()) };
|
||||
error.to_jsval(cx, &self.global(), error_val.handle_mut());
|
||||
self.error(error_val.handle());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue