mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-12 20:07: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.attempt(function() {
|
||||||
lodashStable.assign(realm, require('vm').runInNewContext([
|
lodashStable.assign(realm, require('vm').runInNewContext([
|
||||||
'(function() {',
|
'(function() {',
|
||||||
' var root = this;',
|
' var noop = function() {},',
|
||||||
|
' root = this;',
|
||||||
'',
|
'',
|
||||||
' var object = {',
|
' var object = {',
|
||||||
" 'arguments': (function() { return arguments; }(1, 2, 3)),",
|
" 'arguments': (function() { return arguments; }(1, 2, 3)),",
|
||||||
" 'array': [1, 2, 3],",
|
" 'array': [1, 2, 3],",
|
||||||
" 'arrayBuffer': new (this.ArrayByffer || Object),",
|
" 'arrayBuffer': new (root.ArrayBuffer || noop),",
|
||||||
" 'boolean': Object(false),",
|
" 'boolean': Object(false),",
|
||||||
" 'date': new Date,",
|
" 'date': new Date,",
|
||||||
" 'errors': [new Error, new EvalError, new RangeError, new ReferenceError, new SyntaxError, new TypeError, new URIError],",
|
" 'errors': [new Error, new EvalError, new RangeError, new ReferenceError, new SyntaxError, new TypeError, new URIError],",
|
||||||
" 'function': function() {},",
|
" 'function': noop,",
|
||||||
" 'map': new (root.Map || Object),",
|
" 'map': new (root.Map || noop),",
|
||||||
" 'nan': NaN,",
|
" 'nan': NaN,",
|
||||||
" 'null': null,",
|
" 'null': null,",
|
||||||
" 'number': Object(0),",
|
" 'number': Object(0),",
|
||||||
" 'object': { 'a': 1, 'b': 2, 'c': 3 },",
|
" 'object': { 'a': 1, 'b': 2, 'c': 3 },",
|
||||||
" 'regexp': /x/,",
|
" 'regexp': /x/,",
|
||||||
" 'set': new (root.Set || Object),",
|
" 'set': new (root.Set || noop),",
|
||||||
" 'string': Object('a'),",
|
" 'string': Object('a'),",
|
||||||
|
" 'symbol': Object((root.Symbol || noop)()),",
|
||||||
" 'undefined': undefined",
|
" 'undefined': undefined",
|
||||||
' };',
|
' };',
|
||||||
'',
|
'',
|
||||||
" ['" + typedArrays.join("', '") + "'].forEach(function(type) {",
|
" ['" + typedArrays.join("', '") + "'].forEach(function(type) {",
|
||||||
" var Ctor = root[type]",
|
" var Ctor = root[type]",
|
||||||
' if (Ctor) {',
|
' 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;
|
var idoc = (idoc = iframe.contentDocument || iframe.contentWindow).document || idoc;
|
||||||
idoc.write([
|
idoc.write([
|
||||||
'<script>',
|
'<script>',
|
||||||
'var _ = parent.lodashStable;',
|
'var _ = parent._;',
|
||||||
'',
|
'',
|
||||||
'var root = this;',
|
' var noop = function() {},',
|
||||||
|
' root = this;',
|
||||||
'',
|
'',
|
||||||
'var object = {',
|
'var object = {',
|
||||||
" 'arguments': (function() { return arguments; }(1, 2, 3)),",
|
" 'arguments': (function() { return arguments; }(1, 2, 3)),",
|
||||||
" 'array': [1, 2, 3],",
|
" 'array': [1, 2, 3],",
|
||||||
" 'arrayBuffer': new (this.ArrayByffer || Object),",
|
" 'arrayBuffer': new (root.ArrayBuffer || noop),",
|
||||||
" 'boolean': Object(false),",
|
" 'boolean': Object(false),",
|
||||||
" 'date': new Date,",
|
" 'date': new Date,",
|
||||||
" 'errors': [new Error, new EvalError, new RangeError, new ReferenceError, new SyntaxError, new TypeError, new URIError],",
|
" 'errors': [new Error, new EvalError, new RangeError, new ReferenceError, new SyntaxError, new TypeError, new URIError],",
|
||||||
" 'function': function() {},",
|
" 'function': noop,",
|
||||||
" 'map': new (root.Map || Object),",
|
" 'map': new (root.Map || noop),",
|
||||||
" 'nan': NaN,",
|
" 'nan': NaN,",
|
||||||
" 'null': null,",
|
" 'null': null,",
|
||||||
" 'number': Object(0),",
|
" 'number': Object(0),",
|
||||||
" 'object': { 'a': 1, 'b': 2, 'c': 3 },",
|
" 'object': { 'a': 1, 'b': 2, 'c': 3 },",
|
||||||
" 'regexp': /x/,",
|
" 'regexp': /x/,",
|
||||||
" 'set': new (root.Set || Object),",
|
" 'set': new (root.Set || noop),",
|
||||||
" 'string': Object('a'),",
|
" 'string': Object('a'),",
|
||||||
|
" 'symbol': Object((root.Symbol || noop)()),",
|
||||||
" 'undefined': undefined",
|
" 'undefined': undefined",
|
||||||
'};',
|
'};',
|
||||||
'',
|
'',
|
||||||
"_.each(['" + typedArrays.join("', '") + "'], function(type) {",
|
"_.each(['" + typedArrays.join("', '") + "'], function(type) {",
|
||||||
' var Ctor = root[type];',
|
' var Ctor = root[type];',
|
||||||
' if (Ctor) {',
|
' 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