Bug 1467918 - Fix APZ test utils to work with GeckoView r=botond
authorJames Willcox <snorp@snorp.net>
Fri, 01 Jun 2018 11:14:37 -0500
changeset 424757 b7230ab18e629d52c059d08451ec78d3ce7b1da7
parent 424756 66fdcd45de9097b8d318f9eec48080e76b0169b1
child 424758 5e463b28e20091c69ff907595593f8eeff5dc0fe
push id34223
push useraiakab@mozilla.com
push dateTue, 03 Jul 2018 08:56:10 +0000
treeherdermozilla-central@a0e47ebc4c06 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1467918
milestone63.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 1467918 - Fix APZ test utils to work with GeckoView r=botond MozReview-Commit-ID: 9fKAgqnigGw
gfx/layers/apz/test/mochitest/apz_test_utils.js
--- a/gfx/layers/apz/test/mochitest/apz_test_utils.js
+++ b/gfx/layers/apz/test/mochitest/apz_test_utils.js
@@ -302,17 +302,20 @@ async function waitUntilApzStable() {
     // the parent-process layer tree in the compositor has the appropriate
     // RefLayer pointing to the content-process layer tree.
 
     // Sadly this helper function cannot reuse any code from other places because
     // it must be totally self-contained to be shipped over to the parent process.
     function parentProcessFlush() {
       addMessageListener("apz-flush", function() {
         ChromeUtils.import("resource://gre/modules/Services.jsm");
-        var topWin = Services.wm.getMostRecentWindow("navigator:browser");
+        var topWin = Services.wm.getMostRecentWindow('navigator:browser');
+        if (!topWin) {
+          topWin = Services.wm.getMostRecentWindow('navigator:geckoview');
+        }
         var topUtils = topWin.QueryInterface(Ci.nsIInterfaceRequestor)
                              .getInterface(Ci.nsIDOMWindowUtils);
 
         var repaintDone = function() {
           Services.obs.removeObserver(repaintDone, "apz-repaints-flushed");
           // send message back to content process
           sendAsyncMessage("apz-flush-done", null);
         };
@@ -440,16 +443,19 @@ function runContinuation(testFunction) {
 // the snapshot. If the rect extends outside the browser window then the
 // results are undefined.
 // The snapshot is returned in the form of a data URL.
 function getSnapshot(rect) {
   function parentProcessSnapshot() {
     addMessageListener('snapshot', function(rect) {
       ChromeUtils.import('resource://gre/modules/Services.jsm');
       var topWin = Services.wm.getMostRecentWindow('navigator:browser');
+      if (!topWin) {
+        topWin = Services.wm.getMostRecentWindow('navigator:geckoview');
+      }
 
       // reposition the rect relative to the top-level browser window
       rect = JSON.parse(rect);
       rect.x -= topWin.mozInnerScreenX;
       rect.y -= topWin.mozInnerScreenY;
 
       // take the snapshot
       var canvas = topWin.document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");