Bug 1911736 - Enable dom.popup.experimental on Nightly, r=edgar
Differential Revision: https://phabricator.services.mozilla.com/D225518
This commit is contained in:
@@ -24,6 +24,7 @@
|
|||||||
#include "mozilla/MouseEvents.h"
|
#include "mozilla/MouseEvents.h"
|
||||||
#include "mozilla/PresShell.h"
|
#include "mozilla/PresShell.h"
|
||||||
#include "mozilla/ScrollContainerFrame.h"
|
#include "mozilla/ScrollContainerFrame.h"
|
||||||
|
#include "mozilla/StaticPrefs_dom.h"
|
||||||
#include "mozilla/TouchEvents.h"
|
#include "mozilla/TouchEvents.h"
|
||||||
#include "nsView.h"
|
#include "nsView.h"
|
||||||
#include "nsGkAtoms.h"
|
#include "nsGkAtoms.h"
|
||||||
@@ -115,6 +116,11 @@ void nsCoreUtils::DispatchClickEvent(XULTreeElement* aTree, int32_t aRowIndex,
|
|||||||
int32_t cnvdY = presContext->CSSPixelsToDevPixels(tcY + int32_t(rect.y) + 1) +
|
int32_t cnvdY = presContext->CSSPixelsToDevPixels(tcY + int32_t(rect.y) + 1) +
|
||||||
presContext->AppUnitsToDevPixels(offset.y);
|
presContext->AppUnitsToDevPixels(offset.y);
|
||||||
|
|
||||||
|
if (StaticPrefs::dom_popup_experimental()) {
|
||||||
|
// This isn't needed once bug 1924790 is fixed.
|
||||||
|
tcElm->OwnerDoc()->NotifyUserGestureActivation();
|
||||||
|
}
|
||||||
|
|
||||||
// XUL is just desktop, so there is no real reason for senfing touch events.
|
// XUL is just desktop, so there is no real reason for senfing touch events.
|
||||||
DispatchMouseEvent(eMouseDown, cnvdX, cnvdY, tcElm, tcFrame, presShell,
|
DispatchMouseEvent(eMouseDown, cnvdX, cnvdY, tcElm, tcFrame, presShell,
|
||||||
rootWidget);
|
rootWidget);
|
||||||
|
|||||||
@@ -72,6 +72,7 @@
|
|||||||
#include "mozilla/PresShell.h"
|
#include "mozilla/PresShell.h"
|
||||||
#include "mozilla/ProfilerMarkers.h"
|
#include "mozilla/ProfilerMarkers.h"
|
||||||
#include "mozilla/ScrollContainerFrame.h"
|
#include "mozilla/ScrollContainerFrame.h"
|
||||||
|
#include "mozilla/StaticPrefs_dom.h"
|
||||||
#include "mozilla/StaticPrefs_ui.h"
|
#include "mozilla/StaticPrefs_ui.h"
|
||||||
#include "mozilla/dom/Element.h"
|
#include "mozilla/dom/Element.h"
|
||||||
#include "mozilla/dom/HTMLLabelElement.h"
|
#include "mozilla/dom/HTMLLabelElement.h"
|
||||||
@@ -2556,6 +2557,11 @@ void LocalAccessible::DispatchClickEvent(nsIContent* aContent,
|
|||||||
// Simulate a touch interaction by dispatching touch events with mouse events.
|
// Simulate a touch interaction by dispatching touch events with mouse events.
|
||||||
nsCoreUtils::DispatchTouchEvent(eTouchStart, x, y, aContent, frame, presShell,
|
nsCoreUtils::DispatchTouchEvent(eTouchStart, x, y, aContent, frame, presShell,
|
||||||
widget);
|
widget);
|
||||||
|
|
||||||
|
if (StaticPrefs::dom_popup_experimental()) {
|
||||||
|
// This isn't needed once bug 1924790 is fixed.
|
||||||
|
aContent->OwnerDoc()->NotifyUserGestureActivation();
|
||||||
|
}
|
||||||
nsCoreUtils::DispatchMouseEvent(eMouseDown, x, y, aContent, frame, presShell,
|
nsCoreUtils::DispatchMouseEvent(eMouseDown, x, y, aContent, frame, presShell,
|
||||||
widget);
|
widget);
|
||||||
nsCoreUtils::DispatchTouchEvent(eTouchEnd, x, y, aContent, frame, presShell,
|
nsCoreUtils::DispatchTouchEvent(eTouchEnd, x, y, aContent, frame, presShell,
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<div id="target" style="width: 50px; height: 50px; background: green"></div>
|
<div id="target" style="width: 50px; height: 50px; background: green"></div>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
const experimental = SpecialPowers.getBoolPref("dom.popup.experimental");
|
var experimental = false;
|
||||||
|
|
||||||
function sendMouseEvent(element, eventName, button, listenEventName, handler) {
|
function sendMouseEvent(element, eventName, button, listenEventName, handler) {
|
||||||
let needToCheckHandler = false;
|
let needToCheckHandler = false;
|
||||||
@@ -61,7 +61,31 @@ const MIDDLE_BUTTON = 1;
|
|||||||
const RIGHT_BUTTON = 2;
|
const RIGHT_BUTTON = 2;
|
||||||
let target = document.getElementById("target");
|
let target = document.getElementById("target");
|
||||||
|
|
||||||
add_task(function testMouseDownUpMove() {
|
async function beginTest() {
|
||||||
|
if (!experimental) {
|
||||||
|
info("NOT EXPERIMENTAL");
|
||||||
|
await SpecialPowers.pushPrefEnv({
|
||||||
|
set: [
|
||||||
|
["dom.popup.experimental", false]
|
||||||
|
],
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
info("EXPERIMENTAL");
|
||||||
|
await SpecialPowers.pushPrefEnv({
|
||||||
|
set: [
|
||||||
|
["dom.popup.experimental", true],
|
||||||
|
],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function endTest() {
|
||||||
|
await SpecialPowers.popPrefEnv();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function testMouseDownUpMove() {
|
||||||
|
await beginTest();
|
||||||
|
|
||||||
// Left button
|
// Left button
|
||||||
sendMouseEvent(target, "mousedown", LEFT_BUTTON, "mousedown", checkAllowOpenPopup);
|
sendMouseEvent(target, "mousedown", LEFT_BUTTON, "mousedown", checkAllowOpenPopup);
|
||||||
sendMouseEvent(target, "mousemove", LEFT_BUTTON, "mousemove", checkBlockOpenPopup);
|
sendMouseEvent(target, "mousemove", LEFT_BUTTON, "mousemove", checkBlockOpenPopup);
|
||||||
@@ -78,15 +102,23 @@ add_task(function testMouseDownUpMove() {
|
|||||||
checkBlockOpenPopup);
|
checkBlockOpenPopup);
|
||||||
sendMouseEvent(target, "mousemove", RIGHT_BUTTON, "mousemove", checkBlockOpenPopup);
|
sendMouseEvent(target, "mousemove", RIGHT_BUTTON, "mousemove", checkBlockOpenPopup);
|
||||||
sendMouseEvent(target, "mouseup", RIGHT_BUTTON, "mouseup", checkBlockOpenPopup);
|
sendMouseEvent(target, "mouseup", RIGHT_BUTTON, "mouseup", checkBlockOpenPopup);
|
||||||
});
|
|
||||||
|
|
||||||
add_task(function testMouseClick() {
|
await endTest();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function testMouseClick() {
|
||||||
|
await beginTest();
|
||||||
|
|
||||||
// Left button
|
// Left button
|
||||||
sendMouseEvent(target, "mousedown", LEFT_BUTTON);
|
sendMouseEvent(target, "mousedown", LEFT_BUTTON);
|
||||||
sendMouseEvent(target, "mouseup", LEFT_BUTTON, "click", checkAllowOpenPopup);
|
sendMouseEvent(target, "mouseup", LEFT_BUTTON, "click", checkAllowOpenPopup);
|
||||||
});
|
|
||||||
|
|
||||||
add_task(function testMouseAuxclick() {
|
await endTest();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function testMouseAuxclick() {
|
||||||
|
await beginTest();
|
||||||
|
|
||||||
// Middle button
|
// Middle button
|
||||||
sendMouseEvent(target, "mousedown", MIDDLE_BUTTON);
|
sendMouseEvent(target, "mousedown", MIDDLE_BUTTON);
|
||||||
sendMouseEvent(target, "mouseup", MIDDLE_BUTTON, "auxclick", checkAllowOpenPopup);
|
sendMouseEvent(target, "mouseup", MIDDLE_BUTTON, "auxclick", checkAllowOpenPopup);
|
||||||
@@ -94,7 +126,20 @@ add_task(function testMouseAuxclick() {
|
|||||||
// Right button
|
// Right button
|
||||||
sendMouseEvent(target, "mousedown", RIGHT_BUTTON);
|
sendMouseEvent(target, "mousedown", RIGHT_BUTTON);
|
||||||
sendMouseEvent(target, "mouseup", RIGHT_BUTTON, "auxclick", checkAllowOpenPopup);
|
sendMouseEvent(target, "mouseup", RIGHT_BUTTON, "auxclick", checkAllowOpenPopup);
|
||||||
});
|
|
||||||
|
await endTest();
|
||||||
|
}
|
||||||
|
|
||||||
|
add_task(testMouseDownUpMove);
|
||||||
|
add_task(testMouseClick);
|
||||||
|
add_task(testMouseAuxclick);
|
||||||
|
|
||||||
|
add_task(() => experimental = true);
|
||||||
|
|
||||||
|
add_task(testMouseDownUpMove);
|
||||||
|
add_task(testMouseClick);
|
||||||
|
add_task(testMouseAuxclick);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<div id="target" style="width: 50px; height: 50px; background: green"></div>
|
<div id="target" style="width: 50px; height: 50px; background: green"></div>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
const experimental = SpecialPowers.getBoolPref("dom.popup.experimental");
|
let experimental = false;
|
||||||
|
|
||||||
function sendMouseEvent(element, eventName, button, listenEventName, handler) {
|
function sendMouseEvent(element, eventName, button, listenEventName, handler) {
|
||||||
let needToCheckHandler = false;
|
let needToCheckHandler = false;
|
||||||
@@ -46,17 +46,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
add_setup(async function() {
|
add_setup(async function() {
|
||||||
if (experimental) {
|
|
||||||
// This is a rather fragile test when experimental pref isn't enabled.
|
|
||||||
// Use default prefs in experimental case.
|
|
||||||
SpecialPowers.wrap(document).clearUserGestureActivation();
|
|
||||||
await SpecialPowers.pushPrefEnv({
|
|
||||||
set: [
|
|
||||||
// Enable popup blocker
|
|
||||||
["dom.disable_open_during_load", true],
|
|
||||||
],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
const DENY_ACTION = SpecialPowers.Ci.nsIPermissionManager.DENY_ACTION;
|
const DENY_ACTION = SpecialPowers.Ci.nsIPermissionManager.DENY_ACTION;
|
||||||
let xorigin = SimpleTest.getTestFileURL("").replace(location.hostname, 'mochi.xorigin-test');
|
let xorigin = SimpleTest.getTestFileURL("").replace(location.hostname, 'mochi.xorigin-test');
|
||||||
await SpecialPowers.pushPermissions([
|
await SpecialPowers.pushPermissions([
|
||||||
@@ -73,7 +62,36 @@
|
|||||||
const RIGHT_BUTTON = 2;
|
const RIGHT_BUTTON = 2;
|
||||||
let target = document.getElementById("target");
|
let target = document.getElementById("target");
|
||||||
|
|
||||||
add_task(async function testPointerEventDefault() {
|
async function beginTest() {
|
||||||
|
if (!experimental) {
|
||||||
|
info("NOT EXPERIMENTAL");
|
||||||
|
await SpecialPowers.pushPrefEnv({
|
||||||
|
set: [
|
||||||
|
["dom.popup.experimental", false]
|
||||||
|
],
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
info("EXPERIMENTAL");
|
||||||
|
// This is a rather fragile test when experimental pref isn't enabled.
|
||||||
|
// Use default prefs in experimental case.
|
||||||
|
SpecialPowers.wrap(document).clearUserGestureActivation();
|
||||||
|
await SpecialPowers.pushPrefEnv({
|
||||||
|
set: [
|
||||||
|
["dom.popup.experimental", true],
|
||||||
|
// Enable popup blocker
|
||||||
|
["dom.disable_open_during_load", true],
|
||||||
|
],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function endTest() {
|
||||||
|
await SpecialPowers.popPrefEnv();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function testPointerEventDefault() {
|
||||||
|
await beginTest();
|
||||||
|
|
||||||
// By default, only allow opening popup in the pointerup listener.
|
// By default, only allow opening popup in the pointerup listener.
|
||||||
// Left button
|
// Left button
|
||||||
sendMouseEvent(target, "mousedown", LEFT_BUTTON, "pointerdown", checkAllowOpenPopup);
|
sendMouseEvent(target, "mousedown", LEFT_BUTTON, "pointerdown", checkAllowOpenPopup);
|
||||||
@@ -95,9 +113,13 @@
|
|||||||
checkBlockOpenPopup);
|
checkBlockOpenPopup);
|
||||||
sendMouseEvent(target, "mousemove", RIGHT_BUTTON, "pointermove", checkBlockOpenPopup);
|
sendMouseEvent(target, "mousemove", RIGHT_BUTTON, "pointermove", checkBlockOpenPopup);
|
||||||
sendMouseEvent(target, "mouseup", RIGHT_BUTTON, "pointerup", checkBlockOpenPopup);
|
sendMouseEvent(target, "mouseup", RIGHT_BUTTON, "pointerup", checkBlockOpenPopup);
|
||||||
});
|
|
||||||
|
|
||||||
add_task(async function testPointerEventAddPointerDownToPref() {
|
await endTest();
|
||||||
|
};
|
||||||
|
|
||||||
|
async function testPointerEventAddPointerDownToPref() {
|
||||||
|
await beginTest();
|
||||||
|
|
||||||
// Adding pointerdown to preference
|
// Adding pointerdown to preference
|
||||||
await SpecialPowers.pushPrefEnv({"set": [["dom.popup_allowed_events",
|
await SpecialPowers.pushPrefEnv({"set": [["dom.popup_allowed_events",
|
||||||
"pointerdown pointerup"]]});
|
"pointerdown pointerup"]]});
|
||||||
@@ -121,9 +143,14 @@
|
|||||||
checkBlockOpenPopup);
|
checkBlockOpenPopup);
|
||||||
sendMouseEvent(target, "mousemove", RIGHT_BUTTON, "pointermove", checkBlockOpenPopup);
|
sendMouseEvent(target, "mousemove", RIGHT_BUTTON, "pointermove", checkBlockOpenPopup);
|
||||||
sendMouseEvent(target, "mouseup", RIGHT_BUTTON, "pointerup", checkBlockOpenPopup);
|
sendMouseEvent(target, "mouseup", RIGHT_BUTTON, "pointerup", checkBlockOpenPopup);
|
||||||
});
|
await SpecialPowers.popPrefEnv();
|
||||||
|
|
||||||
|
await endTest();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function testPointerEventAddPointerMoveToPref() {
|
||||||
|
await beginTest();
|
||||||
|
|
||||||
add_task(async function testPointerEventAddPointerMoveToPref() {
|
|
||||||
// Adding pointermove to preference should have no effect.
|
// Adding pointermove to preference should have no effect.
|
||||||
await SpecialPowers.pushPrefEnv({"set": [["dom.popup_allowed_events",
|
await SpecialPowers.pushPrefEnv({"set": [["dom.popup_allowed_events",
|
||||||
"pointerdown pointerup pointermove"]]});
|
"pointerdown pointerup pointermove"]]});
|
||||||
@@ -147,7 +174,20 @@
|
|||||||
checkBlockOpenPopup);
|
checkBlockOpenPopup);
|
||||||
sendMouseEvent(target, "mousemove", RIGHT_BUTTON, "pointermove", checkBlockOpenPopup);
|
sendMouseEvent(target, "mousemove", RIGHT_BUTTON, "pointermove", checkBlockOpenPopup);
|
||||||
sendMouseEvent(target, "mouseup", RIGHT_BUTTON, "pointerup", checkBlockOpenPopup);
|
sendMouseEvent(target, "mouseup", RIGHT_BUTTON, "pointerup", checkBlockOpenPopup);
|
||||||
});
|
await SpecialPowers.popPrefEnv();
|
||||||
|
|
||||||
|
await endTest();
|
||||||
|
}
|
||||||
|
|
||||||
|
add_task(testPointerEventDefault);
|
||||||
|
add_task(testPointerEventAddPointerDownToPref);
|
||||||
|
add_task(testPointerEventAddPointerMoveToPref);
|
||||||
|
|
||||||
|
add_task(() => experimental = true);
|
||||||
|
|
||||||
|
add_task(testPointerEventDefault);
|
||||||
|
add_task(testPointerEventAddPointerDownToPref);
|
||||||
|
add_task(testPointerEventAddPointerMoveToPref);
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -2298,7 +2298,7 @@
|
|||||||
# Enable experimental popup blocker changes.
|
# Enable experimental popup blocker changes.
|
||||||
- name: dom.popup.experimental
|
- name: dom.popup.experimental
|
||||||
type: bool
|
type: bool
|
||||||
value: false
|
value: @IS_NIGHTLY_BUILD@
|
||||||
mirror: always
|
mirror: always
|
||||||
|
|
||||||
# Enable CacheAPI in private browsing mode with encryption
|
# Enable CacheAPI in private browsing mode with encryption
|
||||||
|
|||||||
Reference in New Issue
Block a user