Self.port.on getting called too late in latest Nightlies

I’ve posted the bug here:

https://bugzilla.mozilla.org/show_bug.cgi?id=1222690

And I am also posting here for more visibility, I don’t know if this change is intentional or not but it breaks crucial functionalities in my add-on.

In short, when a content script is attached at “contentScriptWhen: start”, any self.port.on in the content-script will only be called when the page is fully loaded (readySate = complete).

It should be called when the content script is running at start (readyState = loading) like it does in the previous versions before the two recent Nightlies 45.0a1 (2015-11-05) and 45.0a1 (2015-11-06) (couldn’t test earlier versions), and in current Firefox 42 stable.

Is this change intentional or not?

It sounds like it could be related to e10s, but I’m not sure.

I’ve done lots of testing and it isn’t just related to the port api but with the worker.postMessage as well. Any form of communcation from the add-on to the content-script is no longer working until the page is fully loaded, and I mean fully loaded as in every image, script and iframe that might exist have finished loading completely.

Only after all of that is done then the communication is received in the content-script.

I am trying to find a way around it, thought I found the solution with pageMod chaining (works with Nightly, doesn’t work so well for Stable) but so far nothing worth came up as an alternative.

Currently trying to create my own pageMod to see if I can make it work. Unfortunately I still don’t know wether this is a bug or intended, so if I can’t work around it my add-on (and every add-on in the same situation) will not work correctly anymore.