B2G/gecko/testing/mochitest/server.js
/**
 * Transform nested hashtables of paths to nested HTML lists.
 */
Transform nested hashtables of paths to nested HTML lists.
Transform nested hashtables of paths to nested HTML lists .
function linksToListItems(links)
{
  var response = "";
  var children = "";
  for (var [link, value] in links) {
    var classVal = (!isTest(link) && !(value instanceof Object))
      ? "non-test invisible"
      : "test";
    if (value instanceof Object) {
      children = UL({class: "testdir"}, linksToListItems(value)); 
    } else {
      children = "";
    }
    var bug_title = link.match(/test_bug\S+/);
    var bug_num = null;
    if (bug_title != null) {
        bug_num = bug_title[0].match(/\d+/);
    }
    if ((bug_title == null) || (bug_num == null)) {
      response += LI({class: classVal}, A({href: link}, link), children);
    } else {
      var bug_url = "https://bugzilla.mozilla.org/show_bug.cgi?id="+bug_num;
      response += LI({class: classVal}, A({href: link}, link), " - ", A({href: bug_url}, "Bug "+bug_num), children);
    }
  }
  return response;
}
function linksToListItems ( links ) { var response = "" ; var children = "" ; for ( var [ link , value ] in links ) { var classVal = ( ! isTest ( link ) && ! ( value instanceof Object ) ) ? "non-test invisible" : "test" ; if ( value instanceof Object ) { children = UL ( { class : "testdir" } , linksToListItems ( value ) ) ; } else { children = "" ; } var bug_title = link . match ( / test_bug\S+ / ) ; var bug_num = null ; if ( bug_title != null ) { bug_num = bug_title [ 0 ] . match ( / \d+ / ) ; } if ( ( bug_title == null ) || ( bug_num == null ) ) { response += LI ( { class : classVal } , A ( { href : link } , link ) , children ) ; } else { var bug_url = "https://bugzilla.mozilla.org/show_bug.cgi?id=" + bug_num ; response += LI ( { class : classVal } , A ( { href : link } , link ) , " - " , A ( { href : bug_url } , "Bug " + bug_num ) , children ) ; } } return response ; }
Transform nested hashtables of paths to nested HTML lists.
Transform nested hashtables of paths to nested HTML lists .