Bug 1467918 - Fix APZ utils to work with GeckoView r=botond
MozReview-Commit-ID: 9fKAgqnigGw
--- a/gfx/layers/apz/test/mochitest/apz_test_utils.js
+++ b/gfx/layers/apz/test/mochitest/apz_test_utils.js
@@ -289,17 +289,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);
};
@@ -427,16 +430,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");