Fixed bug: waitsFor() hangs forever if latch function never returns true.
This commit is contained in:
@@ -4,6 +4,7 @@ jasmine.Queue = function(env) {
|
||||
this.running = false;
|
||||
this.index = 0;
|
||||
this.offset = 0;
|
||||
this.abort = false;
|
||||
};
|
||||
|
||||
jasmine.Queue.prototype.addBefore = function(block) {
|
||||
@@ -38,7 +39,7 @@ jasmine.Queue.prototype.next_ = function() {
|
||||
while (goAgain) {
|
||||
goAgain = false;
|
||||
|
||||
if (self.index < self.blocks.length) {
|
||||
if (self.index < self.blocks.length && !this.abort) {
|
||||
var calledSynchronously = true;
|
||||
var completedSynchronously = false;
|
||||
|
||||
@@ -48,6 +49,10 @@ jasmine.Queue.prototype.next_ = function() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.blocks[self.index].abort) {
|
||||
self.abort = true;
|
||||
}
|
||||
|
||||
self.offset = 0;
|
||||
self.index++;
|
||||
|
||||
|
||||
@@ -39,7 +39,9 @@ jasmine.WaitsForBlock.prototype.execute = function(onComplete) {
|
||||
name: 'timeout',
|
||||
message: message
|
||||
});
|
||||
// todo: need to prevent additional blocks in this spec from running... [xw 20100819]
|
||||
|
||||
this.abort = true;
|
||||
onComplete();
|
||||
} else {
|
||||
this.totalTimeSpentWaitingForLatch += jasmine.WaitsForBlock.TIMEOUT_INCREMENT;
|
||||
var self = this;
|
||||
|
||||
Reference in New Issue
Block a user