Something to watch out for

I wasn’t able to duplicate this, but I managed to crash Freeway hard, twice, using a combination of two Actions. In one, I had extended the Array prototype with a custom function:

if(! [].array_search){
	Array.prototype.array_search = function(element){
		for(var i = 0; i < this.length; i++){
			if(this[i] == element) return true;
		}
		return false;
	}
}

In the other, I was using the often-discouraged iteration method for(i in foo) in a lot of different places. The moment that one of those iterators started going, Freeway crashed. I looked through the stack trace, but I couldn’t make any sense of it.

I was able to replace all the for in stuff with the proper iterator:

for(var i = 0; i < foo.length; i++){ … }

and all was forgiven. But this probably means you may find another combination of Actions that could throw this particular wrench. Here is the definitive word on why you shouldn’t use for in to iterate an array, from the eggheads at Prototype.js: Prototype v1.7.3 API documentation | Array

Walter


actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options