How to enforce synchronous execution for browser.webRequest.onBeforeRequest

I use browser.webRequest.onBeforeRequest and I want to test whether the problem I am facing is due to the asynchronous execution. Can you please point to me how to enforce synchronous execution on browser.webRequest.onBeforeRequest?

Just return the BlockingResponse from a non-async function. And pass the correct 3rd argument to the addListener function.

I will try, but if I used non-async function, then, I can’t use await, and will have the problem I posted here where the SDK does not send the reply in each loop iteration as I showed in the first post (the await solved the reply problem but I still can not get the SDK code done before the http request goes out (this happens in some urls and not in others - i.e. I do not get a reliable execution).

I tested this and http requests must be affected by the SDK before they go out. The effects are applied but it seems the request goes before that.

https://discourse.mozilla-community.org/t/unexpected-behaviour-in-embedded-extension-when-sending-messages-in-a-loop/16325/14

The final outcome I want: sequential execution including SDK code (must return from SDK then continue next line).

BTW, I do not want to block the request. I want it to go. Just need to examine it before it goes.

Then why do you need to process it synchronously?