[gjs/mozjs102: 43/62] global: Combine compilation and execution in bootstratp




commit 0cbbf53cbda87b761dffc2b697a1af5248c392dc
Author: Philip Chimento <philip chimento gmail com>
Date:   Fri Jul 22 12:13:41 2022 -0700

    global: Combine compilation and execution in bootstratp
    
    I think the compilation and execution were previously split because the
    API for doing both with UTF-8 source didn't work. However, it works now.
    This is a good time to fix this workaround because
    JS::CloneAndExecuteScript() is disappearing in mozjs102.

 gjs/global.cpp | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
---
diff --git a/gjs/global.cpp b/gjs/global.cpp
index dae759cf7..9c2c91eb1 100644
--- a/gjs/global.cpp
+++ b/gjs/global.cpp
@@ -107,12 +107,8 @@ class GjsBaseGlobal {
                          JS::SourceOwnership::TakeOwnership))
             return false;
 
-        JS::RootedScript compiled_script(cx, JS::Compile(cx, options, source));
-        if (!compiled_script)
-            return false;
-
         JS::RootedValue ignored(cx);
-        return JS::CloneAndExecuteScript(cx, compiled_script, &ignored);
+        return JS::Evaluate(cx, options, source, &ignored);
     }
 
     GJS_JSAPI_RETURN_CONVENTION


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]