[gjs: 3/4] modules/internalLoader: Drop version map/check




commit 1d53bb83774d6a18f2383cf690f62dad8d4fbfaf
Author: Florian Müllner <fmuellner gnome org>
Date:   Wed Aug 4 15:35:39 2021 +0200

    modules/internalLoader: Drop version map/check
    
    The loader uses `gi.require()`, which already throws an exception
    when trying to import a different version than the one that is
    already loaded.

 modules/internal/loader.js | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)
---
diff --git a/modules/internal/loader.js b/modules/internal/loader.js
index 0d44f510..18793396 100644
--- a/modules/internal/loader.js
+++ b/modules/internal/loader.js
@@ -206,12 +206,6 @@ class ModuleLoader extends InternalModuleLoader {
 const moduleLoader = new ModuleLoader(moduleGlobalThis);
 setGlobalModuleLoader(moduleGlobalThis, moduleLoader);
 
-const giVersionMap = new Map([
-    ['GLib', '2.0'],
-    ['Gio', '2.0'],
-    ['GObject', '2.0'],
-]);
-
 /**
  * Creates a module source text to expose a GI namespace via a default export.
  *
@@ -233,16 +227,7 @@ moduleLoader.registerScheme('gi', {
      */
     load(uri) {
         const namespace = uri.host;
-        const alreadyLoadedVersion = giVersionMap.get(namespace);
-        const version = uri.query.version ?? alreadyLoadedVersion;
-
-        if (version) {
-            if (alreadyLoadedVersion !== undefined && version !== alreadyLoadedVersion) {
-                throw new ImportError(`Version ${alreadyLoadedVersion} of GI module ${
-                    namespace} already loaded, cannot load version ${version}`);
-            }
-            giVersionMap.set(namespace, version);
-        }
+        const version = uri.query.version;
 
         return [generateGIModule(namespace, version), true];
     },


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