Closed Bug 562193 Opened 11 years ago Closed 11 years ago

Implement Components.utils.getGlobalForObject(obj)

Categories

(Core :: XPConnect, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9.3a5

People

(Reporter: Waldo, Assigned: Waldo)

References

Details

(Keywords: dev-doc-complete, Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file, 1 obsolete file)

With __parent__ going away soon, we should provide a better, simpler alternative to support this reasonable use of it.
Attached patch Patch (obsolete) — Splinter Review
Manual test fodder used to check outerization correctness (success condition: not asserting about inner windows in equality hooks), as typed into the JavaScript console:

var wm = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService(Components.interfaces.nsIWindowMediator); var enumerator = wm.getEnumerator("navigator:browser"); var win = enumerator.getNext(); var doc = win.gBrowser.contentDocument; doc.defaultView === Components.utils.getGlobalForObject(doc.documentElement); var dv = doc.defaultView; var ggfo = Components.utils.getGlobalForObject(doc.documentElement); Components.utils.getGlobalForObject(dv.eval("(function foo(){})")) === ggfo
Attachment #442170 - Flags: review?(mrbkap)
Attached patch qref ftw :-\Splinter Review
Attachment #442170 - Attachment is obsolete: true
Attachment #442174 - Flags: review?(mrbkap)
Attachment #442170 - Flags: review?(mrbkap)
Attachment #442174 - Flags: review?(mrbkap) → review+
http://hg.mozilla.org/tracemonkey/rev/16f1064de17e

I have a brief blog post queued up on the new method, which I'll make live once this migrates over to m-c.  I'll try to add a writeup to MDC in a bit when the site's less flaky and unreachable.
Whiteboard: fixed-in-tracemonkey
https://developer.mozilla.org/en/Components.utils.getGlobalForObject

Linked from the Components and Components.utils pages, needs to be added to what's-new pages of whatever sort so leaving the d-d-n keyword...
http://hg.mozilla.org/mozilla-central/rev/16f1064de17e
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Minor tweaks made to Jeff's doc, and it's been listed where appropriate.

https://developer.mozilla.org/en/Components.utils.getGlobalForObject
You need to log in before you can comment on or make changes to this bug.