[seed] Add the gjs native module "window" for compatibility

commit 5adba6cbffd39fe9dea801e4974eb2282d4efae2
Author: Peter Rustler <peter rustler basyskom com>
Date:   Thu Dec 17 15:16:45 2015 +0000

    Add the gjs native module "window" for compatibility
    This adds an empty window object to the global namespace.
    Some JS gjs modules expect it to be there.

 libseed/seed-engine.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/libseed/seed-engine.c b/libseed/seed-engine.c
index 1341551..51dcae3 100644
--- a/libseed/seed-engine.c
+++ b/libseed/seed-engine.c
@@ -32,7 +32,10 @@
 JSObjectRef function_proto;
 JSObjectRef seed_obj_ref;
 JSObjectRef ARGV_obj_ref;
+JSObjectRef window_obj_ref;
 GQuark qname;
 GQuark qprototype;
@@ -111,6 +114,7 @@ seed_prepare_global_context (JSContextRef ctx)
   seed_object_set_property (ctx, global, "Seed", seed_obj_ref);
   seed_object_set_property (ctx, global, "ARGV", ARGV_obj_ref);
+  seed_object_set_property (ctx, global, "window", window_obj_ref);
   seed_object_set_property (ctx, global, "print", seed_print_ref);
   seed_object_set_property (ctx, global, "printerr", seed_printerr_ref);
@@ -1816,6 +1820,11 @@ seed_init_constrained_with_context_and_group (gint * argc,
   seed_object_set_property (eng->context, eng->global, "Seed", seed_obj_ref);
   JSValueProtect (eng->context, seed_obj_ref);
+  window_obj_ref = JSObjectMake (eng->context, NULL, NULL);
+  seed_object_set_property (eng->context, eng->global, "window", window_obj_ref);
+  JSValueProtect (eng->context, window_obj_ref);
   g_irepository_require (g_irepository_get_default (), "GObject", NULL, 0, 0);
   g_irepository_require (g_irepository_get_default (), "GIRepository",
                          NULL, 0, 0);

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