From a35ea86333c86132a39ebcbeac95a3edc1649a51 Mon Sep 17 00:00:00 2001 From: Alastor Wu Date: Tue, 5 Nov 2019 09:37:26 +0000 Subject: [PATCH] Bug 1590864 - part3 : use 'notifyUserGestureActivation()' to activate document directly. r=edgar I found that this test sometime would fail on the try server, and the reason is that the child document doesn't be activated correctly even if we have called `synthesizeMouseAtCenter()`. In order to reduce the dependency of other modules, which might affect synthesizing event, we should use `notifyUserGestureActivation` to ensure that we indeed activate the document. Differential Revision: https://phabricator.services.mozilla.com/D51685 --HG-- extra : moz-landing-system : lando --- dom/media/test/file_autoplay_policy_activation_frame.html | 2 +- dom/media/test/file_autoplay_policy_activation_window.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dom/media/test/file_autoplay_policy_activation_frame.html b/dom/media/test/file_autoplay_policy_activation_frame.html index 104db724035d..c63c93034709 100644 --- a/dom/media/test/file_autoplay_policy_activation_frame.html +++ b/dom/media/test/file_autoplay_policy_activation_frame.html @@ -17,7 +17,7 @@ window.addEventListener("message", (event) => { if (event.data == "click") { - synthesizeMouseAtCenter(document.body, {}); + SpecialPowers.wrap(document).notifyUserGestureActivation(); } else if (event.data == "play-audible") { playAndPostResult(false, event.source); } else if (event.data == "play-muted") { diff --git a/dom/media/test/file_autoplay_policy_activation_window.html b/dom/media/test/file_autoplay_policy_activation_window.html index 52677cfba54e..7764c94e3eba 100644 --- a/dom/media/test/file_autoplay_policy_activation_window.html +++ b/dom/media/test/file_autoplay_policy_activation_window.html @@ -50,7 +50,7 @@ let test_case = event.data; // Click the window to activate if appropriate. if (test_case.activated_parent) { - synthesizeMouseAtCenter(document.body, {}); + SpecialPowers.wrap(document).notifyUserGestureActivation(); } let parent_window = event.source; if (test_case.same_origin_child === undefined) {