gecko-dev/widget/tests
Masayuki Nakano 90cd2122dd Bug 970802 - part 5: Make `AutoEditActionDataSetter` created method dispatch "beforeinput" event r=smaug,m_kato
`AutoEditActionDataSetter` is created in the stack when editor's public method
is called and that guarantees lifetime of global objects in editor such as
editor itself, selection controller, etc.

The dispatcher of `beforeinput` event returns `NS_ERROR_EDITOR_ACTION_CANCELED`
if an event is actually dispatched but canceled.  The reason why it's an error
is, editor code must stop handling anything when any methods return error.
So, returning an error code is reasonable in editor module.  But when it's
filtered by `EditorBase::ToGenericNSResult()` at return statement of public
methods, it's converted to `NS_SUCCESS_DOM_NO_OPERATION`.  This avoids throwing
new exception, but editor class users in C++ can distinguish whether each edit
action is canceled or handled.  The reason why we should not throw new
exception from XPCOM API is, without taking care of each caller may break some
our UI (especially for avoiding to break comm-central).  Therefore, this patch
does not make XPCOM methods return error code when `beforeinput` event is
canceled.

In most cases, immediately after creating `AutoEditActionDataSetter` is good
timing to dispatch `beforeinput` event since editor has not touched the DOM
yet.  If `beforeinput` requires `data` or `dataTransfer`, methods need to
dispatch `beforeinput` event after that.  Alhtough this is not a good thing
from point of view of consistency of the code.  However, I have no better
idea.

Note 1: Our implementation does NOT conform to the spec about event order
between `keypress` and `beforeinput` (dispatching `beforeinput` event after
`keypress` event).  However, we follow all other browsers' behavior so that it
must be safe and the spec should be updated for backward compatibility.
Spec issue: https://github.com/w3c/uievents/issues/220

Note 2: Our implementation does NOT conform to the spec about event order
between `compositionupdate` and `beforeinput`.  Our behavior is same as
Safari, but different from Chrome.  This might cause web-compat issues.
However, our behavior does make sense from point of view of consistency of
event spec.  Additionally, at both `compositionupdate` and `beforeinput`,
composition string in editor has not been modified yet.  Therefore, this
may not cause web-compat issues (and I hope so).
Spec issue: https://github.com/w3c/input-events/issues/49

Note that this patch makes editor detect bugs that `beforeinput` event hasn't
been handled yet when it dispatches `input` event or modifying `data` and
`dataTransfer` value are modified after dispatching `beforeinput` event with
`MOZ_ASSERT`s.

Differential Revision: https://phabricator.services.mozilla.com/D58127

--HG--
extra : moz-landing-system : lando
2020-01-14 07:18:51 +00:00
..
browser Bug 1608080 - Disable widget/tests/browser/browser_test_clipboardcache.js as it is consistently timing out with the Linux coverage build. r=aryx 2020-01-10 10:56:57 +00:00
unit Bug 1571656 - Use Assert.jsm numeric comparison functions in tests r=mixedpuppy,MattN 2019-11-18 13:03:58 +00:00
.eslintrc.js
TestAppShellSteadyState.cpp Bug 1470510 - Rename nsXULWindow and nsIXULWindow to AppWindow and nsIAppWindow. r=smaug 2019-11-05 17:56:28 +00:00
TestChromeMargin.cpp
bug586713_window.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
chrome.ini Bug 1600333 - Remove all tags = clipboard from the codebase r=gbrown 2019-12-05 11:07:10 +00:00
chrome_context_menus_win.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
empty_window.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
file_bug596600.html
file_input_events_on_deactive_window.html
file_secure_input.html
mochitest.ini Bug 1599943 - mark widget/tests/test_scrollbar_colors.html as expected failure on ubuntu1804 r=jmaher 2019-12-10 17:58:53 +00:00
moz.build Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
native_menus_window.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
native_mouse_mac_window.xhtml Bug 1601113, replace URIs ending in vnd.mozilla.xul+xml with xhtml+xml r=bgrins 2019-12-17 00:33:16 +00:00
standalone_native_menu_window.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
system_font_changes.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
taskbar_previews.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_AltGr_key_events_in_web_content_on_windows.html
test_actionhint.html
test_assign_event_data.html
test_bug343416.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_bug413277.html
test_bug428405.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_bug429954.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_bug444800.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_bug466599.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_bug478536.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_bug485118.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_bug517396.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_bug522217.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_bug538242.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_bug565392.html
test_bug586713.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_bug593307.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_bug596600.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_bug673301.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_bug760802.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_bug1123480.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_bug1151186.html
test_chrome_context_menus_win.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_clipboard.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_composition_text_querycontent.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_imestate.html Bug 1596800 - Remove document.getBindingParent. r=smaug 2019-11-18 19:06:51 +00:00
test_input_events_on_deactive_window.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_key_event_counts.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_keycodes.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_keypress_event_with_alt_on_mac.html
test_mouse_scroll.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_native_key_bindings_mac.html
test_native_menus.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_native_mouse_mac.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_panel_mouse_coords.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_picker_no_crash.html Bug 1553804: Part 6 - Fix chrome mochitests which open chrome windows with content openers. r=nika 2019-09-20 10:18:15 -07:00
test_platform_colors.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_plugin_input_event.html
test_plugin_scroll_consistency.html
test_position_on_resize.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_scrollbar_colors.html
test_secure_input.html Bug 1553804: Part 6 - Fix chrome mochitests which open chrome windows with content openers. r=nika 2019-09-20 10:18:15 -07:00
test_sizemode_events.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_standalone_native_menu.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_system_font_changes.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_system_status_bar.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_taskbar_progress.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_transferable_overflow.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
test_wheeltransaction.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
utils.js Bug 1561435 - Format widget/, a=automatic-formatting 2019-07-05 11:19:19 +02:00
window_bug429954.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
window_bug478536.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
window_bug522217.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
window_bug538242.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
window_bug593307_centerscreen.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
window_bug593307_offscreen.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
window_composition_text_querycontent.xhtml Bug 970802 - part 5: Make `AutoEditActionDataSetter` created method dispatch "beforeinput" event r=smaug,m_kato 2020-01-14 07:18:51 +00:00
window_imestate_iframes.html Bug 1553804: Part 6 - Fix chrome mochitests which open chrome windows with content openers. r=nika 2019-09-20 10:18:15 -07:00
window_mouse_scroll_win.html Bug 1553804: Part 6 - Fix chrome mochitests which open chrome windows with content openers. r=nika 2019-09-20 10:18:15 -07:00
window_picker_no_crash_child.html
window_state_windows.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00
window_wheeltransaction.xhtml Bug 1596327, rename .xul test files in widget/ to .xhtml r=jmathies 2019-11-20 19:05:30 +00:00