title: Firefox addon-sdk - listen for page navigation
body: <p>I am trying to port a Chrome plugin to Firefox using the addon-sdk and I cannot find an equivalent method to listen to tab navigation events.</p>
  
  <p>What I need to do is keep data per page (detected from the DOM), and remove this as soon as the user navigates to a new page in the tab (but, maintain the data on refresh)</p>
  
  <p>I Chrome, to do something when a tab changes URL, I can use:</p>
  
  <pre><code>chrome.tabs.onUpdated.addListener(function(tab_id, changeInfo, tab) {
      if(changeInfo.status == 'loading' &amp;&amp; changeInfo.url) {
          //DO STUFF AS THE URL CHANGED
      }
  });
  </code></pre>
  
  <p>In Firefox using the addon-sdk I have tried using:</p>
  
  <pre><code>tabs.on('open', function(tab){
    tab.on('ready', function(tab){
      if(tab.cachedURL != tab.url) {
        //DO STUFF AND SET CACHE
      }
    });
  });
  </code></pre>
  
  <p>The problem is that I cannot hook into the initial navigation event, so in-between the user starting navigatiion and the DOM of the new page being ready, the old data is available.</p>
  
  <p>Basically I need a way to hook into the initial navigation of a tab and ideally see where it's going (just as I can in Chrome).</p>
  
  <p>Any thoughts?</p>