Bug 847840 - TEST-UNEXPECTED-FAIL | tests/test-selection.test Selection Listener on frame | Test output exceeded timeout (60s).

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.
Merge pull request #908 from ZER0/selection-timeout/847840

Bug 847840 - TEST-UNEXPECTED-FAIL | tests/test-selection.test Selection Listener on frame r=@Mossop