Bug 1450876 - Click command cancels page load if it's too slowly (delayed pagehide event).
If a page loads too slowly the "pagehide" event will be delayed
by the time until the first data is received. This can clearly
happen after our 5s timer which listens for this event.
Given that no beforeunload handlers are allowed anymore the
click and page load algorithm can be simplified, so that we
determine a page load only by the "beforeunload" event.
MozReview-Commit-ID: HKhdqbr8w9b
--- a/testing/marionette/listener.js
+++ b/testing/marionette/listener.js
@@ -302,32 +302,19 @@ const loadListener = {
},
/**
* Callback for navigation timeout timer.
*/
notify(timer) {
switch (timer) {
case this.timerPageUnload:
- // In the case when a document has a beforeunload handler
- // registered, the currently active command will return immediately
- // due to the modal dialog observer in proxy.js.
- //
- // Otherwise the timeout waiting for the document to start
- // navigating is increased by 5000 ms to ensure a possible load
- // event is not missed. In the common case such an event should
- // occur pretty soon after beforeunload, and we optimise for this.
- if (this.seenBeforeUnload) {
- this.seenBeforeUnload = null;
- this.timerPageUnload.initWithCallback(
- this, 5000, Ci.nsITimer.TYPE_ONE_SHOT);
-
// If no page unload has been detected, ensure to properly stop
// the load listener, and return from the currently active command.
- } else if (!this.seenUnload) {
+ if (!this.seenBeforeUnload) {
logger.debug("Canceled page load listener because no navigation " +
"has been detected");
this.stop();
sendOk(this.commandID);
}
break;
case this.timerPageLoad: