From 41e884a1d27144e6b3bb00416f6f5b50789986ca Mon Sep 17 00:00:00 2001 From: jdalton Date: Tue, 19 May 2015 14:59:55 -0700 Subject: [PATCH] Poison the free variable `root` in Node.js. --- test/test.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/test.js b/test/test.js index 037b597d2..7efdd1a6e 100644 --- a/test/test.js +++ b/test/test.js @@ -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