mozilla/addon-sdk — pull request #908 by ZER0 (2013-03-28 18:21:03+00:00)
Title: Bug 847840 - TEST-UNEXPECTED-FAIL | tests/test-selection.test Selection Listener on frame

Tried to wait the `document-shown` notification before resolve the window, and also move the shutdown functions (`close`, `loader.unload`, `done`) for the test that sometimes is failing.

Not sure this will fix the issue because I'm not able to reproduce it, but let's give a try.