Closed Bug 1866124 Opened 10 months ago Closed 10 months ago

[wpt-sync] Sync PR 43270 - [EditContext] Ensure that ExecutionContext of the associated element is used

Categories

(Core :: DOM: Editor, task, P4)

task

Tracking

()

RESOLVED FIXED
122 Branch
Tracking Status
firefox122 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

(Blocks 1 open bug, )

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 43270 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/43270
Details from upstream follow.

Dan Clark <daniec@microsoft.com> wrote:

[EditContext] Ensure that ExecutionContext of the associated element is used

Currently if an author tries to associate an EditContext with an
Element in a document that's different from the document where it was
constructed, the EditContext will make the associated element editable
but not capture text input. The reason is that in
EditContext::Focus(),
the call to do GetInputMethodController().SetActiveEditContext(this)
is getting the InputMethodController for the ExecutionContext that
the EditContext was constructed with, not the InputMethodController
for the document the EditContext is now associated with. So to the
InputMethodController that ends up receiving the text input, it
looks like there is no active EditContext.

Fix this by updating the EditContext's ExecutionContext whenever an
associated element is set.

An alternative considered was to have EditContext no longer store
the ExecutionContext directly at all and instead always get it from
the associated element. However there are some cases where this is
problematic. For example when DispatchTextFormatEvent is called
immediately before DispatchCompositionEndEvent, the EditContext
could be detached from its element in the textformatupdate
handler, which would then cause problems in
DispatchCompositionEndEvent since it uses the ExecutionContext
via the DomWindow() call.

Bug: 1468441
Change-Id: Ic68d57f360a2d1d72fdc786ef9c4ea0d028ce9ce
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5046158
Reviewed-by: Koji Ishii \<kojii@chromium.org>
Reviewed-by: Anupam Snigdha \<snianu@microsoft.com>
Commit-Queue: Dan Clark \<daniec@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1228072}

Component: web-platform-tests → DOM: Editor
Product: Testing → Core

CI Results

Ran 9 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 1 tests and 6 subtests

Status Summary

Firefox

OK : 1
FAIL: 6

Chrome

OK : 1
PASS: 4
FAIL: 2

Safari

OK : 1
FAIL: 6

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

New Tests That Don't Pass

  • /editing/edit-context/edit-context-input.tentative.html [wpt.fyi]
    • Testing EditContext English typing: FAIL (Chrome: PASS, Safari: FAIL)
    • EditContext should disable DOM mutation: FAIL (Chrome: PASS, Safari: FAIL)
    • beforeInput(insertText) should be cancelable: FAIL (Chrome: PASS, Safari: FAIL)
    • EditContext should not receive events after being detached from element: FAIL (Chrome: FAIL, Safari: FAIL)
    • Backspace and delete in EditContext: FAIL (Chrome: PASS, Safari: FAIL)
    • EditContext constructed outside iframe can be used in iframe: FAIL (Chrome: FAIL, Safari: FAIL)
Pushed by wptsync@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/49a72266049e [wpt PR 43270] - [EditContext] Ensure that ExecutionContext of the associated element is used, a=testonly https://hg.mozilla.org/integration/autoland/rev/bee439eda1e3 [wpt PR 43270] - Update wpt metadata, a=testonly
Status: NEW → RESOLVED
Closed: 10 months ago
Resolution: --- → FIXED
Target Milestone: --- → 122 Branch
You need to log in before you can comment on or make changes to this bug.