I've replaced my internal .JSON with an AJAX request and now my code stopped working properly. My goal is it to write a chrome extension that closes a tab if its link contains certain keywords saved in the .JSON file. This is what the code looked before:
chrome.webNavigation.onCompleted.addListener(closeTab, {
  url: [
    {urlPrefix: 'https://www.google.de/'},
    {urlPrefix: 'https://sghm.eu/iserv/login'},
  ]
});
function closeTab(e) {
  if (!e.frameId) {
    chrome.tabs.remove(e.tabId);
  }
}
This code worked for me.
Now the new one:
var obj = {};
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function(){
    if(xhttp.readyState == 4 && xhttp.status == 200){
        obj = JSON.parse(xhttp.response);
        console.log(obj);
    }};
    xhttp.open('GET', "banned.json", true);
    xhttp.send();
    chrome.webNavigation.onCompleted.addListener(closeTab, obj);
    function closeTab(e) {
      if (!e.frameId) {
        console.log("Hallo2");
        chrome.tabs.remove(e.tabId);
      }
    }
And the banned.json file:
[
    "www.google.de",
    "www.youtube.com/?gl=DE"
]
This code now closes every tab disreagarding the link or antything else. But I don't know why. The AJAX works as the console successfully displays the JSON array, which was previously loaded.
 
    