title: How do I get the tab id of a tab that is running content.js?
body: <p>I am making a chrome extension that closes a certain website as soon as it loads, and have a content.js page and a background.js page. The background.js page works and is waiting for a message from content.js:</p>
  
  <pre><code>chrome.runtime.onMessage.addListener(function(msg, _, sendResponse) {
    if (msg.closeTab) {
      chrome.tabs.remove(msg.tabID);
    }
  });  
  </code></pre>
  
  <p>And the code to send the message in content.js is:  </p>
  
  <pre><code>addButton("Close this tab.", function() {
    chrome.runtime.sendMessage({closeTab: true, tabID: tab.id});
  });
  </code></pre>
  
  <p>but the problem I am having is that <code>tab</code> is undefined.
  I'm using a button just to test the functionality. </p>