Closed Bug 314776 Opened 19 years ago Closed 19 years ago

[FIX]Content is rendered twice when using JS methods appendChild, insertBefore, replaceChild

Categories

(Core :: Layout, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla1.9alpha1

People

(Reporter: mjuhos, Assigned: bzbarsky)

References

Details

(Keywords: testcase)

Attachments

(4 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; cs; rv:1.8) Gecko/20051025 Firefox/1.5
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; cs; rv:1.8) Gecko/20051025 Firefox/1.5

There is problem with display hidden DIV element and setting STYLE to this element and than with add this content to HTML code -  it will be rendered twice.


Reproducible: Always

Steps to Reproduce:
See and try test cases.

Actual Results:  
Content is rendered twice.

Expected Results:  
Content is rendered one time.
Attached file insertbefore test case (deleted) —
Attached file appendChild test case (deleted) —
Attached file replaceChild test case (deleted) —
Component: General → Layout
Product: Firefox → Core
QA Contact: general → layout
Version: unspecified → Trunk
This is a followup to bug 312695.

What's happening here, of course, is that the BindToTree causes a style reresolve and sync frame construction, and then we notify on the content we just bound.

The only way I see of dealing with this is to make the style reresolve from BindToTree async.  This basically means doing solution 2 from bug 312695 comment 8.  The problem would, unfortunately, still be reproducible if the stuff we're binding includes scripts that do certain things.  But given all the ways in which scripts being inserted can screw with content prior to the notification, I think we can live with that for the nonce.  In particular, with scripts it's possible to get content doubling without any involvement from style at all.
Assignee: nobody → bzbarsky
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows XP → All
Priority: -- → P1
Hardware: PC → All
Target Milestone: --- → mozilla1.9alpha
Keywords: testcase
Attached patch Proposed patch (deleted) — Splinter Review
This just makes all of our style changes go through the same async restyle mechanism.
Attachment #201907 - Flags: superreview?(dbaron)
Attachment #201907 - Flags: review?(dbaron)
Summary: Content is rendered twice when using JS methods appendChild, insertBefore, replaceChild → [FIx]Content is rendered twice when using JS methods appendChild, insertBefore, replaceChild
Summary: [FIx]Content is rendered twice when using JS methods appendChild, insertBefore, replaceChild → [FIX]Content is rendered twice when using JS methods appendChild, insertBefore, replaceChild
Comment on attachment 201907 [details] [diff] [review]
Proposed patch

Are there bugs filed on:
 * preventing this kind of problem in general?
 * asserting when this kind of thing happens?  (Could I add this case to bug 310985 somehow?)
Right most of the time really isn't good enough -- we need to figure out how to do this stuff correctly.
Attachment #201907 - Flags: superreview?(dbaron)
Attachment #201907 - Flags: superreview+
Attachment #201907 - Flags: review?(dbaron)
Attachment #201907 - Flags: review+
Fixed.

(In reply to comment #6)
>  * preventing this kind of problem in general?
>  * asserting when this kind of thing happens?  (Could I add this case to bug
> 310985 somehow?)

Filed bug 315306.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Depends on: 315453
Blocks: 312695
Depends on: 375758
Blocks: 396613
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: