I'm using the chrome.experimental.webRequest.onBeforeRequest callback where I need to find the URL of the tab making the request before returning from onBeforeRequest.
This would usually be the referring URL in the HTTP request but I also want the URL where there is no referrer sent such as HTTPS to HTTP requests.
The only thing I found was chrome.tabs.get which is asynchronous.
What would be the best approach to get the tab URL before returning?
I have two ideas on solving this:
- Using something similar to
ManualResetEvent, though this answer says it is not possible. - Listen to some other event and record each tab URL in a local structure.