Poison the free variable root in Node.js.

This commit is contained in:
jdalton
2015-05-19 14:59:55 -07:00
parent 15841b191d
commit 41e884a1d2

View File

@@ -189,6 +189,15 @@
var xml = new ActiveXObject('Microsoft.XMLDOM');
} catch(e) {}
/** Poison the free variable `root` in Node.js */
try {
Object.defineProperty(global.root, 'root', {
'configurable': true,
'enumerable': false,
'get': function() { throw new ReferenceError; }
});
} catch(e) {}
/** Use a single "load" function. */
var load = (!amd && typeof require == 'function')
? require