'Call an async function from within a blocking chrome.webRequest.onBeforeRequest handler?
I have a Chrome Extension which has an chrome.webRequest.onBeforeRequest handler, with ["requestBody", "blocking"] params.
I want to call an async function inside the background script from within this handler.
Currently I use chrome.tabs.sendMessage to pass a message to the content script which then receives it and sends a message to the background using chrome.extension.sendMessage, which receives it and calls the said async function.
Both the background & content script are using chrome.runtime.onMessage to listen to those messages.
This feels like a pretty messy workaround - I guess I don't need the content script to act as proxy.
Can I trigger an async function from within the onBeforeRequest handler directly?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
