From c699200398fb942f812194d95197725f8ef61407 Mon Sep 17 00:00:00 2001 From: Anthony Van de Gejuchte Date: Thu, 11 May 2017 23:50:35 +0200 Subject: [PATCH] Make sure globals can be accessed from the browser (#1920) Note: no tests as there are no integration tests --- lib/propmangle.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/propmangle.js b/lib/propmangle.js index 4781eec7..29fb2682 100644 --- a/lib/propmangle.js +++ b/lib/propmangle.js @@ -48,9 +48,10 @@ function find_builtins(reserved) { // Compatibility fix for some standard defined globals not defined on every js environment var new_globals = ["Symbol", "Map", "Promise", "Proxy", "Reflect", "Set", "WeakMap", "WeakSet"]; var objects = {}; + var global_ref = typeof global === "object" ? global : self; new_globals.forEach(function (new_global) { - objects[new_global] = global[new_global] || new Function(); + objects[new_global] = global_ref[new_global] || new Function(); }); // NaN will be included due to Number.NaN