It seems that the pattern of getting the card lock retry count and showing the result is repeated three times along this file. It might be good to write an aux function for it. Something like:
```
function showRetryCount(lockType, uiElement) {
  var request = icc.mozIcc.getCardLockRetryCount(locktype);
  request.onsuccess = function() {
    var retryCount = request.result.retryCount;
    if (retryCount) {
      var l10nArgs = {n: retryCount};
      if (!UIManager[uiElement]) {
        console.warning("Damn it! ... bla bla");
        return;
      }
      UIManager[uiElement].textContent = _('inputCodeRetriesLeft',
                                                                     l10nArgs);
      UIManager[uiElement].classList.remove('hidden');
    }
  };
  request.onerror = function() {
    console.error(request.error.name);
  };
}
```