Closed Bug 1744925 Opened 2 years ago Closed 1 year ago

"WebDriver:ElementClear" emits an extra "change" event for content editable elements

Categories

(Remote Protocol :: Marionette, defect, P3)

Default
defect

Tracking

(firefox112 fixed)

RESOLVED FIXED
112 Branch
Tracking Status
firefox112 --- fixed

People

(Reporter: whimboo, Assigned: canadahonk, Mentored)

References

(Blocks 1 open bug)

Details

(Whiteboard: [lang=js][webdriver:relnote])

Attachments

(1 file)

As it can be seen for the following try build our implementation send an extra change event that is not expected:

[task 2021-12-08T08:22:20.275Z] 08:22:20     INFO - TEST-UNEXPECTED-FAIL | /webdriver/tests/element_clear/clear.py | test_contenteditable - AssertionError: assert ['focus', 'change', 'blur'] == ['focus', 'blur']
[task 2021-12-08T08:22:20.275Z] 08:22:20     INFO - session = <Session 92a354b7-361e-493d-bfb2-cfc0a2dc98ca>
[task 2021-12-08T08:22:20.275Z] 08:22:20     INFO - inline = <function inline.<locals>.inline at 0x7f91a82c57b8>
[task 2021-12-08T08:22:20.276Z] 08:22:20     INFO - add_event_listeners = <function add_event_listeners.<locals>.add_event_listeners at 0x7f91a82c5a60>
[task 2021-12-08T08:22:20.276Z] 08:22:20     INFO - tracked_events = ['blur', 'change', 'focus']
[task 2021-12-08T08:22:20.276Z] 08:22:20     INFO - 
[task 2021-12-08T08:22:20.276Z] 08:22:20     INFO -     def test_contenteditable(session, inline, add_event_listeners, tracked_events):
[task 2021-12-08T08:22:20.276Z] 08:22:20     INFO -         session.url = inline("<p contenteditable>foobar</p>")
[task 2021-12-08T08:22:20.276Z] 08:22:20     INFO -         element = session.find.css("p", all=False)
[task 2021-12-08T08:22:20.276Z] 08:22:20     INFO -         add_event_listeners(element, tracked_events)
[task 2021-12-08T08:22:20.276Z] 08:22:20     INFO -         assert element.property("innerHTML") == "foobar"
[task 2021-12-08T08:22:20.276Z] 08:22:20     INFO -     
[task 2021-12-08T08:22:20.277Z] 08:22:20     INFO -         response = element_clear(session, element)
[task 2021-12-08T08:22:20.277Z] 08:22:20     INFO -         assert_success(response)
[task 2021-12-08T08:22:20.277Z] 08:22:20     INFO -         assert element.property("innerHTML") == ""
[task 2021-12-08T08:22:20.277Z] 08:22:20     INFO - >       assert_events_equal(session, ["focus", "blur"])
[task 2021-12-08T08:22:20.277Z] 08:22:20     INFO - 
[task 2021-12-08T08:22:20.277Z] 08:22:20     INFO - add_event_listeners = <function add_event_listeners.<locals>.add_event_listeners at 0x7f91a82c5a60>
[task 2021-12-08T08:22:20.277Z] 08:22:20     INFO - element    = <Element 0fb75cb2-4ddf-45a8-acef-c1d0b982e407>
[task 2021-12-08T08:22:20.278Z] 08:22:20     INFO - inline     = <function inline.<locals>.inline at 0x7f91a82c57b8>
[task 2021-12-08T08:22:20.278Z] 08:22:20     INFO - response   = <Responsetatus=200 body={"value": null}>
[task 2021-12-08T08:22:20.278Z] 08:22:20     INFO - session    = <Session 92a354b7-361e-493d-bfb2-cfc0a2dc98ca>
[task 2021-12-08T08:22:20.278Z] 08:22:20     INFO - tracked_events = ['blur', 'change', 'focus']

The broken code can be seen here:
https://searchfox.org/mozilla-release/rev/477b22c1301d9c4367f038d0b2e352289b12a045/remote/marionette/interaction.js#356-364

Means we just have to remove the line which emits the change event.

Product: Testing → Remote Protocol

Fixed extra change event being emitted when WebDriver:ElementClear is
called for content editable elements.

Assignee: nobody → oj
Status: NEW → ASSIGNED
Pushed by hskupin@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a92d64d6fd2e
[marionette] Fix extra change event with WebDriver:ElementClear for content editables r=webdriver-reviewers,whimboo
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 112 Branch
Whiteboard: [lang=js] → [lang=js][webdriver:relnote]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: