rem:  while (true) { var result = gFindInst.findNext(); dump("result of find: " + result + "\n"); if (!result) break; gReplaceDialog.editor.insertText(gReplaceDialog.replaceKey.value); 
add: var finder = Components.classes["@mozilla.org/embedcomp/rangefind;1"].createInstance().QueryInterface(Components.interfaces.nsIFind);  finder.caseSensitive    = gReplaceDialog.caseSensitive.checked; finder.findBackwards = gReplaceDialog.searchBackwards.checked;    var selection = gEditor.selection; var selecRange; if (selection.rangeCount > 0) selecRange = selection.getRangeAt(0); var origRange = selecRange.cloneRange();   var wholeDocRange = gEditor.document.createRange(); var rootNode = gEditor.rootElement.QueryInterface(Components.interfaces.nsIDOMNode); wholeDocRange.selectNodeContents(rootNode);   var startPt = gEditor.document.createRange(); startPt.setStart(wholeDocRange.startContainer, wholeDocRange.startOffset); startPt.setEnd(wholeDocRange.startContainer, wholeDocRange.startOffset);  var endPt = gEditor.document.createRange(); endPt.setStart(wholeDocRange.endContainer, wholeDocRange.endOffset); endPt.setEnd(wholeDocRange.endContainer, wholeDocRange.endOffset);   var foundRange; while ((foundRange = finder.Find(findStr, wholeDocRange, selecRange, endPt)) != null) { gEditor.selection.removeAllRanges(); gEditor.selection.addRange(foundRange); gEditor.insertText(repStr); selection = gEditor.selection; if (selection.rangeCount <= 0) { return; } selecRange = selection.getRangeAt(0); 
context: function onReplaceAll(){  // Transfer dialog contents to the find service.  saveFindData();  // set up the find instance  setUpFindInst();  // Search.  while (true) {    var result = gFindInst.findNext();    dump("result of find: " + result + "\n");    if (!result)      break;    gReplaceDialog.editor.insertText(gReplaceDialog.replaceKey.value);  }  return false;}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/fcf44b284bb5d997c891069c621a48d6402fcac7/EdReplace.js/clean/editor/ui/dialogs/content/EdReplace.js