rem: var htmlSource = gSourceContentWindow.value; 
add: var htmlSource = gSourceTextEditor.outputToString(kTextMimeType, 0); 
context: function FinishHTMLSource(){  //Here we need to check whether the HTML source contains <head> and <body> tags  //Or RebuildDocumentFromSource() will fail.  if (IsInHTMLSourceMode())  {    var htmlSource = gSourceContentWindow.value;    if (htmlSource.length > 0)    {      var beginHead = htmlSource.indexOf("<head");      if (beginHead == -1)      {        AlertWithTitle(GetString("Alert"), GetString("NoHeadTag"));        //cheat to force back to Source Mode        gEditorDisplayMode = kDisplayModePreview;        SetDisplayMode(kDisplayModeSource);        throw Components.results.NS_ERROR_FAILURE;      }      var beginBody = htmlSource.indexOf("<body");      if (beginBody == -1)      {        AlertWithTitle(GetString("Alert"), GetString("NoBodyTag"));        //cheat to force back to Source Mode        gEditorDisplayMode = kDisplayModePreview;        SetDisplayMode(kDisplayModeSource);        throw Components.results.NS_ERROR_FAILURE;      }    }  }  // Switch edit modes -- converts source back into DOM document  SetEditMode(gPreviousNonSourceDisplayMode);}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/108824e9bf09210b8fa9e282c7d4989af9f77109/editor.js/buggy/editor/ui/composer/content/editor.js