rem: textEditor = gEditor.QueryInterface(Components.interfaces.nsIPlaintextEditor); if (textEditor) 
add: if (gEditor) 
context: function SwitchInsertCharToAnotherEditorOrClose(){  if ("InsertCharWindow" in window && window.InsertCharWindow)  {    var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService();    var windowManagerInterface = windowManager.QueryInterface( Components.interfaces.nsIWindowMediator);    var enumerator = windowManagerInterface.getEnumerator( null );    // TODO: Fix this to search for command controllers and look for "cmd_InsertChars"    // For now, detect just Web Composer and HTML Mail Composer    while ( enumerator.hasMoreElements()  )    {      var  tempWindow = enumerator.getNext();      if (tempWindow != window && tempWindow != window.InsertCharWindow &&           ("editorShell" in tempWindow) && tempWindow.editorShell)      {        textEditor = gEditor.QueryInterface(Components.interfaces.nsIPlaintextEditor);        if (textEditor)        {          tempWindow.InsertCharWindow = window.InsertCharWindow;          window.InsertCharWindow = null;          tempWindow.InsertCharWindow.editorShell = tempWindow.editorShell;          tempWindow.InsertCharWindow.opener = tempWindow;          return;        }      }    }    // Didn't find another editor - close the dialog    window.InsertCharWindow.close();  }}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/d56262a401c9d60bbef8fdbf3317ef55705279f1/editor.js/buggy/editor/ui/composer/content/editor.js