B2G/gaia/apps/settings/js/carrier.js
// query <apn> elements matching the mcc/mnc arguments
query  elements matching the mcc/mnc arguments
query elements matching the mcc / mnc arguments
function queryAPN(callback, usage) {
    if (!callback)
      return;
    var usageFilter = usage;
    if (!usage || usage == 'data') {
      usageFilter = 'default';
    }
    var filter = function(apnList) {
      var found = [];
      for (var i = 0; i < apnList.length; i++) {
        if (apnList[i].type.indexOf(usageFilter) != -1) {
          found.push(apnList[i]);
        }
      }
      return found;
    };
    if (gCompatibleAPN) {
      callback(filter(gCompatibleAPN), usage);
      return;
    }
    loadJSON(APN_FILE, function loadAPN(apn) {
      var mcc = mccMncCodes.mcc;
      var mnc = mccMncCodes.mnc;
      gCompatibleAPN = apn[mcc] ? (apn[mcc][mnc] || []) : [];
      callback(filter(gCompatibleAPN), usage);
    });
  }
function queryAPN ( callback , usage ) { if ( ! callback ) return ; var usageFilter = usage ; if ( ! usage || usage == 'data' ) { usageFilter = 'default' ; } var filter = function ( apnList ) { var found = [ ] ; for ( var i = 0 ; i < apnList . length ; i ++ ) { if ( apnList [ i ] . type . indexOf ( usageFilter ) != - 1 ) { found . push ( apnList [ i ] ) ; } } return found ; } ; if ( gCompatibleAPN ) { callback ( filter ( gCompatibleAPN ) , usage ) ; return ; } loadJSON ( APN_FILE , function loadAPN ( apn ) { var mcc = mccMncCodes . mcc ; var mnc = mccMncCodes . mnc ; gCompatibleAPN = apn [ mcc ] ? ( apn [ mcc ] [ mnc ] || [ ] ) : [ ] ; callback ( filter ( gCompatibleAPN ) , usage ) ; } ) ; }
query <apn> elements matching the mcc/mnc arguments
query <apn > elements matching the mcc / mnc arguments
// filter APNs by usage // early way out if the query has already been performed // load and query APN database, then trigger callback on results // get a list of matching APNs