mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 08:37:49 +00:00
Fix realm assignments.
This commit is contained in:
30
test/test.js
30
test/test.js
@@ -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));",
|
||||
' }',
|
||||
'});',
|
||||
'',
|
||||
|
||||
Reference in New Issue
Block a user