Open Bug 1418655 Opened 2 years ago Updated 8 months ago

browser.tabs.onUpdated status == "complete" fires before tab can receive messages


(WebExtensions :: Frontend, defect, P3)

57 Branch
Windows 10


(Not tracked)



(Reporter: kzar, Assigned: robwu)


(Blocks 2 open bugs)



(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36

Steps to reproduce:

1. Extract the attached archive, load as temporary extension.

Actual results:

The extension creates a popup window, but the popup window does not display an alert. The following message is displayed in the extension's console:

Error: Could not establish connection. Receiving end does not exist.  undefined

Expected results:

The popup window should display an alert message when it receives the message sent from the background page.


- On Windows 10 the problem is reproducible, but on Linux (Debian Buster) it is not.
- Related Adblock Plus issue:
Sorry I forgot to mention I'm using Firefox 57.0 on both Linux and Windows.
Component: Untriaged → WebExtensions: Frontend
OS: Unspecified → Windows 10
Product: Firefox → Toolkit
I can also reproduce the bug on Linux by setting extensions.webextensions.remote to true and restarting Firefox.
Blocks: webext-oop
Flags: needinfo?(amckay)
Closed: 2 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1209869
Kris, how can this be a duplicate? This bug is about a timing issue with OOP extensions, not a general limitation.
Flags: needinfo?(kmaglione+bmo)
I don't see how it can be a timing issue when this is not supported at all.
Flags: needinfo?(kmaglione+bmo)
Feel free to try the code that supposedly "is not supported at all" on Linux or on Windows with extensions.webextensions.remote preference turned off - it definitely does work. And it works on Windows as well if a delay is added. I don't know whether bug 1209869 is describing a different scenario or is simply outdated, but it being an issue we never noticed I would assume the latter.
Flags: needinfo?(kmaglione+bmo)
Flags: needinfo?(amckay)
Reopening this bug, with bug 1209869 now established as WORKSFORME as of Firefox 51.
Ever confirmed: true
Flags: needinfo?(kmaglione+bmo)
Resolution: DUPLICATE → ---
Keywords: dev-doc-needed
Priority: -- → P3
Product: Toolkit → WebExtensions
Can confirm, on Linux, even on today's Nightly.

This specific test case is failing because tabs.onUpdated is fired for the initial about:blank.
When I add: != "about:blank", then the test passes.

Extensions likely expect the following (behavior in Chrome):

// callback: win.tabs[0].url == url.

onUpdated {status: "loading", url} for url.
onUpdated {status: "complete"} for url.

With popups, we have the following:
// callback win.tabs[0].url == "about:blank" and status == "complete".

onUpdated {status: "loading"} for "about:blank"
onUpdated {status: "complete"} for "about:blank"
onUpdated {status: "loading", url} for url
onUpdated {status: "complete"} for url

When I use tabs.create instead, there is no onUpdated with changeInfo.status="complete", but that is probably a timing issue.
tabs.executeScript already accounts for tab loads via tabs.create, but not for tab loads via windows.create:



We should probably have this kind of logic in windows.create too:
Assignee: nobody → rob
Keywords: dev-doc-needed
See Also: → 1397667
Summary: browser.tabs.onUpdated status == "complete" fires before tab can receive messages on Windows 10 → browser.tabs.onUpdated status == "complete" fires before tab can receive messages
See Also: → 1416087
You need to log in before you can comment on or make changes to this bug.