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
This commit is contained in:
Alastor Wu 2019-11-05 09:37:26 +00:00
parent b077049e5f
commit a35ea86333
2 changed files with 2 additions and 2 deletions

View File

@ -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") {

View File

@ -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) {