title: Chrome.runtime.onMessage.addListener on new tab not receiving message from popup.js
body: <p>I have the following code in popup.js which responds to a button press to get all the tabs, create a new tab (template.html), and send the tabs as an array to the new tab. Later I will delete the current tabs and display the links on one page to save space (That's the idea of the extension).</p>
  
  <pre><code>function saveAll() {
    var openTabs = [];
  
    chrome.tabs.query({}, function(tabs) {
      for (var i = 0; i &lt; tabs.length; i++) {
        openTabs[i] = tabs[i];
      }
  
      createSavedPage(openTabs);
    });
  }
  
  function createSavedPage(tabsToSave) {
    chrome.tabs.create({
        "url": chrome.extension.getURL("template.html"),
        "active": false
      },
      function(tab) {
        sendListToPage(tab, tabsToSave);
      }
    );
  }
  
  
  function sendListToPage(tab, tabsArray) {
    chrome.tabs.sendMessage(tab.id, {
      "action": "fill-list",
      "data": tabsArray
    });
  }
  
  
  var saveAllButton = document.getElementById("select-all-tabs");
  saveAllButton.addEventListener("click", saveAll);
  </code></pre>
  
  <p>The tab that is created includes a template.js file:</p>
  
  <pre><code>function fillList(array) {
    var list = document.getElementById("link-list");
    for (var item in array) {
      //Something
    }
  }
  
  chrome.runtime.onMessage.addListener(
    function(request, sender, sendResponse) {
  
      if (request.action == "fill-list") {
        var data = request.data;
        fillList(data);
      }
    }
  );
  </code></pre>
  
  <p>When I create the new tab, the message is sent from the extension but never received. What is causing this issue?</p>