diff --git a/gfx/layers/apz/test/mochitest/browser_test_autoscrolling_in_extension_popup_window.js b/gfx/layers/apz/test/mochitest/browser_test_autoscrolling_in_extension_popup_window.js index 9cb176fbb5af..a3e427338321 100644 --- a/gfx/layers/apz/test/mochitest/browser_test_autoscrolling_in_extension_popup_window.js +++ b/gfx/layers/apz/test/mochitest/browser_test_autoscrolling_in_extension_popup_window.js @@ -83,6 +83,14 @@ add_task(async () => { }, { once: true } ); + window.addEventListener( + "scroll", + () => { + dump("Got a scroll event in the popup content document\n"); + browser.test.sendMessage("received-scroll"); + }, + { once: true } + ); }, }, }); @@ -140,22 +148,7 @@ add_task(async () => { await Promise.all([nativeMouseEventPromise, mousemoveEventPromise]); - const scrollEventPromise = SpecialPowers.spawn( - browserForPopup, - [], - async () => { - return new Promise(resolve => { - content.window.addEventListener( - "scroll", - event => { - dump("Got a scroll event in the popup content document\n"); - resolve(); - }, - { once: true } - ); - }); - } - ); + const scrollEventPromise = extension.awaitMessage("received-scroll"); // Start autoscrolling. ok(