[gjs/wip/require: 2/7] bootstrap: Hack up the new imports so that it coexists with our old one



commit bf58a7f0d55a1221abd4e5bc3500ba86a95a5dc4
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Jun 17 16:06:07 2015 -0700

    bootstrap: Hack up the new imports so that it coexists with our old one
    
    We need to make sure that native modules are only registered once. For
    now, that means going through the old imports system.

 modules/bootstrap.js |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/modules/bootstrap.js b/modules/bootstrap.js
index 5f62330..cfca99b 100644
--- a/modules/bootstrap.js
+++ b/modules/bootstrap.js
@@ -10,7 +10,16 @@
     _exports['gi/__gjsPrivateNS'] = {};
 
     function loadNativeModule(moduleID) {
-        _exports[moduleID] = importNativeModule(moduleID);
+        // _exports[moduleID] = importNativeModule(moduleID);
+
+        // XXX: In order to not double-register modules, we need
+        // to do this. As soon as we implement the importer on
+        // top of the new system, revert this.
+
+        try {
+            _exports[moduleID] = imports[moduleID];
+        } catch(e) {
+        }
     }
 
     function runOverridesForGIModule(module, moduleID) {


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