Bug 1896599 - Remove event-from-input support. r=Jamie,devtools-reviewers,eeejay,nchevobbe

As per the comments it isn't supported with cache-the-world on, it's
barely documented if at all, and a test for it seems to be failing
without me being able to reproduce it at least (tried on both windows
and Linux).

I don't think it's worth digging too much more into it. My guess is a
reentrant / differently timed a11y event caused by my scheduling
changes, or so, which would override sEventTargetNode or the other
static bool.

The test has ~always failed on macOS too...

Differential Revision: https://phabricator.services.mozilla.com/D210872
This commit is contained in:
Emilio Cobos Álvarez 2024-05-23 12:09:21 +00:00
parent b4fa4ce762
commit e1bbbb144c
7 changed files with 1 additions and 129 deletions

View file

@ -5,11 +5,9 @@
#include "nsEventShell.h"
#include "nsAccUtils.h"
#include "nsAccessibilityService.h"
#include "Logging.h"
#include "AccAttributes.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/dom/DOMStringList.h"
using namespace mozilla;
@ -25,12 +23,6 @@ void nsEventShell::FireEvent(AccEvent* aEvent) {
LocalAccessible* accessible = aEvent->GetAccessible();
NS_ENSURE_TRUE_VOID(accessible);
nsINode* node = accessible->GetNode();
if (node) {
sEventTargetNode = node;
sEventFromUserInput = aEvent->IsFromUserInput();
}
#ifdef A11Y_LOG
if (logging::IsEnabled(logging::eEvents)) {
logging::MsgBegin("EVENTS", "events fired");
@ -53,8 +45,6 @@ void nsEventShell::FireEvent(AccEvent* aEvent) {
accessible->HandleAccEvent(aEvent);
aEvent->mEventRule = AccEvent::eDoNotEmit;
sEventTargetNode = nullptr;
}
void nsEventShell::FireEvent(uint32_t aEventType, LocalAccessible* aAccessible,
@ -66,16 +56,3 @@ void nsEventShell::FireEvent(uint32_t aEventType, LocalAccessible* aAccessible,
FireEvent(event);
}
void nsEventShell::GetEventAttributes(nsINode* aNode,
AccAttributes* aAttributes) {
if (aNode != sEventTargetNode) return;
aAttributes->SetAttribute(nsGkAtoms::eventFromInput, sEventFromUserInput);
}
////////////////////////////////////////////////////////////////////////////////
// nsEventShell: private
bool nsEventShell::sEventFromUserInput = false;
StaticRefPtr<nsINode> nsEventShell::sEventTargetNode;

View file

@ -47,20 +47,6 @@ class nsEventShell {
: mozilla::a11y::eNoUserInput));
FireEvent(stateChangeEvent);
}
/**
* Append 'event-from-input' object attribute if the accessible event has
* been fired just now for the given node.
*
* @param aNode [in] the DOM node
* @param aAttributes [in, out] the attributes
*/
static void GetEventAttributes(nsINode* aNode,
mozilla::a11y::AccAttributes* aAttributes);
private:
static mozilla::StaticRefPtr<nsINode> sEventTargetNode;
static bool sEventFromUserInput;
};
#endif

View file

@ -1182,8 +1182,6 @@ already_AddRefed<AccAttributes> LocalAccessible::NativeAttributes() {
// xul tree item) then don't calculate content based attributes.
if (!HasOwnContent()) return attributes.forget();
nsEventShell::GetEventAttributes(GetNode(), attributes);
// Get container-foo computed live region properties based on the closest
// container with the live region attribute. Inner nodes override outer nodes
// within the same document. The inner nodes can be used to override live

View file

@ -22,8 +22,6 @@ support-files = [
["test_attrchange.html"]
["test_attrs.html"]
["test_bug1322593-2.html"]
["test_bug1322593.html"]

View file

@ -1,85 +0,0 @@
<html>
<head>
<title>Event object attributes tests</title>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
<script type="application/javascript"
src="../common.js"></script>
<script type="application/javascript"
src="../events.js"></script>
<script type="application/javascript"
src="../attributes.js"></script>
<script type="application/javascript">
/**
* Test "event-from-input" object attribute.
*/
function eventFromInputChecker(aEventType, aID, aValue, aNoTargetID) {
this.type = aEventType;
this.target = getAccessible(aID);
this.noTarget = getNode(aNoTargetID);
this.check = function checker_check(aEvent) {
testAttrs(aEvent.accessible, { "event-from-input": aValue }, true);
var accessible = getAccessible(this.noTarget);
testAbsentAttrs(accessible, { "event-from-input": "" });
};
}
/**
* Do tests.
*/
var gQueue = null;
// gA11yEventDumpID = "eventdump"; // debug stuff
// gA11yEventDumpToConsole = true; // debug stuff
function doTests() {
gQueue = new eventQueue();
var id = "textbox", noTargetId = "textarea";
let checker =
new eventFromInputChecker(EVENT_FOCUS, id, "false", noTargetId);
gQueue.push(new synthFocus(id, checker));
if (!MAC) { // Mac failure is bug 541093
checker =
new eventFromInputChecker(EVENT_TEXT_CARET_MOVED, id, "true", noTargetId);
gQueue.push(new synthHomeKey(id, checker));
}
gQueue.invoke(); // Will call SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTests);
</script>
</head>
<body>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=540285"
title="Event object attributes testing">
Mozilla Bug 540285
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<input id="textbox" value="hello">
<textarea id="textarea"></textarea>
<div id="eventdump"></div>
</body>
</html>

View file

@ -105,7 +105,6 @@ add_task(async function () {
attributes: {
"container-live": "polite",
display: "inline-block",
"event-from-input": "false",
"explicit-name": "true",
id: "button",
live: "polite",

View file

@ -2341,7 +2341,6 @@ STATIC_ATOMS = [
Atom("contentinfo", "contentinfo"),
Atom("cycles", "cycles"),
Atom("datatable", "datatable"),
Atom("eventFromInput", "event-from-input"),
Atom("feed", "feed"),
Atom("grammar", "grammar"),
Atom("gridcell", "gridcell"),