I am using chrome.webRequest.onBeforeSendHeaders and I want to get an output from a notification box to decide what to do with that http request (allow/deny). I tried triggering chrome rich notifications inside the onBeforeSendHeaders listener however the rich notification is asynchronous and I do not know how to get the result from it once the user enters the info, I wrote an example code below for further clarification:
chrome.webRequest.onBeforeSendHeaders.addListener(
function(details) {
//create a notification using chrome.notifications.create
//get the result of that notification when it is ready and store it in var called notification_result
if(notification_result)
return {cancel:true};
else {cancel:false};
},
{urls: ["<all_urls>"]},
["blocking"]);
The problem is that the notification result is triggered by an onclick listener and I do not know how to force chrome.webRequest.onBeforeSendHeaders to wait for that result. Is there a way I can make this work or achieve the same effect?