Closed Bug 1168025 Opened 9 years ago Closed 6 years ago

Enable someway to get a list of scopes where a jsm module was imported so we can modify it

Categories

(Core :: XPConnect, defect)

38 Branch
Unspecified
All
defect
Not set
normal

Tracking

()

RESOLVED INACTIVE

People

(Reporter: noitidart, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0
Build ID: 20150521175336

Steps to reproduce:

https://ask.mozilla.org/question/1566/modify-osconstantspath-values-where-already-imported/

I need to modify object that was that was imported by jsm module. I need to get a list of all scopes it was imported in and change it.

I feel this is something many people try for, I need this especially for some important work to me. And I thought about it a lot and this is the only way to go about it (see ask.m.o topic please).

If no current way exists, I feel on Cu.import it should add the scope reference to a globallly accessible array somewhere. Similar to how we can tap into bootstrap scope of addons using XPIProvider.jsm like this:

```
var XPIScope = Cu.import('resource://gre/modules/addons/XPIProvider.jsm');
var scope = XPIScope.XPIProvider.bootstrapScopes['Profilist@jetpack'];
console.info('scope:', scope);
```
OS: Unspecified → All
Component: Untriaged → XPCOM
Product: Firefox → Core
This functionality would go in XPConnect, not XPCOM.

The use-case here doesn't seem particularly compelling, in the linked question or in comment 0.  (For instance, why do you want to do this *after* the browser is built, and why would it be infeasible to incorporate those changes into the browser itself.)
Component: XPCOM → XPConnect
(In reply to Nathan Froyd [:froydnj] [:nfroyd] from comment #1)
> This functionality would go in XPConnect, not XPCOM.
> 
> The use-case here doesn't seem particularly compelling, in the linked
> question or in comment 0.  (For instance, why do you want to do this *after*
> the browser is built, and why would it be infeasible to incorporate those
> changes into the browser itself.)

Thanks Nathan for the reply. I set up multiple desktop icons that launch different profiles. The icons can be badged. The icons can be "kept in dock". Profile launched by these icons withstand computer restart, if user marked to restart apps from last time the firefox(s) with respective profiles are launched. I had to accomplish this by making a .app that alias's the main directories to the root firefox in /Applications. But doing that jacks up all the paths. I fixed up the Service.dirsvc paths with dirsvc overide: http://stackoverflow.com/questions/28304040/osx-change-special-paths-especialy-folder-to-which-update-is-delivered/28357788#28357788

But I have to do the same for OS.Constants.Path because many people use that too :(

This is the final result: https://github.com/Noitidart/Profilist/issues/18#issuecomment-76653957
By paths being jacked up, its not badly jacked up. The path will still go to the right file as it returns the alias path. But if devusers do string manipulation using strings from this path they'll get unexpected results. So I modify the paths to the non-aliased path.
Per policy at https://wiki.mozilla.org/Bug_Triage/Projects/Bug_Handling/Bug_Husbandry#Inactive_Bugs. If this bug is not an enhancement request or a bug not present in a supported release of Firefox, then it may be reopened.
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → INACTIVE
You need to log in before you can comment on or make changes to this bug.