Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TIMOB-11307 3_0_X Android: Call runInContext with the the filename argument relatively path'd as re... #3281

Merged
merged 1 commit into from
Oct 18, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 4 additions & 5 deletions android/modules/ui/src/js/window.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,20 +352,19 @@ exports.bootstrapWindow = function(Titanium) {
bootstrap.bootstrapGlobals(context, Titanium);

var scriptPath = url.toAssetPath(resolvedUrl);
var relScriptPath = scriptPath.replace("Resources/", "");
var scriptSource = assets.readAsset(scriptPath);
var filename = 'app:///'+scriptPath.replace("Resources/", "");

// Setup require for the new window context.
var module = new kroll.Module(filename, this._module || kroll.Module.main, context);
var module = new kroll.Module("app:///" + relScriptPath, this._module || kroll.Module.main, context);
context.require = function(request, context) {
return module.require(request, context);
};

if (kroll.runtime == "v8") {
Script.runInContext(scriptSource, context, scriptPath, true);

Script.runInContext(scriptSource, context, relScriptPath, true);
} else {
Script.runInThisContext(scriptSource, scriptPath, true, context);
Script.runInThisContext(scriptSource, relScriptPath, true, context);
}
}

Expand Down