Closed
Bug 1209869
Opened 9 years ago
Closed 7 years ago
tabs.sendMessage does not send messages to tab pages
Categories
(WebExtensions :: General, defect, P3)
WebExtensions
General
Tracking
(Not tracked)
RESOLVED
WORKSFORME
People
(Reporter: edgar, Unassigned)
References
Details
(Whiteboard: [tabs][design-decision-approved][triaged])
Attachments
(1 file)
1.31 KB,
application/x-xpinstall
|
Details |
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.
[1] https://developer.chrome.com/extensions/tabs#method-sendMessage
[2] https://github.com/adblockplus/adblockpluschrome
Reporter | ||
Comment 1•9 years ago
|
||
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.
Updated•9 years ago
|
Whiteboard: [tabs]
Priority: -- → P2
Updated•9 years ago
|
Flags: blocking-webextensions-
Comment 2•9 years ago
|
||
Updated•9 years ago
|
Whiteboard: [tabs] → [tabs]triaged
Comment 3•9 years ago
|
||
`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.
Updated•8 years ago
|
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•8 years 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.
[1] https://developer.chrome.com/extensions/tabs#method-sendMessage
Updated•8 years ago
|
Component: WebExtensions: Untriaged → WebExtensions: General
Flags: blocking-webextensions-
Updated•8 years ago
|
Whiteboard: [tabs]triaged → [tabs][design-decision-needed][triaged]
Comment 6•8 years ago
|
||
Added to agenda for March 7 WebExtensions triage meeting.
Agenda: https://docs.google.com/document/d/1zzfedbTKAHUmm4UctxSOIJV3iKayXQ8TuXPodXW8wC0/edit#
Comment 7•8 years ago
|
||
updating approved based on doc in comment 6
Whiteboard: [tabs][design-decision-needed][triaged] → [tabs][design-decision-approved][triaged]
Updated•7 years ago
|
Priority: P2 → P3
Comment 9•7 years ago
|
||
I'm adding actual steps to reproduce this issue:
1. Download the attached test extension.
2. Go to about:debugging, click "Load Temporary Add-on" and select the extension package you downloaded.
3. An extension page will open saying "Waiting for ping from the extension's background page." Wait two seconds.
Expected results:
Message on the page changes into "Ping from background page received." This is the result I see in Firefox 51, Firefox 57 and Chrome 62.
Actual results:
Message on the page doesn't change, Browser Console shows an error message saying "Receiving end doesn't exist." This is the result I see in Firefox 50.
Comment 10•7 years ago
|
||
Resolving this bug as WORKSFORME, it has been resolved as of Firefox 51. Feel free to change resolution into DUPLICATE if you know what changed the behavior here.
Comment 11•7 years ago
|
||
Looking through the list of bugs resolved in Firefox 51, this doesn't seem to be a duplicate. I rather suspect that this issue was resolved as a side-effect of bug 1298979.
Updated•6 years ago
|
Product: Toolkit → WebExtensions
You need to log in
before you can comment on or make changes to this bug.
Description
•