mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Bug 784015 - Fix division by 0 when calling ParallelArray.prototype.partition (r=dmandelin)
This commit is contained in:
parent
26106450b2
commit
9b26497e87
@ -1366,7 +1366,7 @@ ParallelArrayObject::partition(JSContext *cx, CallArgs args)
|
||||
|
||||
// Throw if the outer dimension is not divisible by the new dimension.
|
||||
uint32_t outer = obj->outermostDimension();
|
||||
if (outer % newDimension) {
|
||||
if (newDimension == 0 || outer % newDimension) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_PAR_ARRAY_BAD_PARTITION);
|
||||
return false;
|
||||
}
|
||||
|
@ -1,8 +1,10 @@
|
||||
// |jit-test| error: Error;
|
||||
load(libdir + "asserts.js");
|
||||
|
||||
function testPartitionDivisible() {
|
||||
var p = new ParallelArray([1,2,3,4]);
|
||||
var pp = p.partition(3);
|
||||
var pp;
|
||||
assertThrowsInstanceOf(function () { pp = p.partition(3); }, Error);
|
||||
assertThrowsInstanceOf(function () { pp = p.partition(.34); }, Error);
|
||||
}
|
||||
|
||||
testPartitionDivisible();
|
||||
|
Loading…
Reference in New Issue
Block a user