Assertion failure: !newEditingHost->IsInNativeAnonymousSubtree(), at /home/worker/workspace/build/src/dom/base/Selection.cpp:3740
Categories
(Core :: DOM: Selection, defect, P3)
Tracking
()
People
(Reporter: jkratzer, Assigned: masayuki)
References
(Blocks 4 open bugs)
Details
(Keywords: assertion, pernosco, testcase)
Attachments
(8 files, 1 obsolete file)
|
808 bytes,
text/html
|
Details | |
|
991 bytes,
text/html
|
Details | |
|
844 bytes,
text/html
|
Details | |
|
389 bytes,
text/html
|
Details | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review |
Updated•8 years ago
|
Updated•8 years ago
|
Comment 1•8 years ago
|
||
Comment 2•8 years ago
|
||
Updated•8 years ago
|
Comment 3•8 years ago
|
||
Comment 4•8 years ago
|
||
Comment 5•8 years ago
|
||
Comment 6•8 years ago
|
||
Comment 7•8 years ago
|
||
Comment 8•8 years ago
|
||
Comment 9•8 years ago
|
||
Comment 10•8 years ago
|
||
Comment 11•8 years ago
|
||
| Assignee | ||
Comment 12•8 years ago
|
||
Comment 13•8 years ago
|
||
Comment 14•7 years ago
|
||
Comment 15•7 years ago
|
||
Updated•3 years ago
|
| Assignee | ||
Comment 17•2 years ago
|
||
I don't reproduce the assertion failure in debug build. Did we fix that Selection::Modify result may cross native anonymous subtree boundaries?
| Assignee | ||
Comment 18•2 years ago
|
||
On the other hand, I think that we should guarantee that nsIContent::GetEditingHost() won't return <foo contenteditable> when the content is in a native anonymous subtree because currently, we don't have such feature and returning editing host with crossing native anonymous subtree boundary is not necessary (and I think it's odd).
Comment 19•2 years ago
|
||
Another more recent test case.
Comment 20•2 years ago
|
||
Masayuki would a Pernosco session be helpful?
| Assignee | ||
Comment 21•2 years ago
|
||
Yeah, if there is, please. Otherwise, I'll try to debug with the debugger.
Thank you for the reproducible testcase.
Comment 22•2 years ago
|
||
A Pernosco session is available here: https://pernos.co/debug/D-Y9tq8T_guvcicls3S3ig/index.html
| Assignee | ||
Comment 24•2 years ago
|
||
It's called by PeekOffsetFor* and GetPrevNextBidiLevels, so it's used for
considering whether to put caret or move a selection range boundary.
Therefore, it should treat nodes which can be managed by Selection as
selectable. In theory, even if a native anonymous subtree does not have
an independent selection, its content nodes should not be the container of
the selection range boundaries of selection outside the subtree since
Selection API shouldn't expose nodes in native anonymous subtrees. Therefore,
it can simply treat content nodes in different anonymous subtrees are not
selectable.
Note that it's not standardized that how Selection.modify works with various
content nodes.
https://w3c.github.io/selection-api/#dom-selection-modify
And also Chrome cannot cross generated content like form controls with this API.
This could cause web-compat issues, but it does not make sense for caret
navigation, and anyway out of scope of this bug. Therefore, this patch just
adds the crash test.
| Assignee | ||
Comment 25•2 years ago
|
||
Comment 26•2 years ago
|
||
Comment 28•2 years ago
|
||
Backed out for causing failures on test_atcaretoffset.html
| Assignee | ||
Comment 30•2 years ago
•
|
||
Really really odd... Indeed, test_atcaretoffset.html fails in my environment too. However, even if I add MOZ_CRASH in the added path, the test runs. I.e., it does not run into the new path.
On the other hand, test_wordboundary.html passes completely in my environment... So, I have no idea why they fail in CI.
| Assignee | ||
Comment 31•2 years ago
|
||
Odd, it fails only in the mode of "a11y-no-cache-1proc". Sounds like that its created a11y tree and the others' ones are different.
| Assignee | ||
Comment 32•2 years ago
|
||
When it fails, I verified that the new path runs within this call stack in a child process:
#01: NS_DebugBreak (xpcom\base\nsDebugImpl.cpp:492)
#02: nsIFrame::GetFrameFromDirection (layout\generic\nsIFrame.cpp:9611)
#03: nsIFrame::PeekOffsetForWord (layout\generic\nsIFrame.cpp:9046)
#04: nsIFrame::PeekOffset (layout\generic\nsIFrame.cpp:9336)
#05: mozilla::a11y::HyperTextAccessible::FindOffset (accessible\generic\HyperTextAccessible.cpp:546)
#06: mozilla::a11y::HyperTextAccessible::TextBeforeOffset (accessible\generic\HyperTextAccessible.cpp:988)
#07: mozilla::a11y::xpcAccessibleHyperText::GetTextBeforeOffset (accessible\xpcom\xpcAccessibleHyperText.cpp:82)
| Assignee | ||
Comment 33•2 years ago
|
||
The scan start frame is considered in HyperTextAccessible::FindOffset, however, with the patch, childFrame->GetChildFrameContainingOffset in the frame won't return text frame in <textarea> anymore.
According to the other conditions' result of a11y tests, a11y module wants to traverse frames across native anonymous subtree boundaries.
James: Is it what a11y module wants? Or just aligned for the behavior of nsIFrame::PeekOffset? For the other users of nsIFrame::PeekOffset, it won't cross the native anonymous subtree boundaries from parent to child. Therefore, I try to do it. However, a11y module keeps wanting to cross the boundaries, I'll create an option for it.
Comment 34•2 years ago
|
||
First, the reason this only fails in the no-cache test variant is that the new a11y caching architecture has a completely different text implementation that doesn't rely on PeekOffset and is more aligned with what a11y needs. The timing here is tricky. On one hand, we aim to ship this new architecture very soon. It's unfortunately too risky to just ship it immediately, but we're about to launch a release experiment and we'll hopefully ship to all users on release a few weeks after that if all goes well. On the other hand, waiting for that would delay your patch by several weeks at minimum.
Second, what a11y wants here is to navigate from a given offset in a text node to get the next/previous word, line, etc. I'm not quite clear on what childFrame is in childFrame->GetChildFrameContainingOffset in the textarea case. Is childFrame not the primary text frame? We could probably just tweak the a11y code to start with the right frame in this special case.
| Assignee | ||
Comment 35•2 years ago
|
||
(In reply to James Teh [:Jamie] from comment #34)
Second, what a11y wants here is to navigate from a given offset in a text node to get the next/previous word, line, etc. I'm not quite clear on what childFrame is in
childFrame->GetChildFrameContainingOffsetin the textarea case. Is childFrame not the primary text frame? We could probably just tweak the a11y code to start with the right frame in this special case.
Yeah, the failure means that the childFrame is a frame outside the TextControlFrame of <textarea> or the TextControlFrame itself. I'll check which frame is the childFrame after lunch.
| Assignee | ||
Comment 36•2 years ago
|
||
Hmm, odd.
0:16.05 PASS getTextBeforeOffset (word start): wrong end offset(got '0', expected: '0'), offset: -2, id: 'textarea' ;
0:16.07 GECKO(6496) childFrame: 0000027828813940 (000002782880FA80, #text.div.textarea['textarea'].pre['test'].body.html.#document)
0:16.07 GECKO(6496) frameAtOffset: 0000027828813940 (000002782880FA80 #text.div.textarea['textarea'].pre['test'].body.html.#document)
0:16.07 GECKO(6496) aFrame: 0000000000000000 (000002782880F200 #text.pre['test'].body.html.#document)
0:16.07 GECKO(6496) this: 0000027828813940 (000002782880FA80 #text.div.textarea['textarea'].pre['test'].body.html.#document)
0:16.07 GECKO(6496) aFrame: 0000000000000000 (000002782880F200 #text.pre['test'].body.html.#document)
0:16.07 GECKO(6496) this: 0000027828813940 (000002782880FA80 #text.div.textarea['textarea'].pre['test'].body.html.#document)
0:16.07 GECKO(6496) aFrame: 0000000000000000 (0000027828813EE0 p['display'].body.html.#document)
0:16.07 GECKO(6496) this: 0000027828813940 (000002782880FA80 #text.div.textarea['textarea'].pre['test'].body.html.#document)
0:16.07 GECKO(6496) aFrame: 0000000000000000 (000002782880FE80 #text.a.body.html.#document)
0:16.07 GECKO(6496) this: 0000027828813940 (000002782880FA80 #text.div.textarea['textarea'].pre['test'].body.html.#document)
0:16.07 GECKO(6496) childFrame: 0000027828813940 (000002782880FA80, #text.div.textarea['textarea'].pre['test'].body.html.#document)
0:16.07 GECKO(6496) frameAtOffset: 0000027828813940 (000002782880FA80 #text.div.textarea['textarea'].pre['test'].body.html.#document)
0:16.06 FAIL getTextBeforeOffset (word end): wrong text (got '
', expected: ''), offset: -2, id: 'textarea' ;
The first address is the anonymous subtree root of the content of the frame. Next address is the content of the frame. And the last path is the content of the frame's path. aFrame and this are in the IsSelectable at here. So it fails to scan a word in <textarea> starting from the previous text node in <a>.
If I back it out my change, I don't see the scan starting from #text.a.body.html.#document. Therefore, my change changes the previous result of the failing test... It seems that the simplest fix is, making nsPeekOffsetStruct take new option to keep traversing frames in native anonymous subtrees.
Comment 37•2 years ago
•
|
||
:( That is unfortunate given how close a11y is to not needing PeekOffset at all. I guess it's not so hard to remove that option later though.
Comment 38•2 years ago
|
||
I put a note in bug 1821951 comment 1 to remove this PeekOffset flag once a11y doesn't need it.
| Assignee | ||
Comment 39•2 years ago
|
||
Yeah, and I don't like a lot of bools in nsPeekOffsetStruct and in the handlers. Therefore, I'll rewrite them with an EnumSet. Then, only the endpoints will need to be removed.
Updated•2 years ago
|
Updated•2 years ago
|
| Assignee | ||
Comment 40•2 years ago
|
||
The constructor of nsPeekOffsetStruct and nsIFrame::GetFrameFromDirection
take too many bool arguments. Therefore, adding new bool arguments does
not make sense. Now, we have a useful mozilla:EnumSet class to treat them
with an enum class. Therefore, let's change nsPeekOffsetStruct with it.
Depends on D172347
| Assignee | ||
Comment 41•2 years ago
|
||
The a11y module wants to traverse frames in native anonymous subtrees.
Therefore, this patch adds new option for allowing it, makes
nsIFrame::GetFrameFromDirection check it before comparing native anonymous
subtree root nodes, and makes HyperTextAccessible::FindOffset use the
option.
Depends on D172758
Comment 42•2 years ago
|
||
Comment 43•2 years ago
|
||
Backed out 4 changesets (Bug 1384606) for causing build bustage in nsFrameSelection.h CLOSED TREE
Log: https://treeherder.mozilla.org/logviewer?job_id=409240439&repo=autoland&lineNumber=7018
Backout: https://hg.mozilla.org/integration/autoland/rev/7a93650998b38d6a5797322b868da6153407d268
| Assignee | ||
Comment 44•2 years ago
|
||
Oh, sorry. I didn't update part.4 for the latest part.3.
Comment 46•2 years ago
|
||
Comment 47•2 years ago
|
||
Backed out for causing mochitest browser a11y failures on browser_text_basics.js.
[task 2023-03-17T07:43:47.528Z] 07:43:47 INFO - TEST-PASS | accessible/tests/browser/mac/browser_text_basics.js | attributed text matches non-attributed text -
[task 2023-03-17T07:43:47.528Z] 07:43:47 INFO - Buffered messages finished
[task 2023-03-17T07:43:47.529Z] 07:43:47 INFO - TEST-UNEXPECTED-FAIL | accessible/tests/browser/mac/browser_text_basics.js | At index 282: right word matches - Got " deceived you, ", expected " "
[task 2023-03-17T07:43:47.530Z] 07:43:47 INFO - Stack trace:
[task 2023-03-17T07:43:47.530Z] 07:43:47 INFO - chrome://mochikit/content/browser-test.js:test_is:1512
[task 2023-03-17T07:43:47.530Z] 07:43:47 INFO - chrome://mochitests/content/browser/accessible/tests/browser/mac/browser_text_basics.js:testRangeAtMarker:9
[task 2023-03-17T07:43:47.530Z] 07:43:47 INFO - chrome://mochitests/content/browser/accessible/tests/browser/mac/browser_text_basics.js:testWords:70
[task 2023-03-17T07:43:47.530Z] 07:43:47 INFO - chrome://mochitests/content/browser/accessible/tests/browser/mac/browser_text_basics.js:testMarkerIntegrity:168
[task 2023-03-17T07:43:47.530Z] 07:43:47 INFO - chrome://mochitests/content/browser/accessible/tests/browser/mac/browser_text_basics.js:null:272
[task 2023-03-17T07:43:47.530Z] 07:43:47 INFO - chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js:accessibleTask/</<:557
[task 2023-03-17T07:43:47.530Z] 07:43:47 INFO - resource://testing-common/BrowserTestUtils.sys.mjs:withNewTab:154
[task 2023-03-17T07:43:47.530Z] 07:43:47 INFO - chrome://mochitests/content/browser/accessible/tests/browser/shared-head.js:accessibleTask/<:476
[task 2023-03-17T07:43:47.530Z] 07:43:47 INFO - chrome://mochikit/content/browser-test.js:handleTask:1039
[task 2023-03-17T07:43:47.530Z] 07:43:47 INFO - chrome://mochikit/content/browser-test.js:_runTaskBasedTest:1111
[task 2023-03-17T07:43:47.530Z] 07:43:47 INFO - chrome://mochikit/content/browser-test.js:Tester_execTest:1253
[task 2023-03-17T07:43:47.530Z] 07:43:47 INFO - chrome://mochikit/content/browser-test.js:nextTest/<:1028
[task 2023-03-17T07:43:47.530Z] 07:43:47 INFO - chrome://mochikit/content/tests/SimpleTest/SimpleTest.js:SimpleTest.waitForFocus/<:1053
[task 2023-03-17T07:43:47.530Z] 07:43:47 INFO - TEST-PASS | accessible/tests/browser/mac/browser_text_basics.js | attributed text matches non-attributed text -
| Assignee | ||
Comment 49•2 years ago
•
|
||
Hmm. The known intemittent failue hid it from my eyes sorry.
| Assignee | ||
Comment 50•2 years ago
|
||
Ah, HyperTextAccessibleWrap.mm is the implementation of what I changed in part.4...
Comment 51•2 years ago
|
||
Comment 52•2 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/1da78b470683
https://hg.mozilla.org/mozilla-central/rev/4e426b984cbc
https://hg.mozilla.org/mozilla-central/rev/38940e315386
https://hg.mozilla.org/mozilla-central/rev/9bf85e2170e0
Updated•2 years ago
|
Description
•