archives

« Bugzilla Issues Index

#3689 — ArraySetLength step 17.c should be strengthened to an assertion.


Step 17 is the loop that deletes elements from the array if the "length" property is being decreased.

17. While newLen < oldLen repeat,
a. Set oldLen to oldLen – 1.
b. Let deleteSucceeded be the result of calling the [[Delete]]
internal method of A passing ToString(oldLen).
c. ReturnIfAbrupt(succeeded).
d. If deleteSucceeded is false, then
i.-v. (...cleanup steps...)

It would be bad if we actually bailed out on step 17.c., because the cleanup steps would be skipped. The array could be left in violation of the array length invariant.

Fortunately, that can't happen: [[Delete]] on an Array object never terminates abruptly.

Asserting that fact would be clearer than silently relying on it.


I think 17.d.iv. is also infallible and we can even assert that the return value is true.


Steps 7 and 15 are also infallible.


fixed in rev32 editor's draft


fixed in rev32 draft