Backed out 2 changesets (bug 1456037) for bustage in z:/build/build/src/dom/events/EventStateManager.cpp on a CLOSED TREE

Backed out changeset 10ac210e88db (bug 1456037)
Backed out changeset e3b70cecf471 (bug 1456037)
This commit is contained in:
shindli 2018-04-24 08:27:22 +03:00
parent 54a96dd048
commit b1f0ca2585
4 changed files with 6 additions and 160 deletions

View File

@ -643,7 +643,6 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
SetClickCount(mouseEvent, aStatus);
break;
}
NotifyTargetUserActivation(aEvent, aTargetContent);
break;
}
case eMouseUp: {
@ -660,6 +659,7 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
case WidgetMouseEvent::eMiddleButton:
RefPtr<EventStateManager> esm = ESMFromContentOrThis(aOverrideClickTarget);
esm->SetClickCount(mouseEvent, aStatus, aOverrideClickTarget);
NotifyTargetUserActivation(aEvent, aTargetContent);
break;
}
break;
@ -714,13 +714,6 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
case ePointerDown:
if (aEvent->mMessage == ePointerDown) {
PointerEventHandler::ImplicitlyCapturePointer(aTargetFrame, aEvent);
#ifndef MOZ_WIDGET_ANDROID
// Pointer events aren't enabled on Android yet, but when they
// are enabled, we should not activate on pointerdown, as that
// fires for touches that turn into moves on Android, and we don't
// want to gesture activate for scroll actions.
NotifyTargetUserActivation(aEvent, aTargetContent);
#endif
}
MOZ_FALLTHROUGH;
case ePointerMove: {
@ -801,10 +794,6 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
// then fall through...
MOZ_FALLTHROUGH;
case eKeyDown:
if (aEvent->mMessage == eKeyDown) {
NotifyTargetUserActivation(aEvent, aTargetContent);
}
MOZ_FALLTHROUGH;
case eKeyUp:
{
nsIContent* content = GetFocusedContent();
@ -834,6 +823,9 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
!IsRemoteTarget(content)) {
aEvent->ResetWaitingReplyFromRemoteProcessState();
}
if (aEvent->mMessage == eKeyUp) {
NotifyTargetUserActivation(aEvent, aTargetContent);
}
}
break;
case eWheel:
@ -929,11 +921,8 @@ EventStateManager::NotifyTargetUserActivation(WidgetEvent* aEvent,
return;
}
MOZ_ASSERT(aEvent->mMessage == eKeyDown ||
aEvent->mMessage == eMouseDown ||
#ifndef MOZ_WIDGET_ANDROID
aEvent->mMessage == ePointerDown ||
#endif
MOZ_ASSERT(aEvent->mMessage == eKeyUp ||
aEvent->mMessage == eMouseUp ||
aEvent->mMessage == eTouchEnd);
doc->NotifyUserActivation();
}

View File

@ -1,85 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Autoplay policy window</title>
<style>
video {
width: 50%;
height: 50%;
}
</style>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<script type="text/javascript" src="manifest.js"></script>
<script type="text/javascript" src="AutoplayTestUtils.js"></script>
</head>
<body>
<pre id="test">
<script>
window.ok = window.opener.ok;
window.is = window.opener.is;
window.info = window.opener.info;
async function testEventDownActivates(eventNames, activator) {
let element = document.createElement("video");
element.preload = "auto";
element.src = "short.mp4";
document.body.appendChild(element);
await once(element, "loadedmetadata");
let played = await element.play().then(() => true, () => false);
ok(!played, "Document should start out not activated, with playback blocked.");
let x = eventNames.map(
(eventName) => {
return new Promise(async function (resolve, reject) {
window.addEventListener(eventName, async function (event) {
let played = await element.play().then(() => true, () => false);
ok(played, "Expect to be activated already in " + eventName);
resolve();
}, false);
});
});
activator();
await Promise.all(x);
removeNodeAndSource(element);
}
nextWindowMessage().then(
async (event) => {
try {
if (event.data == "run keydown test") {
await testEventDownActivates(["keydown", "keypress", "keyup"], () => {
document.body.focus();
synthesizeKey(" ");
});
} else if (event.data == "run mousedown test") {
let events = ["mousedown", "mouseup", "click"];
if (getAndroidVersion() < 0) {
// Non-Android, also listen on pointer events.
events.push("pointerdown", "pointerup");
}
await testEventDownActivates(events, () => {
synthesizeMouseAtCenter(document.body, {});
});
} else {
ok(false, "unexpected message");
}
} catch (e) {
ok(false, "Caught exception " + e + " " + e.message + " " + e.stackTrace);
}
event.source.postMessage("done", "*");
});
</script>
</pre>
</body>
</html>

View File

@ -437,7 +437,6 @@ support-files =
dynamic_resource.sjs
eme.js
file_access_controls.html
file_autoplay_policy_eventdown_activation.html
file_autoplay_policy_unmute_pauses.html
file_autoplay_policy_activation_window.html
file_autoplay_policy_activation_frame.html
@ -695,8 +694,6 @@ skip-if = android_version == '15' || android_version == '17' || android_version
skip-if = android_version == '23' # bug 1424903
[test_autoplay_policy_activation.html]
skip-if = android_version == '23' # bug 1424903
[test_autoplay_policy_eventdown_activation.html]
skip-if = android_version == '23' # bug 1424903
[test_autoplay_policy_unmute_pauses.html]
skip-if = android_version == '23' # bug 1424903
[test_autoplay_policy_play_before_loadedmetadata.html]

View File

@ -1,55 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Autoplay policy test</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<script type="text/javascript" src="manifest.js"></script>
<script type="text/javascript" src="AutoplayTestUtils.js"></script>
</head>
<body>
<pre id="test">
<script>
// Tests that we gesture activate on mousedown and keydown.
gTestPrefs.push(["media.autoplay.enabled", false],
["media.autoplay.enabled.user-gestures-needed", true]);
SpecialPowers.pushPrefEnv({ 'set': gTestPrefs }, () => {
runTest();
});
let child_url = "file_autoplay_policy_eventdown_activation.html";
async function runTest() {
// Run test in a new window, to ensure its user gesture
// activation state isn't tainted by preceeding tests.
{
let child = window.open(child_url, "", "width=500,height=500");
await once(child, "load");
child.postMessage("run keydown test", window.origin);
let result = await nextWindowMessage();
child.close();
}
{
let child = window.open(child_url, "", "width=500,height=500");
await once(child, "load");
child.postMessage("run mousedown test", window.origin);
let result = await nextWindowMessage();
child.close();
}
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
</script>
</pre>
</body>
</html>