"No matching message handler" error when tabs.update().then(tabs.executeScript())
Categories
(WebExtensions :: Frontend, defect, P3)
Tracking
(Not tracked)
People
(Reporter: bibicron, Assigned: robwu)
References
Details
(Whiteboard: [tabs])
Updated•7 years ago
|
Updated•7 years ago
|
Comment 3•7 years ago
|
||
Comment 4•7 years ago
|
||
Comment 5•7 years ago
|
||
Updated•7 years ago
|
Assignee | ||
Comment 6•6 years ago
|
||
Comment 7•6 years ago
|
||
Assignee | ||
Comment 8•6 years ago
|
||
Comment 9•6 years ago
|
||
Still true as of FF 65.
Comment 10•6 years ago
|
||
This is something that seems to have become much more visible/frequent since Firefox 64. We have a browsing protection extension as part of our security suite, and one of its features is to add ratings to google/yahoo/bing search results, using tabs.onUpdated and tabs.executeScript(). Until recently we didn't have any problems with it, but now I noticed that around half of the cases in Google searches fail, and always the first search from Yahoo main page fails. Our problem is not (at least easily) reproducible with Firefox 61.0-63.0 nor 60.4.0esr, but it does reproduce always in 64.0, 65.0, 66.0b6 developer edition and 66.0b7. Error message is the same "No matching message handler". Waiting for the tab.status === 'complete' seems to help according to my first tests.
Comment 11•6 years ago
|
||
The other thing to be aware of is that, as of recent Firefoxes (65 at the latest), more onUpdated events are fired than before, notifying you of changes to secondary traits like "attention" (https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/onUpdated#changeInfo). Depending on what you're doing, it might behoove you to check the changeInfo param in your handler, as I had to: https://github.com/mozilla/fathom-fox/commit/0d4c4bd73170f2543ebdc1c218e2f9f582cacd67#diff-2df2bbad6da65a2f9750bb1c21d59ae6R45.
Comment 12•5 years ago
|
||
This affects also browser.tabs.duplicate
API. In my case I was duplicating my own extension tab, then sending it message. This randomly failed even when I was waiting for "complete" status - yes, because there is "about:blank" first with "complete" status. Crazy!!!
Is this somewhere defined how it should behave? I mean, this is a bug, right?
I can't remember if I had this problem in Chrome as well or not...
Also the docs are not very helpful - for the duplicate API "...resolves as soon as the tab has been duplicated" (define "duplicated", right? :D).
Assignee | ||
Comment 13•5 years ago
|
||
(In reply to juraj.masiar from comment #12)
This affects also
browser.tabs.duplicate
API. In my case I was duplicating my own extension tab, then sending it message. This randomly failed even when I was waiting for "complete" status - yes, because there is "about:blank" first with "complete" status. Crazy!!!Is this somewhere defined how it should behave? I mean, this is a bug, right?
I can't remember if I had this problem in Chrome as well or not...Also the docs are not very helpful - for the duplicate API "...resolves as soon as the tab has been duplicated" (define "duplicated", right? :D).
browser.tabs.duplicate
used to only resolve when the tab finished loading, but in bug 1394376 it changed to resolve as soon as the tab UI has been initialized. The implementation attempts to ensure that tabs.executeScript
only runs when the tab is ready to handle tabs.executeScript
calls (as of bug 1559216), but there is no such logic for browser.tabs.sendMessage
.
Comment 14•5 years ago
|
||
(In reply to Rob Wu [:robwu] from comment #13)
Ah yes, you are right!
Sorry for the confusion... it's similar, but actually totally different use case :)
Updated•4 years ago
|
Assignee | ||
Comment 15•4 years ago
|
||
I ran comment 1's STR and it works as intended for me.
STR from comment 3 is covered by bug 1416087
Comment 16•3 years ago
|
||
First, I would like to thank Erik Rose for his super workaround. I do however have one improvement I would suggest in the (sub) function isComplete(). One should also test for undefined. This occurred to me when developing an extension for Thunderbird. The function should now read:
function isComplete(tab) {
return tab.status === 'complete' && tab.url !== undefined && tab.url !== 'about:blank';
}
Description
•