Note: There are a few cases of duplicates in user autocompletion which are being worked on.

tabs.sendMessage does not send messages to tab pages




WebExtensions: General
2 years ago
4 months ago


(Reporter: edgar, Unassigned)


Firefox Tracking Flags

(Not tracked)


(Whiteboard: [tabs][design-decision-approved][triaged])

From the documentation of tabs.sendMessage [1], extension can send a single message to the content script(s) in the specified tab. And the runtime.onMessage event will be fired in each content script running in the specified tab for the current extension.

But while I am trying to make adblocker+ [2] work as WebExtension without modification, I found the content script didn't receive the message sent through tabs.sendMessage.

When the Adblock Plus is first time installed, it will open a new tab with firstRun.html.
This page contains some option button that allows user to change the configuration.
I found the button icon didn't update when I click to change the configuration.

The flow is something like,
1. User clicks the button on firstRun.html.
2. firstRun.html use runtime.sendMessage() to send message to the background page.
3. background page changes the configuration.
4. background page use tabs.sendMessage() to notify the configuration is changed.
5. But the firstRun.html seems not receive the notification, so the button didn't update.


2 years ago
Whiteboard: [tabs]
Priority: -- → P2


2 years ago
Flags: blocking-webextensions-

Comment 2

2 years ago


2 years ago
Whiteboard: [tabs] → [tabs]triaged
`tabs.sendMessge` only sends messages to content scripts running in the given tab. Since firstRun.html is a tab page, rather than a content script, it doesn't receive those messages.

You need to use `runtime.sendMessage` instead.
Summary: Sending a single message to the content script(s) in the specified tab doesn't work → tabs.sendMessage does not send messages to tab pages

Comment 4

a year ago
Chrome's documentation says the same [1], but in Chrome you can nevertheless use `tabs.sendMessage` to send to an extension page in a tab.



10 months ago
Component: WebExtensions: Untriaged → WebExtensions: General
Flags: blocking-webextensions-


7 months ago
Duplicate of this bug: 1324423


6 months ago
Whiteboard: [tabs]triaged → [tabs][design-decision-needed][triaged]
Added to agenda for March 7 WebExtensions triage meeting. 

updating approved based on doc in comment 6
Whiteboard: [tabs][design-decision-needed][triaged] → [tabs][design-decision-approved][triaged]
You need to log in before you can comment on or make changes to this bug.