Bug 1450876 - Click command cancels page load if it's too slowly (delayed pagehide event). draft
authorHenrik Skupin <mail@hskupin.info>
Tue, 31 Jul 2018 09:28:16 +0200
changeset 824556 f7678d39c66f2d12071472b91a1b69dbbac6e8dc
parent 824543 cb499a2e465029618d7bd2637919b04d4778cd56
push id117939
push userbmo:hskupin@gmail.com
push dateTue, 31 Jul 2018 07:28:57 +0000
bugs1450876
milestone63.0a1
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
testing/marionette/listener.js
--- 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: