I’m sending the message ‘contentScriptLoaded’ from a content script once a web page has finished loading.
The background script then checks if it needs to send a response
- for an AI prompt (action: ‘askPrompt’)
- for an HTTP POST request (action: displaySearchResults’). In this case, the response needs to be sent after the form data has been submitted and the result obtained.
The problem I’m encountering is that the content script is receiving a response: true. It doesn’t seem to receive the response ‘displaySearchResults’ from the background script or at least not in a timely manner. The data resulting from submitForm is correctly logged in the console for the background script.
I have spent a full day trying to solve this problem, but I can’t find the solution.
Here is the console.log from the content script:
The code extracts can be seen here:
CS BUG Code Only.pdf (47,1 Ko)