We got this bug report in Screenshots: https://github.com/mozilla-services/screenshots/issues/2955 It's not that easy to reproduce, but I'm guessing it's due to a content script being loaded on a page before the background page is initialized. Since deferred startup for background pages just landed, I'm guessing that's related. I believe extension authors will expect the background page to be loaded before any content_scripts (or implicitly expect it as we did), and so content_scripts should also be deferred.
We do wait until the background page is loaded before we begin loading content scripts, in general. It's possible that they may load earlier in some corner cases, though, like when new content processes start in the middle of the startup cycle.
I was about to file the same bug. :) Content script has chrome.runtime.sendMessage() Background script has chrome.runtime.onMessage.addListener() On loading the extension I get the following error: > Error: Could not establish connection. Receiving end does not exist. (unknown) I added debugging and noticed that content scripts are injected into pages before the background scripts is run which seems like the wrong order practically and semantically. The "content_scripts" is set to "run_at": "document_start", if that makes any difference.
(In reply to Ian Bicking (:ianb) from comment #0) > It's not that easy to reproduce This happens consistently on Android. Every time you install the extension, it runs the content scripts first and initializes the background page afterwards.