B2G/gecko/testing/extensions/community/chrome/content/tabs/bugAccess.js
//parse list of bugs html page and return array with ids and descriptions
parse list of bugs html page and return array with ids and descriptions
parse list of bugs html page and return array with ids and descriptions
function parseList(xmlHttp)
  {
  var beginLoc=0;
  var endLoc=0;
  var id;
  var summary;
  bugData=new Array();
  endLoc = xmlHttp.search(/<table class=\"bz_buglist sortable\"/);
  if (endLoc <= 0) {
    alert("ERROR: No Bugs Found.");
    return bugData;
  }
  for(var i = 0;(beginLoc = xmlHttp.indexOf('show_bug.cgi?id',endLoc)) != -1; i++)
  {
    endLoc = xmlHttp.indexOf('"',beginLoc);
    beginLoc = xmlHttp.indexOf('=',beginLoc);
    id=xmlHttp.substring(beginLoc+1, endLoc);
    var curLoc=endLoc;
    endLoc = xmlHttp.indexOf('</tr>',endLoc);
    endLoc = xmlHttp.lastIndexOf('</td>',endLoc);
    beginLoc = xmlHttp.lastIndexOf("<td >",endLoc);
    if(beginLoc==-1)
    {
      beginLoc = xmlHttp.lastIndexOf("<td>",endLoc);
    }
    summary = xmlHttp.substring(beginLoc, endLoc);
    summary = getCleanText(summary);
    bugData[i] = new Array(2);
    bugData[i][0] = id;
    bugData[i][1] = summary;
  }
  return bugData;
}
function parseList ( xmlHttp ) { var beginLoc = 0 ; var endLoc = 0 ; var id ; var summary ; bugData = new Array ( ) ; endLoc = xmlHttp . search ( / <table class=\"bz_buglist sortable\" / ) ; if ( endLoc <= 0 ) { alert ( "ERROR: No Bugs Found." ) ; return bugData ; } for ( var i = 0 ; ( beginLoc = xmlHttp . indexOf ( 'show_bug.cgi?id' , endLoc ) ) != - 1 ; i ++ ) { endLoc = xmlHttp . indexOf ( '"' , beginLoc ) ; beginLoc = xmlHttp . indexOf ( '=' , beginLoc ) ; id = xmlHttp . substring ( beginLoc + 1 , endLoc ) ; var curLoc = endLoc ; endLoc = xmlHttp . indexOf ( '</tr>' , endLoc ) ; endLoc = xmlHttp . lastIndexOf ( '</td>' , endLoc ) ; beginLoc = xmlHttp . lastIndexOf ( "<td >" , endLoc ) ; if ( beginLoc == - 1 ) { beginLoc = xmlHttp . lastIndexOf ( "<td>" , endLoc ) ; } summary = xmlHttp . substring ( beginLoc , endLoc ) ; summary = getCleanText ( summary ) ; bugData [ i ] = new Array ( 2 ) ; bugData [ i ] [ 0 ] = id ; bugData [ i ] [ 1 ] = summary ; } return bugData ; }
parse list of bugs html page and return array with ids and descriptions
parse list of bugs html page and return array with ids and descriptions
//dump(xmlHttp); // Ideally, we'd load the contents of xmlHttp into a document node and do // XPATH queries to get these rather than this brute force parsing, but there // isn't a very clean way to load text/HTML into a document (bug 102699). // So, for now, be sure that we are beginning in the right part of the page, // And not catching bugzilla maintenance bug references in the header. // So we look for the bugs table, i.e. this line:  // <table class="bz_buglist sortable" ...> We set that to our end, so that // the beginLoc is set properly the first time through the loop. // You should never see this, but if you do, then that means the format // of the bugzilla page has changed and we want to return rather than go // into an infinite loop. //move past other entries to get to summary //other option //alert("loop:" + i); //alert("end loop:" + bugData, bugData.length);