-
Notifications
You must be signed in to change notification settings - Fork 37
Closed
Description
First, many thanks to the contributors ! Nice project and utils 👍
I'm using a content script in main world context to dynamically extract "react props" from the whole dom tree for use in another content script not running in main world context.
In console logs the following abreviation stands for
MW: Main World
CS: Content Script
Messenger caller is in a CS without MW context
Failing: with error thrown but error message doesn't explain why No response
Error message just says
chunk-ALTBYIMW.js:80 Uncaught (in promise) Error: No response
at Object.<anonymous> (chunk-ALTBYIMW.js:80:92)
at Generator.next (<anonymous>)
at fulfilled (chunk-ALTBYIMW.js:37:19)
The issue is that the return value object contains a function.
Example simplified code :
mainWorldMessenger.onMessage("test", (data) => {
const props = [
{
"className": "ml-md",
onClick: () => {
}
}
]
const ret = {reactProps: props};
log("return value will be", ret)
return ret
});
Working: messenger func returns with value
mainWorldMessenger.onMessage("test", (data) => {
const props = [
{
"className": "ml-md",
}
]
const ret = {reactProps: props};
log("return value will be", ret)
return ret
});
Solution
Return value can be sanitized.
An error message from @webext-core/messaging
explaining why it doesn't return would be nice
Metadata
Metadata
Assignees
Labels
No labels