Fixing window iteration code to not abort in the middle of the loop

Conflicts:

	lib/toolbarbutton.js
adding tests for #18