Closed Bug 1256755 Opened 4 years ago Closed 4 years ago

BrowserStack extension fails to install/launch, in Nightlies that have bug 1254752's nsIIOService changes

Categories

(WebExtensions :: General, defect)

defect
Not set

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: dholbert, Unassigned)

References

Details

(Whiteboard: [addon] [sitewait])

Attachments

(1 file)

Attached file extension XPI file
LONGER STR:
 1. Sign in to a BrowserStack account. (you can create a trial account to test if you like)
 2. Click their "install" button to install their mandatory Firefox extension.

SHORTER STR:
Install attached extension (taken from a profile where I performed LONGER STR).


EXPECTED RESULTS:
Should install successfully; BrowserStack icon should appear on your toolbar.

ACTUAL RESULTS:
Extension install fails with the following spammed to Browser Console & the terminal (if you started Firefox from a terminal):
{
Exception running bootstrap method startup on {6cc0f0f7-a6e2-4834-9682-24de2229b51e}: TypeError: ioservice.newChannel is not a function (resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///tmp/foo55/extensions/%7B6cc0f0f7-a6e2-4834-9682-24de2229b51e%7D.xpi!/bootstrap.js:51:17) JS Stack trace: readURI@bootstrap.js:51:17 < startup@bootstrap.js:86:30 < this.XPIProvider.callBootstrapMethod@XPIProvider.jsm:4682:9 < AddonInstall.prototype.startInstall/<@XPIProvider.jsm:6141:13 < TaskImpl_run@Task.jsm:319:40 < Handler.prototype.process@Promise-backend.js:937:23 < this.PromiseWalker.walkerLoop@Promise-backend.js:816:7 < Promise*this.PromiseWalker.scheduleWalkerLoop@Promise-backend.js:747:11 < this.PromiseWalker.schedulePromise@Promise-backend.js:779:7 < this.PromiseWalker.completePromise@Promise-backend.js:714:7 < this.BasePromiseWorker.prototype._worker/worker.onmessage@PromiseWorker.jsm:231:9 < EventHandlerNonNull*this.BasePromiseWorker.prototype._worker@PromiseWorker.jsm:217:5 < postMessage@PromiseWorker.jsm:292:9 < TaskImpl_run@Task.jsm:319:40 < Handler.prototype.process@Promise-backend.js:937:23 < this.PromiseWalker.walkerLoop@Promise-backend.js:816:7 < Promise*this.PromiseWalker.scheduleWalkerLoop@Promise-backend.js:747:11 < this.PromiseWalker.schedulePromise@Promise-backend.js:779:7 < this.PromiseWalker.completePromise@Promise-backend.js:714:7 < onSuccess@osfile_native.jsm:63:7
}

Nightly 48.0a1 (2016-03-14) gives me ACTUAL RESULTS.
DevEdition 47.0a2 (2016-03-15) gives me EXPECTED RESULTS.

So, this is a regression; but I suspect it might be an intentional platform change that the extension needs to work around. Hence, starting this out as Tech Evang | Add-ons.
Regression range:
https://hg.mozilla.org/integration/mozilla-inbound/pushloghtml?fromchange=3ca8a82bbff8c9f6a04451b8a9452a1213f5e8fa&tochange=25a61e969b4ea97f727d5711577a826a9733261a

Looks like a regression from:
> ce60f4cc495a Christoph Kerschbaumer — Bug 1254752 - Remove deprecated functions from nsIIOService. r=mcmanus

(This bug was known to impact addon compat, per bug 1254752 comment 2.  And the other two changesets in its push are updates to our bundled add-ons to fix their compatibility after this change.)

So: we need to reach out to BrowserStack with add-on fix suggestions here.
Blocks: 1254752
Summary: BrowserStack extension fails to install, in Nightly → BrowserStack extension fails to install/launch, in Nightlies that have bug 1254752's nsIIOService changes
Component: Desktop → Add-ons
Happy to provide answers related to the changeset and also happy to help them use the right API. How do we actually reach out to them though?
Their support page is here:
 https://www.browserstack.com/contact?ref=help#support

They have a twitter account here, too, which seems to be pretty responsive:
 https://twitter.com/browserstack/with_replies

(Given that they're a service for testing various browser versions, I expect they'll be fairly tech-savvy about browser compat changes and receptive to feedback.)
I just tweeted at them; that may get someone to take a look:
  https://twitter.com/CodingExon/status/709839020159737856

In the meantime, Christoph, if you're up for it: it'd probably help if you could unzip the attached XPI, grep for calls to the removed API, and post anything you find w/ suggested replacement JS.
As far as I can tell, the only thing that needs to be updated is the function readURI() within bootstrap.js. |NetUtil.jsm| would need to be imported to make the change more future proof. It's better to use NetUtil.jsm than using ioservice directly. So you would have to import:
> Components.utils.import("resource://gre/modules/NetUtil.jsm");

The function itself should look like something like the one posted underneath. Please use channel.open2() instead of channel.open(), because we are going to deprecate .open() soon as well.

function readURI(aURI) {
  let uri = NetUtil.newURI(uri, 'UTF-8', null);
  let channel = NetUtil.newChannel({
    uri: uri,
    loadUsingSystemPrincipal: true
  });

  let stream = channel.open2();

  let cstream = Cc['@mozilla.org/intl/converter-input-stream;1'].
    createInstance(Ci.nsIConverterInputStream);
  cstream.init(stream, 'UTF-8', 0, 0);

  let str = {};
  let data = '';
  let read = 0;
  do {
    read = cstream.readString(0xffffffff, str);
    data += str.value;
  } while (read != 0);

  cstream.close();

  return data;
}
(In reply to Christoph Kerschbaumer [:ckerschb] from comment #5)
> function readURI(aURI) {
>   let uri = NetUtil.newURI(uri, 'UTF-8', null);
let uri = NetUtil.newURI(aURI, 'UTF-8', null);
Btw, the new API was added in FF38 [1]. In other words, if you update your addon it will already work with the current release of Firefox (FF45).

[1] http://hg.mozilla.org/mozilla-central/rev/e6b4bb4cc393
Whiteboard: [addon] [sitewait]
CC-ing Shirish. He is taking a look into this.
(In reply to Daniel Holbert [:dholbert] from comment #4)
> I just tweeted at them; that may get someone to take a look:
>   https://twitter.com/CodingExon/status/709839020159737856
> 
> In the meantime, Christoph, if you're up for it: it'd probably help if you
> could unzip the attached XPI, grep for calls to the removed API, and post
> anything you find w/ suggested replacement JS.

We're already working on supporting e10s and other changes. We'll continue to update our addon for FF stable, but you're likely to hit errors and compatibility issues in Nightly until our e10s changes land.
Thanks! That makes sense.  Glad to hear you're on top of this.  Mostly wanted to make sure this API-change didn't break BrowserStack by surprise when Firefox 48 (current Nightly) becomes the stable release.
Apparently the file bootstrap.js is part of Mozilla's packaging system. Because of that we decided to basically back out the changes of Bug 1254752. We are adding deprecation warnings and bringing the deleted API on nsIOService back, see Bug 1257339.
This is WORKSFORME in current nightlies, due to bug 1257339 I believe.
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → WORKSFORME
Component: Add-ons → General
Product: Tech Evangelism → WebExtensions
You need to log in before you can comment on or make changes to this bug.