Closed Bug 998291 Opened 8 years ago Closed 8 years ago

Allow importRelative() to import into a given scope

Categories

(Core :: XPConnect, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla31

People

(Reporter: bugzilla, Assigned: bugzilla)

Details

Attachments

(1 file, 2 obsolete files)

Bug 628669 introduced the useful importRelative() function into XPCOMUtils, but it does require that the specified relative module be imported into the JavaScript Object of the calling JavaScript code module's global scope (ie. the first argument passed).  There should be an optional third argument, scope, allowing the module to be imported into a given scope, just the same as with Components.utils.import().
Sorry, I got that description of Components.utils.import() wrong; it doesn't take a third argument, however it does obviously allow you to load a module into a given scope using its second argument.
Attached patch patch v1 (obsolete) — Splinter Review
Patch allowing optional third argument for scope to be specified in importRelative function.  Tested and working on my Linux build.
Attached patch patch v2 (obsolete) — Splinter Review
Version 2 of the patch without my debugging stuff in it.
Attachment #8408951 - Attachment is obsolete: true
Attachment #8408955 - Flags: review?(benjamin)
Adding patch with test.
Attachment #8408955 - Attachment is obsolete: true
Attachment #8410590 - Flags: review?(bzbarsky)
Attachment #8410590 - Flags: review?(bzbarsky) → review?(benjamin)
Attachment #8410590 - Flags: review?(benjamin) → review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/8f5f134ee116
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
You need to log in before you can comment on or make changes to this bug.