The startup script starts by searching a window by its type; how the window type parameter is only available once the window's document element has been created.
The main window has already been created however and it is in an in-between state which means that you can't find it by its type nor will domwindowcreated be fired.
So we listen to either initial-document-element-inserted which indicates when it's okay to search for the main window by type again and we are ready to start the reftest.
Differential Revision: https://phabricator.services.mozilla.com/D72142