Closed Bug 307777 Opened 19 years ago Closed 11 years ago

Accessing properties on an already-closed window asserts

Categories

(Core :: DOM: Core & HTML, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: bzbarsky, Unassigned)

Details

Attachments

(1 file)

Testcase coming up, assertion is:

###!!! ASSERTION: XPConnect is being called on a scope without a 'Components'
property!

This is pretty much always bad. It usually means that native code is
making a callback to an interface implemented in JavaScript, but the
document where the JS object was created has already been cleared and the
global properties of that document's window are *gone*. Generally this
indicates a problem that should be addressed in the design and use of the
callback code.
: 'Error', file
../../../../../mozilla/js/src/xpconnect/src/xpcwrappednativescope.cpp, line 564
Attached file Testcase
Flags: blocking1.8b5?
jst and I talked about this some. The problem is that when the window is going
away (and we call SetDocShell(nsnull)) we ClearScope on the inner window. We
probably asserted even before the split window landing. The fix for this might
be to not clear scope (which jst says we shouldn't do anyway) and instead come
up with a better way of breaking the window -> event listener -> window leak.
I think what should happen is that event listeners should hold a weak ref to the
window and the window should hold a strong ref to the listeners.  When the
window goes away it should notify the listeners so they drop their weak refs...
it's not clear to me why we should block the release on this. please renominate
with an explanation if this is really a necessity for the release.
Flags: blocking1.8b5? → blocking1.8b5-
So do listeners still hold a strong ref to the window now that dbaron's patches for addEventListener have landed?

If they hold weak refs now, should we try not clearing the scope and seeing how things look?

I do think we should try to fix this for 1.9...
Flags: blocking1.9a1?
Flags: blocking1.9a1? → blocking1.9-
Assignee: general → nobody
QA Contact: ian → general
This assertion is gone.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → WORKSFORME
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: