Google Chrome Extension message passing with run_at document_start
I have a question about the executing control between message passing (content_script.js sends request and background.html sends response) and JQuery $(document).ready() function.
I have set "run_at": "document_start" in the manifest file, and according to the doc. the content_script.js will execute after css and before any scripts. In this case, say the content_script.js changes the background color of the html page, the function which can change the page color will be called before any script.
My question is about message passing between content_script.js and background.html.
If I am correct in the following: For example the event
chrome.extension.sendRequest({storage: 'foo'}, function(response) {
runAfterResponseReceived();});
is defined 开发者_开发问答in the content_script.js, the request will be sent to the background page before any scripts runs. And as soon as this request is sent, other scripts can run, without waiting for the response comes back (unblocking). So when the response is back, content_script.js finds an idle time, and execute function runAfterResponseReceived().
Then, how can I change this to a blocking behavior, so I can have "any scripts" executes after the response is returned.
I hope I have explained my problem. Thanks.
Sorry, not possible. You can star this issue.
精彩评论