/usr/lib/nodejs/contextify/contextifyjs.js is in node-contextify 0.1.6-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | var binding = require('./contextify');
var ContextifyContext = binding.ContextifyContext;
var ContextifyScript = binding.ContextifyScript;
function Contextify (sandbox) {
if (typeof sandbox != 'object') {
sandbox = {};
}
var ctx = new ContextifyContext(sandbox);
sandbox.run = function () {
return ctx.run.apply(ctx, arguments);
};
sandbox.getGlobal = function () {
return ctx.getGlobal();
}
sandbox.dispose = function () {
sandbox.run = function () {
throw new Error("Called run() after dispose().");
};
sandbox.getGlobal = function () {
throw new Error("Called getGlobal() after dispose().");
};
sandbox.dispose = function () {
throw new Error("Called dispose() after dispose().");
};
ctx = null;
}
return sandbox;
}
Contextify.createContext = function (sandbox) {
if (typeof sandbox != 'object') {
sandbox = {};
}
return new ContextifyContext(sandbox);
};
Contextify.createScript = function (code, filename) {
if (typeof code != 'string') {
throw new TypeError('Code argument is required');
}
return new ContextifyScript(code, filename);
};
module.exports = Contextify;
|