Bug 1080312 - Update iteration code from upstream. r=jesup, a=2.0+