Use the new operator to ensure constructors of other realms produce objects of those realms.

This commit is contained in:
John-David Dalton
2014-10-23 20:43:49 -07:00
parent 64f45b061b
commit 13c9d80a3b

View File

@@ -2976,7 +2976,7 @@
function initArrayClone(array, isDeep) {
var index = -1,
length = array.length,
result = array.constructor(length);
result = new array.constructor(length);
if (!isDeep) {
while (++index < length) {
@@ -3041,7 +3041,7 @@
return new Ctor(object);
case regexpClass:
result = Ctor(object.source, reFlags.exec(object));
result = new Ctor(object.source, reFlags.exec(object));
result.lastIndex = object.lastIndex;
}
return result;