Update to make the resolve context extend the global object
diff --git a/bundles/org.eclipse.e4.languages.javascript.framework/scripts/Bundle.js b/bundles/org.eclipse.e4.languages.javascript.framework/scripts/Bundle.js
index 2d6ce1e..022bfb4 100644
--- a/bundles/org.eclipse.e4.languages.javascript.framework/scripts/Bundle.js
+++ b/bundles/org.eclipse.e4.languages.javascript.framework/scripts/Bundle.js
@@ -271,16 +271,18 @@
var parameterStatement = parameterNames.join(",");
var returnStatement = "\n\nreturn {" + exportNames.join(",") + "};";
- var that = this;
- var loader = {
- getResources: function(path) {
- return that.getResources(path);
- }
- };
-
var finalScript = this._script + returnStatement;
var load = new Function(parameterStatement, finalScript);
- this._scope = load.apply(loader, parameterValues);
+
+ var that = this;
+ var _ResourceWrapper = function() {
+ this.getResources = function(path) {
+ return that.getResources(path);
+ };
+ };
+ _ResourceWrapper.prototype = orion.global;
+ var context = new _ResourceWrapper();
+ this._scope = load.apply(context, parameterValues);
},
_unresolve : function() {
if (this._state == orion.Bundle.ACTIVE) {
diff --git a/bundles/org.eclipse.e4.languages.javascript.framework/scripts/__global.js b/bundles/org.eclipse.e4.languages.javascript.framework/scripts/__global.js
index 33c273a..486b9df 100644
--- a/bundles/org.eclipse.e4.languages.javascript.framework/scripts/__global.js
+++ b/bundles/org.eclipse.e4.languages.javascript.framework/scripts/__global.js
@@ -1 +1,2 @@
var orion = orion || {};
+orion.global = this;