Fix stub fetch functions (#2276)

This commit is contained in:
Mees Delzenne 2023-07-17 17:31:50 +02:00 committed by GitHub
parent c9414a1165
commit 76519b9c31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,6 +1,6 @@
//! stub implementations for the fetch API when `http` is not enabled. //! stub implementations for the fetch API when `http` is not enabled.
use js::{class::Trace, Class, Ctx, Exception, Result}; use js::{class::Trace, Class, Ctx, Exception, Function, Result};
#[cfg(test)] #[cfg(test)]
mod test; mod test;
@ -13,8 +13,7 @@ pub fn register(ctx: &Ctx<'_>) -> Result<()> {
Class::<blob::Blob>::define(&globals)?; Class::<blob::Blob>::define(&globals)?;
Class::<form_data::FormData>::define(&globals)?; Class::<form_data::FormData>::define(&globals)?;
Class::<headers::Headers>::define(&globals)?; Class::<headers::Headers>::define(&globals)?;
globals.set("fetch", Function::new(ctx, js_fetch).with_name("fetch")); globals.set("fetch", Function::new(ctx.clone(), js_fetch)?.with_name("fetch")?)
Ok(())
} }
#[js::function] #[js::function]