Closed Bug 780674 Opened 13 years ago Closed 13 years ago

JSM reference to DOMWindow object leaks DOMWindow

Categories

(Core :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: myk, Unassigned)

Details

Attachments

(1 file)

Assigning an object created in a DOMWindow to a property of an object created in a JavaScript module causes the DOMWindow to leak. The attached simple chrome mochitest demonstrates this by setting a property of XPCOMUtils to an object literal: Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); XPCOMUtils.foo = {}; That shouldn't cause the DOMWindow associated with the mochitest to leak (the window itself holds no obvious reference to the object literal created in it). But it does leak when I run the test via: make mochitest-chrome TEST_PATH=dom/tests/mochitest/chrome/test_object_reference_leak.xul (Filing in General, as I'm unsure where specifically this should go. Perhaps DOM or XPConnect? The test itself is only in dom/ because it was convenient to put it there. And the cc: list is just a pseudo-random collection of folks who might know something about this or be able to cc: the right person.)
> (the window itself holds no obvious reference to the object literal created in it) It's the other way around. The object literal has a reference to its global, as all JS objects do. This has nothing to do with the DOM; it's a pure Spidermonkey thing, and more or less required by the spec (in fact, upcoming things in ES5 are likely to allow retrieving the global from an object).
(In reply to Boris Zbarsky (:bz) [In and out Aug 1 - 10, out Aug 11-20] from comment #1) > > (the window itself holds no obvious reference to the object literal created in it) > > It's the other way around. The object literal has a reference to its > global, as all JS objects do. Erm, indeed! > This has nothing to do with the DOM; it's a > pure Spidermonkey thing, and more or less required by the spec (in fact, > upcoming things in ES5 are likely to allow retrieving the global from an > object). Hmm, ok. That seems unfortunate, but I suppose them's our breaks.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: