Fix realm assignments.

This commit is contained in:
John-David Dalton
2016-01-02 11:39:19 -06:00
parent 849f8e77ec
commit b0e0a20e96

View File

@@ -467,31 +467,33 @@
lodashStable.attempt(function() {
lodashStable.assign(realm, require('vm').runInNewContext([
'(function() {',
' var root = this;',
' var noop = function() {},',
' root = this;',
'',
' var object = {',
" 'arguments': (function() { return arguments; }(1, 2, 3)),",
" 'array': [1, 2, 3],",
" 'arrayBuffer': new (this.ArrayByffer || Object),",
" 'arrayBuffer': new (root.ArrayBuffer || noop),",
" 'boolean': Object(false),",
" 'date': new Date,",
" 'errors': [new Error, new EvalError, new RangeError, new ReferenceError, new SyntaxError, new TypeError, new URIError],",
" 'function': function() {},",
" 'map': new (root.Map || Object),",
" 'function': noop,",
" 'map': new (root.Map || noop),",
" 'nan': NaN,",
" 'null': null,",
" 'number': Object(0),",
" 'object': { 'a': 1, 'b': 2, 'c': 3 },",
" 'regexp': /x/,",
" 'set': new (root.Set || Object),",
" 'set': new (root.Set || noop),",
" 'string': Object('a'),",
" 'symbol': Object((root.Symbol || noop)()),",
" 'undefined': undefined",
' };',
'',
" ['" + typedArrays.join("', '") + "'].forEach(function(type) {",
" var Ctor = root[type]",
' if (Ctor) {',
" object['_' + type.toLowerCase()] = new Ctor(new ArrayBuffer(24));",
" object[type.toLowerCase()] = new Ctor(new ArrayBuffer(24));",
' }',
" });",
'',
@@ -511,33 +513,35 @@
var idoc = (idoc = iframe.contentDocument || iframe.contentWindow).document || idoc;
idoc.write([
'<script>',
'var _ = parent.lodashStable;',
'var _ = parent._;',
'',
'var root = this;',
' var noop = function() {},',
' root = this;',
'',
'var object = {',
" 'arguments': (function() { return arguments; }(1, 2, 3)),",
" 'array': [1, 2, 3],",
" 'arrayBuffer': new (this.ArrayByffer || Object),",
" 'arrayBuffer': new (root.ArrayBuffer || noop),",
" 'boolean': Object(false),",
" 'date': new Date,",
" 'errors': [new Error, new EvalError, new RangeError, new ReferenceError, new SyntaxError, new TypeError, new URIError],",
" 'function': function() {},",
" 'map': new (root.Map || Object),",
" 'function': noop,",
" 'map': new (root.Map || noop),",
" 'nan': NaN,",
" 'null': null,",
" 'number': Object(0),",
" 'object': { 'a': 1, 'b': 2, 'c': 3 },",
" 'regexp': /x/,",
" 'set': new (root.Set || Object),",
" 'set': new (root.Set || noop),",
" 'string': Object('a'),",
" 'symbol': Object((root.Symbol || noop)()),",
" 'undefined': undefined",
'};',
'',
"_.each(['" + typedArrays.join("', '") + "'], function(type) {",
' var Ctor = root[type];',
' if (Ctor) {',
" object['_' + type.toLowerCase()] = new Ctor(new ArrayBuffer(24));",
" object[type.toLowerCase()] = new Ctor(new ArrayBuffer(24));",
' }',
'});',
'',