Bug 1062876: refactor window iteration code for MediaManager r=jib