<textarea> validity state is not preserved correctly after a clone.
Categories
(Core :: DOM: Core & HTML, defect, P2)
Tracking
()
People
(Reporter: emilio, Assigned: emilio)
References
Details
(Keywords: topcrash)
Crash Data
Attachments
(2 files, 1 obsolete file)
This is the underlying cause of bug 1472027. See the test-case (should alert the same twice). The reason for this is that CloneAndAdopt calls AppendChild with aNotify == false. This makes HTMLTextAreaElement::ContentAppended to not be invoked, and thus the validity state to not be updated correctly. Probably HTMLInputElement is also affected, though I haven't checked. We'll update the validity state whenever we recompute it, in the case of bug 1472027 when BindToTree is called, from the frame constructor. That is, not good.
Assignee | ||
Comment 1•6 years ago
|
||
Should we notify from CloneAndAdopt? Looks like it shouldn't be too harfmul...
Assignee | ||
Comment 2•6 years ago
|
||
This should be fine I think, given we should notify only to the cloned subtree.
Assignee | ||
Comment 3•6 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=42033fa7b497a8baf0f9132a8d3906e27b04f76d I would expect a couple other CSS failures from other patches in my queue, but nothing catastrophic.
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Updated•6 years ago
|
Comment 4•6 years ago
|
||
> We'll update the validity state whenever we recompute it, in the case of bug 1472027 when BindToTree is called
This can happen for other reasons too, right? For example, consider this case:
<!doctype html>
<style>
textarea:invalid { border: 5px solid red; }
</style>
<fieldset disabled>
<textarea required></textarea>
</fieldset>
<script>
onload = function() {
document.body.offsetWidth;
var t = document.querySelector("textarea");
var f = document.querySelector("fieldset");
f.appendChild(t.cloneNode(true));
}
</script>
in which case the textarea is invalid when returned from cloneNode but becomes valid (due to being disabled) once it's appended to the fieldset.
Comment 5•6 years ago
|
||
> Probably HTMLInputElement is also affected, though I haven't checked.
HTMLInputElement validity does not depend on kids, so no.
Assignee | ||
Comment 6•6 years ago
|
||
(In reply to Boris Zbarsky [:bz] (no decent commit message means r-) from comment #4) > > We'll update the validity state whenever we recompute it, in the case of bug 1472027 when BindToTree is called > > This can happen for other reasons too, right? For example, consider this > case: > > <!doctype html> > <style> > textarea:invalid { border: 5px solid red; } > </style> > <fieldset disabled> > <textarea required></textarea> > </fieldset> > <script> > onload = function() { > document.body.offsetWidth; > var t = document.querySelector("textarea"); > var f = document.querySelector("fieldset"); > f.appendChild(t.cloneNode(true)); > } > </script> > > in which case the textarea is invalid when returned from cloneNode but > becomes valid (due to being disabled) once it's appended to the fieldset. Sure, but that's not concerning re(In reply to Boris Zbarsky [:bz] (no decent commit message means r-) from comment #4) > > We'll update the validity state whenever we recompute it, in the case of bug 1472027 when BindToTree is called > > This can happen for other reasons too, right? For example, consider this > case: > > <!doctype html> > <style> > textarea:invalid { border: 5px solid red; } > </style> > <fieldset disabled> > <textarea required></textarea> > </fieldset> > <script> > onload = function() { > document.body.offsetWidth; > var t = document.querySelector("textarea"); > var f = document.querySelector("fieldset"); > f.appendChild(t.cloneNode(true)); > } > </script> > > in which case the textarea is invalid when returned from cloneNode but > becomes valid (due to being disabled) once it's appended to the fieldset. Sure, but in the <svg:use> case the <textarea> would belong to a different anonymous subtree, so I don't think we look past the anonymous <use> shadow tree root.
Comment 7•6 years ago
|
||
(got mid-air'ed) This does regress, as an example, cloning of single page HTML spec document ~25%. And we do clone documents for printing and print preview. And this would make bug 1232023 possibly worse (locally I'm getting similar numbers in Nightly and Chrome using testcase in that bug).
Comment 8•6 years ago
|
||
Comment on attachment 8988724 [details] Bug 1472169: Notify of appends from CloneAndAdopt clone path. r=smaug Because of the performance implications, I'm not ready to take this patch without some more investigation whether this could be fixed in other ways.
Comment 9•6 years ago
|
||
And apparently bz had commented about performance in phabricator. Uh, I hate this split model for discussions, and phabricator forces to that :/
Comment 10•6 years ago
|
||
(In reply to Olli Pettay [:smaug] from comment #9) > And apparently bz had commented about performance in phabricator. > Uh, I hate this split model for discussions, and phabricator forces to that > :/ Phabriactor has an API where you can automatically post any comments in Phab Diff to the associated bug (we did this at my last company with JIRA integration). This can likely be done with Bugzilla integration.
Updated•6 years ago
|
Comment 11•6 years ago
|
||
(In reply to Marion Daly [:mdaly] from comment #10) > (In reply to Olli Pettay [:smaug] from comment #9) > > And apparently bz had commented about performance in phabricator. > > Uh, I hate this split model for discussions, and phabricator forces to that > > :/ > > Phabriactor has an API where you can automatically post any comments in Phab > Diff to the associated bug (we did this at my last company with JIRA > integration). This can likely be done with Bugzilla integration. Based on lessons we learned from MozReview, we've explicitly decided not to do this for a variety of reasons, including * syncing is hard given the threading, markup, and various other features that differ between Phabricator and BMO * the discussion still gets forked, as some people reply to Phabricator and others reply only in BMO * we want code reviews to live in Phabricator, not for Phabricator to just be an extension to BMO See also lengthy discussion in various newsgroup threads, including https://groups.google.com/forum/#!topic/mozilla.tools/4qroY2Iia9I https://groups.google.com/d/msg/mozilla.dev.platform/Y8kInYxo8UU/z1VZIzaSBAAJ https://groups.google.com/d/msg/mozilla.dev.platform/V1vuWPeD_hc/5Nha-8iXAwAJ
Comment 12•2 years ago
|
||
The following patch is waiting for review from an inactive reviewer:
ID | Title | Author | Reviewer Status |
---|---|---|---|
D1878 | Bug 1472169: Notify of appends from CloneAndAdopt clone path. r=smaug | emilio | smaug: Resigned from review |
:emilio, could you please find another reviewer or abandon the patch if it is no longer relevant?
For more information, please visit auto_nag documentation.
Assignee | ||
Updated•2 years ago
|
Updated•2 years ago
|
Assignee | ||
Comment 13•11 months ago
|
||
Assignee | ||
Comment 14•11 months ago
|
||
So per discussion, three approaches:
- The one in the patch. Pros: Simpler, consistent. Cons: Potentially more work / slower.
- Reuse DoneAddingChildren. We could do that by:
- Manually setting
mDoneAddingChildren = false
inCopyInnerTo
/Clone
. Pros: Potentially faster. Cons: A bit inconsistent / harder to follow. - Changing
mozilla::dom::FromParser
to something likemozilla::dom::CreationMode
. Pros: Potentially faster. Cons: More churn.
- Manually setting
I'm happy to do (1) or (2) or (3). For now let's try (1) and see what benchmarks say?
Updated•11 months ago
|
Assignee | ||
Comment 15•11 months ago
|
||
https://treeherder.mozilla.org/perfherder/compare?originalProject=try&originalRevision=2d302cfd0296475dd27a3ee3a1cc5bcf659e1a87&newProject=try&newRevision=ec95b014465c659e2c0afa936f191a09fa81c4a7 for speedometer. https://treeherder.mozilla.org/jobs?repo=try&revision=35fffbbbf0e8c73734dea11b77190a56451b11a3 for WPT.
Comment 17•11 months ago
|
||
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/badb93aa042a Notify of appends from CloneAndAdopt clone path. r=smaug
Comment 18•11 months ago
|
||
Copying crash signatures from duplicate bugs.
Comment 19•11 months ago
|
||
The bug is linked to a topcrash signature, which matches the following criterion:
- Top 10 AArch64 and ARM crashes on nightly
:emilio, could you consider increasing the severity of this top-crash bug?
For more information, please visit BugBot documentation.
Assignee | ||
Updated•11 months ago
|
Comment 20•11 months ago
|
||
bugherder |
Updated•11 months ago
|
Comment 21•11 months ago
|
||
The patch landed in nightly and beta is affected.
:emilio, is this bug important enough to require an uplift?
- If yes, please nominate the patch for beta approval.
- If no, please set
status-firefox115
towontfix
.
For more information, please visit BugBot documentation.
Description
•