Commit 4019e76d 4019e76dbc07a508a862ac3f84688667574e8c4e by Nicolas Perriault

added the python-like __file__ variable available within modules

1 parent 34f47682
......@@ -205,9 +205,9 @@ phantom.loadCasper = function loadCasper() {
return requireCache[file].exports;
}
var scriptCode = phantom.getScriptCode(file);
var fn = new Function('require', 'module', 'exports', scriptCode);
var fn = new Function('__file__', 'require', 'module', 'exports', scriptCode);
try {
fn(_require, module, module.exports);
fn(file, _require, module, module.exports);
} catch (e) {
var error = new CasperError('__mod_error(' + path + '):: ' + e);
error.file = file;
......