Created attachment 528271 [details] [diff] [review]
waitForBrowserState and waitForSaveState use listener and observer but those are removed in its function. We should also use registerCleanupFunction in case of timeout.
Comment on attachment 528271 [details] [diff] [review]
Patch looks good. Do you have any idea if there are cases where we're actually hitting this?
It happened once on my local Windows XP VM, but at that time the VM was getting slow down due to unknown reason, and I do not remember which test case causes this, but anyway it happens if user runs tests which use waitForBrowserState or waitForSaveSatate on a slow machine. ;-)