-
Philip Chimento authored
In order to more easily create global objects, we refactor code that deals with them into gjs/global.cpp and gjs/global.h. Previously global objects were set up partly in gjs_context_constructed() and partly in gjs_init_context_standard(); we disentangle that code and move everything dealing with setting up the GjsContext into gjs_context_constructed(), while global object setup moves to gjs_create_global_object(). Since global objects all share the same root importer, we must split the setup into two. Creating the root importer is the responsibility of gjs_context_constructed(), and it requires that the first global has been created. After creating the root importer, the global object is finished with gjs_define_global_properties(). In the case of global objects beyond the first, such as the global object for the coverage compartment, gjs_define_global_properties() will also wrap the root importer in a cross-compartment wrapper so that the new global can access it. https://bugzilla.gnome.org/show_bug.cgi?id=781429
2a38e4ae