Defines the empty module as a property on the importer
| 93 | |
| 94 | // Defines the empty module as a property on the importer |
| 95 | GJS_JSAPI_RETURN_CONVENTION |
| 96 | bool define_import(JSContext* cx, JS::HandleObject module, |
| 97 | JS::HandleObject importer, JS::HandleId name) const { |
| 98 | if (!JS_DefinePropertyById(cx, importer, name, module, |
| 99 | GJS_MODULE_PROP_FLAGS & ~JSPROP_PERMANENT)) { |
| 100 | gjs_debug(GJS_DEBUG_IMPORTER, "Failed to define '%s' in importer", |
| 101 | m_name.get()); |
| 102 | return false; |
| 103 | } |
| 104 | |
| 105 | return true; |
| 106 | } |
| 107 | |
| 108 | // Carries out the actual execution of the module code |
| 109 | GJS_JSAPI_RETURN_CONVENTION |