Closed Bug 1135220 Opened 6 years ago Closed 3 years ago

Add {Cu,Cr,Cc,Ci} as globals on chrome scopes (that have Components) by default

Categories

(Core :: XPConnect, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 767640

People

(Reporter: Gijs, Unassigned)

References

(Depends on 2 open bugs)

Details

Things like bug 1135212 are silly. All the boilerplate for these things at the top of modules ( http://mxr.mozilla.org/mozilla-central/search?string=const+\{classes&find=\.jsm%24&findi=&filter=^[^\0]*%24&hitlimit=&tree=mozilla-central ) is silly too. Let's not have silly things.

How many const declarations would fixing this break, and/or can we do it in a way where it wouldn't? :-)

(we could fix our own JSMs pretty easily, but I'm thinking about add-on compat)
Actually don't know if this should be xpconnect instead, but I guess so because JSMs don't have a DOM...
Component: DOM → XPConnect
> How many const declarations would fixing this break

Good question.  The const semantics really are not helpful here.  :(

> and/or can we do it in a way where it wouldn't?

We could put the props somewhere up the proto chain from the global, not on the global itself.

Unfortunately, I'm not sure the global in a JSM has anything interesting on its proto chain other than Object.prototype right now.  Fortunately, we could probably change that....
(In reply to Boris Zbarsky [:bz] from comment #2)
> > How many const declarations would fixing this break
> 
> Good question.  The const semantics really are not helpful here.  :(
> 
> > and/or can we do it in a way where it wouldn't?
> 
> We could put the props somewhere up the proto chain from the global, not on
> the global itself.
> 
> Unfortunately, I'm not sure the global in a JSM has anything interesting on
> its proto chain other than Object.prototype right now.  Fortunately, we
> could probably change that....

Yeah, it's a BackstagePass. After we convert ContentFrameMessageManager to WebIDL, we should switch BackstagePass to WebIDL so that we can get rid of XPCWN globals (which require quite a bit of special code). Once we do that, adding things on the prototype should be very straightforward.
Depends on: 888600
Depends on: 1137773
No longer depends on: 888600
(In reply to :Gijs from comment #0)
> (we could fix our own JSMs pretty easily, but I'm thinking about add-on
> compat)

Now that this is out of the window, how's the situation changed for this bug now?
Flags: needinfo?(gijskruitbosch+bugs)
(In reply to Florian Bender from comment #4)
> (In reply to :Gijs from comment #0)
> > (we could fix our own JSMs pretty easily, but I'm thinking about add-on
> > compat)
> 
> Now that this is out of the window, how's the situation changed for this bug
> now?

I think we still need a prototype to stick something onto... I don't really have the expertise to work on this, and Boris and Bobby are busy with more important things, so it'll continue to be on the backburner for now. Maybe after 57 we can revisit.
Flags: needinfo?(gijskruitbosch+bugs)
Depends on: 1137770
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 767640
You need to log in before you can comment on or make changes to this bug.