rem: var viewsource = window._content.document.body; 
add: var viewsource = window.content.document.body; 
context: function goToLine(line){  var viewsource = window._content.document.body;  //  // The source document is made up of a number of pre elements with  // id attributes in the format <pre id="line123">, meaning that  // the first line in the pre element is number 123.  // Do binary search to find the pre element containing the line.  //  var pre;  for (var lbound = 0, ubound = viewsource.childNodes.length; ; ) {    var middle = (lbound + ubound) >> 1;    pre = viewsource.childNodes[middle];    var firstLine = parseInt(pre.id.substring(4));    if (lbound == ubound - 1) {      break;    }    if (line >= firstLine) {      lbound = middle;    } else {      ubound = middle;    }  }  var result = {};  var found = findLocation(pre, line, null, -1, false, result);  if (!found) {    return false;  }  var selection = window._content.getSelection();  selection.removeAllRanges();  // In our case, the range's startOffset is after "\n" on the previous line.  // Tune the selection at the beginning of the next line and do some tweaking  // to position the focusNode and the caret at the beginning of the line.  selection.QueryInterface(nsISelectionPrivate)    .interlinePosition = true;	  selection.addRange(result.range);  if (!selection.isCollapsed) {    selection.collapseToEnd();    var offset = result.range.startOffset;    var node = result.range.startContainer;    if (offset < node.data.length) {      // The same text node spans across the "\n", just focus where we were.      selection.extend(node, offset);    }    else {      // There is another tag just after the "\n", hook there. We need      // to focus a safe point because there are edgy cases such as      // <span>...\n</span><span>...</span> vs.      // <span>...\n<span>...</span></span><span>...</span>      node = node.nextSibling ? node.nextSibling : node.parentNode.nextSibling;      selection.extend(node, 0);    }  }  var selCon = getSelectionController();  selCon.setDisplaySelection(nsISelectionController.SELECTION_ON);  selCon.setCaretEnabled(true);  selCon.setCaretVisibilityDuringSelection(true);  // Scroll the beginning of the line into view.  selCon.scrollSelectionIntoView(    nsISelectionController.SELECTION_NORMAL,    nsISelectionController.SELECTION_FOCUS_REGION,    true);  gLastLineFound = line;  document.getElementById("statusbar-line-col").label = getViewSourceBundle()      .getFormattedString("statusBarLineCol", [line, 1]);  return true;}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/2d615b33f1278e79940a8b238593a0fe94b879a0/viewsource.js/buggy/suite/browser/viewsource.js