Closed
Bug 6611
Opened 26 years ago
Closed 26 years ago
A reference held to a DOM object by JavaScript doesn't prevent its deletion.
Categories
(Core :: DOM: Core & HTML, defect, P3)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
M7
People
(Reporter: danm.moz, Assigned: vidur)
Details
Attachments
(1 file)
(deleted),
text/html
|
Details |
DOM objects referenced as JavaScript objects can still be deleted. For instance, load the code below into a Mozilla window.
Click the "Make a Window" button. Close that window and then click the "Talk about that Window" button and cover
your head. The window has been deleted in spite of the fact that it's still referenced by an otherwise valid JavaScript object..
<?xml version="1.0"?>
<?xml-stylesheet href="xul.css" type="text/css"?>
<!DOCTYPE window>
<!-- Simple sample interface for bringing up a nonmodal dialog -->
<xul:window
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:xul ="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title = "Dialog creation sample">
<html:script>
var lastWindow = null;
// make a window
function MakeWindow() {
return window.open("http://www.mozilla.org", "new");
}
// pick some random property of a window and dump it to debug output
function PeekWindow(theWindow) {
dump("get ready to crash...\n");
dump(theWindow.screenX + "\n");
dump("all done crashing\n");
}
</html:script>
<xul:toolbox>
<xul:toolbar>
<xul:titledbutton
value="Make a Window" onclick="lastWindow=MakeWindow()"
style="background-color:rgb(192,192,192);"/>
<xul:titledbutton
value="Talk About That Window" onclick="PeekWindow(lastWindow)"
style="background-color:rgb(192,192,192);"/>
</xul:toolbar>
</xul:toolbox>
</xul:window>
Updated•26 years ago
|
Assignee: norris → vidur
Component: JavaScript → DOM Level 0
Assignee | ||
Updated•26 years ago
|
Status: NEW → ASSIGNED
Target Milestone: M7
Assignee | ||
Comment 1•26 years ago
|
||
You'll probably find that the nsGlobalWindow instance sticks around as it
should, but it's possible that a weak reference that it maintains somehow
doesn't get cleared. Will look at it soon.
Tom, feel free to comment on this.
Assignee | ||
Updated•26 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 2•26 years ago
|
||
Fixed on 6/14/99.
We now have slightly different reference counting rules for nsGlobalWindow. The
global JSObject now maintains a live reference to the nsGlobalWindow. The
circular reference (the nsGlobalWindow has a JS root corresponding to the global
object) is broken when the containing webshell tells us it's going away. The
nsGlobalWindow stays around as long as the reference to the global JSObject
stays around. It also tries to deal gracefully with being orphaned.
Assignee | ||
Comment 3•26 years ago
|
||
You need to log in
before you can comment on or make changes to this bug.
Description
•