From 76519b9c3161c6e17aff5d8d56c2657c7f11298c Mon Sep 17 00:00:00 2001 From: Mees Delzenne Date: Mon, 17 Jul 2023 17:31:50 +0200 Subject: [PATCH] Fix stub fetch functions (#2276) --- lib/src/fnc/script/fetch_stub/mod.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/src/fnc/script/fetch_stub/mod.rs b/lib/src/fnc/script/fetch_stub/mod.rs index e497e09a..66570b11 100644 --- a/lib/src/fnc/script/fetch_stub/mod.rs +++ b/lib/src/fnc/script/fetch_stub/mod.rs @@ -1,6 +1,6 @@ //! 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)] mod test; @@ -13,8 +13,7 @@ pub fn register(ctx: &Ctx<'_>) -> Result<()> { Class::::define(&globals)?; Class::::define(&globals)?; Class::::define(&globals)?; - globals.set("fetch", Function::new(ctx, js_fetch).with_name("fetch")); - Ok(()) + globals.set("fetch", Function::new(ctx.clone(), js_fetch)?.with_name("fetch")?) } #[js::function]