title: How can I get instances of different tabs such that I can store variables / perform operations specific to respective tabs
body: <p>Note: I am using GWT to build a firefox extension</p>
  
  <p>Say I have a class which operates on the different TABs of the browser:</p>
  
  <pre class="lang-java prettyprint-override"><code>class TabRoutine{
    Element tab;
    static int tabData;
  
    public TabRoutine(Element tab){
      this.tab=tab;
    }
  
    public void tabMethod(){
      //Operation on tab
    }      
  }
  </code></pre>
  
  <p>For each tab I must create an instance of this class which I want to destroy once the tab closes. Therefore each tab has an int tabData related to it. Here is how I approached it:</p>
  
  <p>I have the document element pertaining to each tab available with me (I also have the window object if that helps). Therefore, I decided to use </p>
  
  <pre class="lang-javascript prettyprint-override"><code>gBrowser.getBrowserForDocument(doc);
  </code></pre>
  
  <p>My question is does this Browser element I get unique for tabs? What I imply is that say I have 2 tabs with documents doc1 and doc2. If I map these Browser elements to objects of TabRoutine, would each individual tab always return the same (and correct) browser so that i can find the object related to it?</p>
  
  <p>Please tell if some aspect of the question is unclear and I'll elaborate. Thanks a lot!</p>