title: Get nsIDOMWindow of a Tab to do Text Input
body: <p>Is it possible to use Text Input Processor on a specific Tab of a Firefox window?</p>
  
  <p>Do all the tabs share the same nsIDOMWindow object? If so, then is there any other solution?</p>
  
  <p>Rephrasing my problem: I want to type text to a specific tab, and if there is more than one, then it might not be the current.</p>
  
  <p>Below is an example code to write text on any Firefox window, but only for current tab:</p>
  
  <pre><code>function myTestFunc() {
    // var windows = Services.wm.getEnumerator("navigation:browser");
    var windows = require("sdk/windows");
    for (let browserWindow of windows.browserWindows)  {
      //console.log(window.title);
      var chromeWindow = viewFor(browserWindow);
      console.log(chromeWindow.document.location.href);
      var idomWindow = chromeWindow.QueryInterface(Ci.nsIDOMWindow);
  
      var TIP = Cc["@mozilla.org/text-input-processor;1"].
                createInstance(Ci.nsITextInputProcessor);
      if(!TIP.beginInputTransaction(idomWindow, onNotifyImpl))  {
        console.log("Error TIP can't start");
        continue;
      }
      TIP.setPendingCompositionString("foo-bar-buzz");
      if (!TIP.flushPendingComposition()) {
        console.log("Failed to flush");
        continue; // Composition is not started
      }
    }
  
  }
  </code></pre>