Bug 1530195 - Call restoreNormalRefresh before closing window. r=kats
authorJamie Nicol <jnicol@mozilla.com>
Mon, 29 Apr 2019 17:06:35 +0000
changeset 471777 5f99a88fd60fb0caf4d921648dff45b7f653ec2f
parent 471776 e516adb0ff9e98281e8be4b3e642c6d878ca259c
child 471778 f348b1ddb6c6aff4b1cb72dd519768c213de8b9a
push id35934
push usershindli@mozilla.com
push dateMon, 29 Apr 2019 21:53:38 +0000
treeherdermozilla-central@f6766ba4ac77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1530195
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1530195 - Call restoreNormalRefresh before closing window. r=kats A test was intermittently crashing because it was calling restoreNormalRefresh after closing the window. This meant LayerTransactionParent::RecvLeaveTestMode fired after the CompositorBridgeParent had been destroyed. This fixes the test by calling restoreNormalRefresh before win.close. It also checks mDestroyed in RecvLeaveTestMode (for both LayerTransactionParent and WebRenderBridgeParent). Differential Revision: https://phabricator.services.mozilla.com/D29228
editor/libeditor/tests/test_bug915962.html
gfx/layers/ipc/LayerTransactionParent.cpp
gfx/layers/wr/WebRenderBridgeParent.cpp
--- a/editor/libeditor/tests/test_bug915962.html
+++ b/editor/libeditor/tests/test_bug915962.html
@@ -69,32 +69,32 @@ function startTest() {
 
   oldY = win.scrollY;
   synthesizeKey(" ", {}, win);
 
   step();
 
   ok(win.scrollY >= oldY, "Page is scrolled down");
 
+  cwu.restoreNormalRefresh();
   win.close();
-  cwu.restoreNormalRefresh();
 
   win = window.open("file_bug915962.html", "_blank",
                     "width=600,height=600,scrollbars=yes");
   cwu = SpecialPowers.getDOMWindowUtils(win);
   SimpleTest.waitForFocus(function() {
     is(win.scrollY, 0, "Sanity check");
     synthesizeKey(" ", {}, win);
 
     step();
 
     isnot(win.scrollY, 0, "Page is scrolled down without crashing");
 
+    cwu.restoreNormalRefresh();
     win.close();
-    cwu.restoreNormalRefresh();
 
     SimpleTest.finish();
   }, win);
 }
 </script>
 </pre>
 </body>
 </html>
--- a/gfx/layers/ipc/LayerTransactionParent.cpp
+++ b/gfx/layers/ipc/LayerTransactionParent.cpp
@@ -668,16 +668,20 @@ mozilla::ipc::IPCResult LayerTransaction
     const TimeStamp& aTime) {
   if (!mCompositorBridge->SetTestSampleTime(GetId(), aTime)) {
     return IPC_FAIL_NO_REASON(this);
   }
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult LayerTransactionParent::RecvLeaveTestMode() {
+  if (mDestroyed) {
+    return IPC_FAIL_NO_REASON(this);
+  }
+
   mCompositorBridge->LeaveTestMode(GetId());
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult LayerTransactionParent::RecvGetAnimationValue(
     const uint64_t& aCompositorAnimationsId, OMTAValue* aValue) {
   if (mDestroyed || !mLayerManager || mLayerManager->IsDestroyed()) {
     return IPC_FAIL_NO_REASON(this);
--- a/gfx/layers/wr/WebRenderBridgeParent.cpp
+++ b/gfx/layers/wr/WebRenderBridgeParent.cpp
@@ -1756,16 +1756,20 @@ mozilla::ipc::IPCResult WebRenderBridgeP
     const TimeStamp& aTime) {
   if (!mCompositorBridge->SetTestSampleTime(GetLayersId(), aTime)) {
     return IPC_FAIL_NO_REASON(this);
   }
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult WebRenderBridgeParent::RecvLeaveTestMode() {
+  if (mDestroyed) {
+    return IPC_FAIL_NO_REASON(this);
+  }
+
   mCompositorBridge->LeaveTestMode(GetLayersId());
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult WebRenderBridgeParent::RecvGetAnimationValue(
     const uint64_t& aCompositorAnimationsId, OMTAValue* aValue) {
   if (mDestroyed) {
     return IPC_FAIL_NO_REASON(this);