gecko-dev/browser
Masayuki Nakano 00f4c31bb7 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 01:09:45 +00:00
..
actors Bug 1601301, add an 'include descendants' flag to mediaCaptureWindowState. With fission, need to handle each subframe separately, r=jib 2020-01-10 15:29:08 +00:00
app Backed out changeset 7c414004b82a (bug 1603356) for dt failures. CLOSED TREE 2020-01-13 21:04:23 +02:00
base Bug 1544975 remove private window extension change notification r=robwu,fluent-reviewers 2020-01-03 23:01:54 +00:00
branding Bug 1575658 - Moved firefox-wordmark.svg to browser/branding r=MattN,Mardak 2019-12-10 21:08:57 +00:00
components Bug 1608925 - Stub out Personalization reducer component and devtools. r=gvn 2020-01-14 00:40:02 +00:00
config Backed out changeset dd2f16711aba (bug 1606922) for causing build failures 2020-01-11 03:08:34 +02:00
docs Bug 1595953 - Connect UITour-lib.js docs to sphinx-js to publish on firefox-source-docs. r=markh 2019-11-13 02:40:03 +00:00
extensions Bug 970802 - part 5: Make `AutoEditActionDataSetter` created method dispatch "beforeinput" event r=smaug,m_kato 2020-01-14 01:09:45 +00:00
fonts Bug 1592801 - Update Twemoji Mozilla to 0.5.0 (twemoji 12.1.3). r=jfkthame 2019-11-20 23:01:14 +00:00
fxr Bug 1601301, rework webrtc permission granting UI around JSWindowActor, performing the work of determining the ultimate state for the tab icon and menu in the parent rather than the content process, r=johannh 2020-01-10 15:09:59 +00:00
installer Bug 1606596 - Install/uninstall an HKCR\Applications key for firefox.exe. r=agashlin 2020-01-10 21:34:37 +00:00
locales Bug 1544975 remove private window extension change notification r=robwu,fluent-reviewers 2020-01-03 23:01:54 +00:00
modules Bug 1544975 remove private window extension change notification r=robwu,fluent-reviewers 2020-01-03 23:01:54 +00:00
themes Bug 1544975 remove private window extension change notification r=robwu,fluent-reviewers 2020-01-03 23:01:54 +00:00
tools/mozscreenshots Bug 1596918: Part 4g - Misc cleanup/fixes. r=mccr8 2019-12-13 20:36:48 +00:00
.eslintrc.js
LICENSE
Makefile.in
app.mozbuild
build.mk
confvars.sh Bug 1606274 - Remove always-true MOZ_PHOENIX macro. r=firefox-build-system-reviewers,rstewart 2019-12-30 15:00:20 +00:00
defs.mk
l10n-registry.manifest
moz.build
moz.configure