Bug 1434593 - Ensure that browser.xml does not send APZ back a notification after APZ notifies it of canceling autoscroll. r=kats draft
authorBotond Ballo <botond@mozilla.com>
Wed, 21 Feb 2018 15:01:46 -0500
changeset 758040 060319da29f313d30b380dcecd6fc73ff5a807e8
parent 757991 3904c3f9314fd040828c5f1cf1fcc86fd8adfe3e
push id99928
push userbballo@mozilla.com
push dateWed, 21 Feb 2018 20:03:40 +0000
reviewerskats
bugs1434593
milestone60.0a1
Bug 1434593 - Ensure that browser.xml does not send APZ back a notification after APZ notifies it of canceling autoscroll. r=kats The second notification is needless and can cause deadlocks. The code previously tried to ensure it wasn't sent, but didn't account for the possibility of a call to hidePopup() causing the 'popuphidden' event to be handled synchronously. MozReview-Commit-ID: BiMOFMMudIH
toolkit/content/widgets/browser.xml
--- a/toolkit/content/widgets/browser.xml
+++ b/toolkit/content/widgets/browser.xml
@@ -1209,23 +1209,23 @@
         <parameter name="aTopic"/>
         <parameter name="aState"/>
         <body>
           <![CDATA[
             if (aTopic == "browser:purge-session-history") {
               this.purgeSessionHistory();
             } else if (aTopic == "apz:cancel-autoscroll") {
               if (aState == this._autoScrollScrollId) {
-                this._autoScrollPopup.hidePopup();
-
                 // Set this._autoScrollScrollId to null, so in stopScroll() we
                 // don't call stopApzAutoscroll() (since it's APZ that
                 // initiated the stopping).
                 this._autoScrollScrollId = null;
                 this._autoScrollPresShellId = null;
+
+                this._autoScrollPopup.hidePopup();
               }
             }
           ]]>
         </body>
       </method>
 
       <method name="purgeSessionHistory">
         <body>