I have a problem using xmlHttpRequest and sendResponse at the same time.
I don't know why but when I set my variable in the x.onload, I get the response "undefined", if I set the variable outside the x.onload, I get the correct value.
See an example of my code below:
content scrypt :
chrome.runtime.sendMessage({MessageTest: "something"}, function(response) {alert(response.msg);});
event page :
chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) {
   var tableauTest = [];
   var x = new XMLHttpRequest();
   x.open('GET', 'http://monsite/page.php');
   x.onload = function() {
       tableauTest[1] = "test"; // not working here
   };
   // if a put tableauTest[1] = "test"; here, it's working
   x.send();
    sendResponse({
       msg: tableauTest[1]
   }); 
 });
I tried to put return true; (like here) but it doesn't seem to work for me
 
    