nuprl/Stopify

Polyfilled Array.sort with callback fails when a breakpoint is added.

Opened this issue · 1 comments

Code:

function swap(arr, first_Index, second_Index){
    var temp = arr[first_Index];
    arr[first_Index] = arr[second_Index];
    arr[second_Index] = temp;
}

var bubble_sort = function(comp){
    var len = this.length,
        i, j, stop;

    for (i=0; i < len; i++){
        for (j=0, stop=len-i; j < stop; j++){
            if (comp(this[j], this[j+1]) > 0){
                swap(this, j, j+1);
            }
        }
    }

    return this;
}

Array.prototype["sort"] = bubble_sort;
console.log([3, 0, 2, 5, -1, 4, 1].sort(
    function(a,b) {
        return b-a
    }
));

Error message:
Uncaught Error: step(onStep) requires the program to be paused

Screenshot:
StopifyBreakFailStep

Thanks for reporting this! I believe I've tracked the bug down and fixed it here (#425). We'll merge it in and update stopify.org shortly.