third_party/js/mozmill/shared-modules/localization.js
function checkAccessKeysResults(controller, accessKeysSet) {
  // Sort the access keys to have them in a A->Z order
  var accessKeysList = accessKeysSet.sort();

  // List of access keys
  var aKeysList = [];

  // List of values to identify the access keys
  var valueList = [];

  // List of rectangles of nodes containing access keys
  var rects = [];

  // List of rectangles of nodes with broken access keys
  var badRects = [];

  // Makes lists of all access keys and the values the access keys are in
  for (var i = 0; i < accessKeysList.length; i++) {
    var accessKey = accessKeysList[i][0];
    var node = accessKeysList[i][1];

    // Set the id and label to be shown in the console
    var id = node.id || "(id is undefined)";
    var label = node.label || "(label is undefined)";

    var box = node.boxObject;

    var innerIds = [];
    var innerRects = [];

    // if the access key is already in our list, take it out to replace it
    // later
    if (accessKey == aKeysList[aKeysList.length-1]) {
      innerIds = valueList.pop();
      innerRects = rects.pop();
    } else {
      aKeysList.push([accessKey]);
    }
    innerIds.push("[id: " + id + ", label: " + label + "]");
    valueList.push(innerIds);
    innerRects.push([box.x, box.y, box.width, box.height]);
    rects.push(innerRects);
  }

  // Go through all access keys and find the duplicated ones
  for (var i = 0; i < valueList.length; i++) {
    // Only access keys contained in more than one node are the ones we are
    // looking for
    if (valueList[i].length > 1) {
      for (var j = 0; j < rects[i].length; j++) {
        badRects.push(rects[i][j]);
      }
      jumlib.assert(false, 'accessKey: ' + aKeysList[i] +
                    ' found in string\'s: ' + valueList[i].join(", "));
    }
  }

  // If we have found broken access keys, make a screenshot
  if (badRects.length > 0) {
    screenshot.create(controller, badRects);
  }
}
function checkAccessKeysResults(controller, accessKeysSet) {
  // Sort the access keys to have them in a A->Z order
  var accessKeysList = accessKeysSet.sort();

  // List of access keys
  var aKeysList = [];

  // List of values to identify the access keys
  var valueList = [];

  // List of rectangles of nodes containing access keys
  var rects = [];

  // List of rectangles of nodes with broken access keys
  var badRects = [];

  // Makes lists of all access keys and the values the access keys are in
  for (var i = 0; i < accessKeysList.length; i++) {
    var accessKey = accessKeysList[i][0];
    var node = accessKeysList[i][1];

    // Set the id and label to be shown in the console
    var id = node.id || "(id is undefined)";
    var label = node.label || "(label is undefined)";

    var box = node.boxObject;

    var innerIds = [];
    var innerRects = [];

    // if the access key is already in our list, take it out to replace it
    // later
    if (accessKey == aKeysList[aKeysList.length-1]) {
      innerIds = valueList.pop();
      innerRects = rects.pop();
    } else {
      aKeysList.push([accessKey]);
    }
    innerIds.push("[id: " + id + ", label: " + label + "]");
    valueList.push(innerIds);
    innerRects.push([box.x, box.y, box.width, box.height]);
    rects.push(innerRects);
  }

  // Go through all access keys and find the duplicated ones
  for (var i = 0; i < valueList.length; i++) {
    // Only access keys contained in more than one node are the ones we are
    // looking for
    if (valueList[i].length > 1) {
      for (var j = 0; j < rects[i].length; j++) {
        badRects.push(rects[i][j]);
      }
      jumlib.assert(false, 'accessKey: ' + aKeysList[i] +
                    ' found in string\'s: ' + valueList[i].join(", "));
    }
  }

  // If we have found broken access keys, make a screenshot
  if (badRects.length > 0) {
    screenshot.create(controller, badRects);
  }
}
function checkAccessKeysResults ( controller , accessKeysSet ) { // Sort the access keys to have them in a A->Z order var accessKeysList = accessKeysSet . sort ( ) ; // List of access keys var aKeysList = [ ] ; // List of values to identify the access keys var valueList = [ ] ; // List of rectangles of nodes containing access keys var rects = [ ] ; // List of rectangles of nodes with broken access keys var badRects = [ ] ; // Makes lists of all access keys and the values the access keys are in for ( var i = 0 ; i < accessKeysList . length ; i ++ ) { var accessKey = accessKeysList [ i ] [ 0 ] ; var node = accessKeysList [ i ] [ 1 ] ; // Set the id and label to be shown in the console var id = node . id || "(id is undefined)" ; var label = node . label || "(label is undefined)" ; var box = node . boxObject ; var innerIds = [ ] ; var innerRects = [ ] ; // if the access key is already in our list, take it out to replace it // later if ( accessKey == aKeysList [ aKeysList . length - 1 ] ) { innerIds = valueList . pop ( ) ; innerRects = rects . pop ( ) ; } else { aKeysList . push ( [ accessKey ] ) ; } innerIds . push ( "[id: " + id + ", label: " + label + "]" ) ; valueList . push ( innerIds ) ; innerRects . push ( [ box . x , box . y , box . width , box . height ] ) ; rects . push ( innerRects ) ; } // Go through all access keys and find the duplicated ones for ( var i = 0 ; i < valueList . length ; i ++ ) { // Only access keys contained in more than one node are the ones we are // looking for if ( valueList [ i ] . length > 1 ) { for ( var j = 0 ; j < rects [ i ] . length ; j ++ ) { badRects . push ( rects [ i ] [ j ] ) ; } jumlib . assert ( false , 'accessKey: ' + aKeysList [ i ] + ' found in string\'s: ' + valueList [ i ] . join ( ", " ) ) ; } } // If we have found broken access keys, make a screenshot if ( badRects . length > 0 ) { screenshot . create ( controller , badRects ) ; } }
Callback function for parsing the results of testing for duplicated
access keys.

This function processes the access keys found in one access keys scope
looking for access keys that are listed more than one time.
At the end, it calls the screenshot.create to create a screenshot with the
elements containing the broken access keys highlighted.

@param {array of array of object} accessKeysSet
@param {MozmillController} controller
Callback function for parsing the results of testing for duplicated access keys .