Closed Bug 1257111 Opened 8 years ago Closed 8 years ago

Generated bootstrap.js files need to use ioService.newChannel2 instead of ioService.newChannel

Categories

(Add-on SDK Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: mconley, Unassigned)

References

Details

Today, an add-on that I wrote a while back stopped working. Upon examination, this error was being thrown:

1458116346391	addons.xpi	WARN	Exception running bootstrap method startup on jid1-KrxrrWKPOoE4Mw@jetpack: TypeError: ioservice.newChannel is not a function (resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///Users/mikeconley/Library/Application%20Support/Firefox/Profiles/32tsfewj.e10s/extensions/jid1-KrxrrWKPOoE4Mw@jetpack.xpi!/bootstrap.js:45:17) JS Stack trace: readURI@resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///Users/mikeconley/Library/Application%20Support/Firefox/Profiles/32tsfewj.e10s/extensions/jid1-KrxrrWKPOoE4Mw@bootstrap.js:45:17 < startup@resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///Users/mikeconley/Library/Application%20Support/Firefox/Profiles/32tsfewj.e10s/extensions/jid1-KrxrrWKPOoE4Mw@bootstrap.js:80:30 < this.XPIProvider.callBootstrapMethod@XPIProvider.jsm:4682:9 < this.XPIProvider.startup@XPIProvider.jsm:2684:13 < callProvider@AddonManager.jsm:227:12 < _startProvider@AddonManager.jsm:755:5 < AddonManagerInternal.startup@AddonManager.jsm:938:9 < this.AddonManagerPrivate.startup@AddonManager.jsm:2773:5 < amManager.prototype.observe@addonManager.js:57:7

The complaint from bootstrap.js about ioservice.newChannel being missing is because of bug 1254752, which removed that method.

If I recall correctly, I didn't actually write that bootstrap.js file - it was generated by jpm (or was it cfx? I don't remember at the time) when I created the XPI for upload.

I suspect this is going to break a number of add-ons in a similar way. We might want to find a way of either repackaging any add-ons that are using the boilerplate bootstrap.js file, or swap in a new bootstrap.js file for add-ons that are using the old boilerplate one.

I'm actually not sure what the best way forward is, but we need to do something here.
Hey Mossop, have I filed this bug in the right component? And do you know what kind of powers we have here to avoid having our add-on authors re-pack their add-ons with an updated bootstrap.js?
Flags: needinfo?(dtownsend)
For reference, here's the offending line in my generated bootstrap.js file: https://addons.mozilla.org/en-US/firefox/files/browse/288606/file/bootstrap.js#L45
There are a lot of hits for this in mxr https://mxr.mozilla.org/addons/search?string=ioservice.newChannel.
(In reply to Mike Conley (:mconley) - Needinfo me! from comment #1)
> Hey Mossop, have I filed this bug in the right component? And do you know
> what kind of powers we have here to avoid having our add-on authors re-pack
> their add-ons with an updated bootstrap.js?

None short of disabling their add-ons and even then that often doesn't help.

Bug 1254752 is going to break a lot of add-ons. I'm not seeing the rationale for removing those functions it might be a case where we need to hold our nose and bring them back for add-on's sake. Leaving the ball in Andy's court here.
Flags: needinfo?(dtownsend) → needinfo?(amckay)
Agreed, we need a path forward here. For the impatient, that seems like the fix:
https://bugzilla.mozilla.org/show_bug.cgi?id=1256755#c5

I'll discuss options with peers real quick and follow up on the issue ASAP.
As a first step we should bring back the API on nsIIOService, see:
> Bug 1257339 - Bring back deprecated newChannel() API on nsIIOService

But we should definitely update bootstrap.js, who knows how to do that?
(In reply to Dave Townsend [:mossop] from comment #4)
> (In reply to Mike Conley (:mconley) - Needinfo me! from comment #1)
> > Hey Mossop, have I filed this bug in the right component? And do you know
> > what kind of powers we have here to avoid having our add-on authors re-pack
> > their add-ons with an updated bootstrap.js?
> 
> None short of disabling their add-ons and even then that often doesn't help.
> 
> Bug 1254752 is going to break a lot of add-ons. I'm not seeing the rationale
> for removing those functions it might be a case where we need to hold our
> nose and bring them back for add-on's sake. Leaving the ball in Andy's court
> here.

It sounds like based on bug 1257339 comment 1 that newChannel is coming back.
Flags: needinfo?(amckay)
Andy, can you find someone who can answer the question in comment 6?
Flags: needinfo?(amckay)
(In reply to Jonathan Watt [:jwatt] from comment #8)
> Andy, can you find someone who can answer the question in comment 6?

bootstrap.js is generated by cfx which is in the mozilla tree, here (I think): https://dxr.mozilla.org/mozilla-central/source/addon-sdk/source/app-extension/bootstrap.js. However new add-ons generated with cfx can no longer be uploaded to AMO because of other changes. 

The real challenge is trying to change code in everyone's addons.
Flags: needinfo?(amckay)
Okay, so we shouldn't bother updating bootstrap.js. Thanks!
(In reply to Andy McKay [:andym] from comment #9)
> (In reply to Jonathan Watt [:jwatt] from comment #8)
> > Andy, can you find someone who can answer the question in comment 6?
> 
> bootstrap.js is generated by cfx which is in the mozilla tree, here (I
> think):
> https://dxr.mozilla.org/mozilla-central/source/addon-sdk/source/app-
> extension/bootstrap.js. However new add-ons generated with cfx can no longer
> be uploaded to AMO because of other changes. 
> 
> The real challenge is trying to change code in everyone's addons.

JPM also includes a bootstrap.js doesn't it? Is it similarly affected?
Flags: needinfo?(kumar.mcmillan)
(In reply to Dave Townsend [:mossop] from comment #11)
> JPM also includes a bootstrap.js doesn't it? Is it similarly affected?

No.
Flags: needinfo?(kumar.mcmillan)
(In reply to Andy McKay [:andym] from comment #9)
> The real challenge is trying to change code in everyone's addons.

Because of bootstrap.js, which lots of addons use we decided to bring back the API (see Bug 1257339). We add a deprecation warning though. We still want to deprecate ::newChannel() API though. So, at some point we need reach out to addon devs to make that change or their addons will break then.
No longer blocks: 1254752
Depends on: 1257339
Mike, we landed Bug 1257339 and your addon should work again. As discussed within Comment 9, bootstrap.js is still used by a lot of addons, but not distributed for new addons anymore. So I think there is nothing left to do for this bug. If you agree, please close the bug. Thank you!

Please also make sure that your addon works again!
Flags: needinfo?(mconley)
Yes, my add-on works correctly. Thanks!
Flags: needinfo?(mconley)
I think with reverting the changes within nsIIOService within Bug 1257339 this bug became invalid.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.