mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 783924 - Part 1: Fix ParallelArray constructor being called with non array-like objects (r=dmandelin)
This commit is contained in:
parent
19580422cb
commit
fc9f81855b
@ -81,7 +81,6 @@ ParallelArrayObject::IndexInfo::initialize(uint32_t space)
|
|||||||
|
|
||||||
// Reserve indices.
|
// Reserve indices.
|
||||||
return indices.reserve(ndims) && indices.resize(space);
|
return indices.reserve(ndims) && indices.resize(space);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
|
@ -1050,6 +1050,12 @@ ParallelArrayObject::construct(JSContext *cx, unsigned argc, Value *vp)
|
|||||||
if (!iv.dimensions.resize(1) || !ToUint32(cx, args[0], &iv.dimensions[0]))
|
if (!iv.dimensions.resize(1) || !ToUint32(cx, args[0], &iv.dimensions[0]))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the first argument wasn't a array-like or had no length, assume
|
||||||
|
// empty parallel array, i.e. with shape being [0].
|
||||||
|
if (iv.dimensions.length() == 0 && !iv.dimensions.append(0))
|
||||||
|
return false;
|
||||||
|
|
||||||
if (!iv.initialize(0))
|
if (!iv.initialize(0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -1,7 +1,13 @@
|
|||||||
// |jit-test| error: TypeError;
|
load(libdir + "asserts.js");
|
||||||
|
|
||||||
function buildComprehension() {
|
function buildComprehension() {
|
||||||
// Throws if elemental fun not callable
|
// Throws if elemental fun not callable
|
||||||
var p = new ParallelArray([2,2], undefined);
|
assertThrowsInstanceOf(function () {
|
||||||
|
var p = new ParallelArray([2,2], undefined);
|
||||||
|
}, TypeError);
|
||||||
|
assertThrowsInstanceOf(function () {
|
||||||
|
var p = new ParallelArray(/x/, /x/);
|
||||||
|
}, TypeError);
|
||||||
}
|
}
|
||||||
|
|
||||||
buildComprehension();
|
buildComprehension();
|
||||||
|
Loading…
Reference in New Issue
Block a user