r9569 - helma-ng/trunk/modules

[email protected]
Newsgroups gmane.comp.java.helma.cvs
Message-ID <20090403101331.31B903D0D6@mia>
Author: hannes
Date: 2009-04-03 12:13:31 +0200 (Fri, 03 Apr 2009)
New Revision: 9569

Modified:
   helma-ng/trunk/modules/global.js
Log:
Fix bug that causes require() not to work across scopes.

Details at http://dev.helma.org/trac/helma/changeset/9569

Modified: helma-ng/trunk/modules/global.js
===================================================================
--- helma-ng/trunk/modules/global.js	2009-04-03 07:46:22 UTC (rev 9568)
+++ helma-ng/trunk/modules/global.js	2009-04-03 10:13:31 UTC (rev 9569)
@@ -15,7 +15,7 @@
         value: function(moduleName) {
             var module = getRhinoEngine().loadModule(getRhinoContext(), moduleName, this);
             var exports = module.exports;
-            if (!exports || !(exports instanceof Object)) {
+            if (!exports || typeof exports != "object") {
                 exports = {};
                 Object.defineProperty(module, "exports", { value: exports });
             }
@@ -162,8 +162,7 @@
      * Get the org.mozilla.javascript.Context associated with the current thread.
      */
     var getRhinoContext = function getRhinoContext() {
-        var Context = org.mozilla.javascript.Context;
-        return Context.getCurrentContext();
+        return org.mozilla.javascript.Context.getCurrentContext();
     };
 
     /**
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.