B2G/gecko/testing/mochitest/server.js
/**
 * Transform nested hashtables of paths to a flat table rows.
 */
Transform nested hashtables of paths to a flat table rows.
Transform nested hashtables of paths to a flat table rows .
function linksToTableRows(links, recursionLevel)
{
  var response = "";
  for (var [link, value] in links) {
    var classVal = (!isTest(link) && !(value instanceof Object))
      ? "non-test invisible"
      : "";
    spacer = "padding-left: " + (10 * recursionLevel) + "px";
    if (value instanceof Object) {
      response += TR({class: "dir", id: "tr-" + link },
                     TD({colspan: "3"}, "&#160;"),
                     TD({style: spacer},
                        A({href: link}, link)));
      response += linksToTableRows(value, recursionLevel + 1);
    } else {
      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 += TR({class: classVal, id: "tr-" + link },
                       TD("0"),
                       TD("0"),
                       TD("0"),
                       TD({style: spacer},
                          A({href: link}, link)));
      } else {
        var bug_url = "https://bugzilla.mozilla.org/show_bug.cgi?id=" + bug_num;
        response += TR({class: classVal, id: "tr-" + link },
                       TD("0"),
                       TD("0"),
                       TD("0"),
                       TD({style: spacer},
                          A({href: link}, link), " - ",
                          A({href: bug_url}, "Bug " + bug_num)));
      }
    }
  }
  return response;
}
function linksToTableRows ( links , recursionLevel ) { var response = "" ; for ( var [ link , value ] in links ) { var classVal = ( ! isTest ( link ) && ! ( value instanceof Object ) ) ? "non-test invisible" : "" ; spacer = "padding-left: " + ( 10 * recursionLevel ) + "px" ; if ( value instanceof Object ) { response += TR ( { class : "dir" , id : "tr-" + link } , TD ( { colspan : "3" } , "&#160;" ) , TD ( { style : spacer } , A ( { href : link } , link ) ) ) ; response += linksToTableRows ( value , recursionLevel + 1 ) ; } else { 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 += TR ( { class : classVal , id : "tr-" + link } , TD ( "0" ) , TD ( "0" ) , TD ( "0" ) , TD ( { style : spacer } , A ( { href : link } , link ) ) ) ; } else { var bug_url = "https://bugzilla.mozilla.org/show_bug.cgi?id=" + bug_num ; response += TR ( { class : classVal , id : "tr-" + link } , TD ( "0" ) , TD ( "0" ) , TD ( "0" ) , TD ( { style : spacer } , A ( { href : link } , link ) , " - " , A ( { href : bug_url } , "Bug " + bug_num ) ) ) ; } } } return response ; }
Transform nested hashtables of paths to a flat table rows.
Transform nested hashtables of paths to a flat table rows .