Make sure globals can be accessed from the browser (#1920)
Note: no tests as there are no integration tests
This commit is contained in:
committed by
Alex Lam S.L
parent
fcd90db30d
commit
c699200398
@@ -48,9 +48,10 @@ function find_builtins(reserved) {
|
|||||||
// Compatibility fix for some standard defined globals not defined on every js environment
|
// 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 new_globals = ["Symbol", "Map", "Promise", "Proxy", "Reflect", "Set", "WeakMap", "WeakSet"];
|
||||||
var objects = {};
|
var objects = {};
|
||||||
|
var global_ref = typeof global === "object" ? global : self;
|
||||||
|
|
||||||
new_globals.forEach(function (new_global) {
|
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
|
// NaN will be included due to Number.NaN
|
||||||
|
|||||||
Reference in New Issue
Block a user