You cannot use chrome.tabs.onUpdated for XHR because it only get fires when a tab is updated. When you send an XHR request, the tab is not updated (that is the whole point of "AJAX")
The only way to know if the AJAX call finished, is by overriding it. You can override the AJAX request (which uses XmlHTTPRequest), something like this:
var origXHR= window.XMLHttpRequest;
window.XMLHttpRequest = customImplementation;
An XMLHttpRequest could be Synchronous or Asynchronous, so you have to take into consideration both. When I meant customImplementation
, it means you will use the same implementation but you will add hooks in some places (such as an Adapter Pattern).