Make sure globals can be accessed from the browser (#1920)

Note: no tests as there are no integration tests
This commit is contained in:
Anthony Van de Gejuchte
2017-05-11 23:50:35 +02:00
committed by Alex Lam S.L
parent fcd90db30d
commit c699200398

View File

@@ -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