RC tests are failing in Firefox beta builds. This has been fixed in two ways:

* Rely on the automation atoms where possible.
* Obtain the document and window from the element the event is firing from.

In the course of fixing this, all but one usage of "triggerEvent" was replaced.
Because of this, the method has been inlined to the last call site.