621098edcf31297b2eabf8e671a11cfa729b0848
[framework/web/webkit-efl.git] / LayoutTests / fast / js / script-tests / array-sort-reentrance.js
1 description(
2 "This tests that a call to array.sort(compareFunction) does not crash from within a sort comparison function."
3 );
4
5 var numbers1 = [1, 2, 3, 4, 5, 6, 7];
6 var numbers2 = numbers1.slice();
7
8 function compareFn1(a, b) {
9     return b - a;
10 }
11
12 function compareFn2(a, b) {
13     numbers1.sort(compareFn1);
14     return b - a;
15 }
16
17 numbers2.sort(compareFn2);
18
19 var successfullyParsed = true;