Closed Bug 296121 Opened 20 years ago Closed 20 years ago

Leak if document.open() is not followed by data

Categories

(Core :: DOM: HTML Parser, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: bzbarsky, Assigned: mrbkap)

References

()

Details

(Keywords: memory-leak)

Attachments

(1 file)

BUILD: Current trunk build

STEPS TO REPRODUCE:
1)  Start browser with leak logging.
2)  Type javascript:document.open() in the URL bar and hit enter (or just click
the link in the URL field of this bug).
3)  Quit

EXPECTED RESULTS: no leaks

ACTUAL RESULTS: leak

The reason is that we have a cycle document -> parser -> sink -> document for
HTML documents.  When we get to nsParser::Terminate, mParserContext is null, so
we null out the parser in the sink, but that doesn't break the cycle above, just
the sink/parser cycle.

Just nulling out mSink is also no good, since that will leave a non-null mParser
in the document and then when someone tries to document.write we'll end up
getting called and not having a sink.

Perhaps we should manually call DidBuildModel() on the sink in this case?
Flags: blocking1.8b3?
Attached patch break the cycleSplinter Review
Yeah, this fixes the leak in the simplest way possible.
Assignee: parser → mrbkap
Status: NEW → ASSIGNED
Attachment #184961 - Flags: superreview?(bzbarsky)
Attachment #184961 - Flags: review?(bzbarsky)
Attachment #184961 - Flags: superreview?(bzbarsky)
Attachment #184961 - Flags: superreview+
Attachment #184961 - Flags: review?(bzbarsky)
Attachment #184961 - Flags: review+
Comment on attachment 184961 [details] [diff] [review]
break the cycle

This fixes a leak.
Attachment #184961 - Flags: approval1.8b3?
Comment on attachment 184961 [details] [diff] [review]
break the cycle

a=shaver
Attachment #184961 - Flags: approval1.8b3? → approval1.8b3+
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Flags: blocking1.8b3?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: