function inputPinAndProcessSignRequest(
    attemptNumber, errorType, signRequest, signRequestReportCallback) {
  requestPin(
      signRequest.signRequestId, attemptNumber, errorType, function(userInput) {
        if (chrome.runtime.lastError) {
          logError(
              'The PIN request failed: ' + chrome.runtime.lastError.message);
          abandonSignRequest(signRequest, signRequestReportCallback);
          return;
        }
        log('The PIN dialog returned "' + userInput + '"');
        if (userInput == VALID_PIN) {
          log('The entered PIN is correct');
          stopPinRequest(null /* errorType */, signRequest.signRequestId);
          processSignRequestWithValidPin(
              signRequest, signRequestReportCallback);
        } else if (attemptNumber < MAXIMUM_PIN_FAILED_ATTEMPT_COUNT) {
          log('The entered PIN is wrong, showing the dialog again');
          inputPinAndProcessSignRequest(
              attemptNumber + 1, 'INVALID_PIN', signRequest,
              signRequestReportCallback);
        } else {
          log('The entered PIN is wrong, and no attempts left');
          stopPinRequest('MAX_ATTEMPTS_EXCEEDED', signRequest.signRequestId);
          abandonSignRequest(signRequest, signRequestReportCallback);
        }
      });
}
// some data if the PIN was entered successfully, or with an error otherwise.
some data if the PIN was entered successfully, or with an error otherwise.
some data if the PIN was entered successfully or with an error otherwise .
function inputPinAndProcessSignRequest(
    attemptNumber, errorType, signRequest, signRequestReportCallback) {
  requestPin(
      signRequest.signRequestId, attemptNumber, errorType, function(userInput) {
        if (chrome.runtime.lastError) {
          logError(
              'The PIN request failed: ' + chrome.runtime.lastError.message);
          abandonSignRequest(signRequest, signRequestReportCallback);
          return;
        }
        log('The PIN dialog returned "' + userInput + '"');
        if (userInput == VALID_PIN) {
          log('The entered PIN is correct');
          stopPinRequest(null , signRequest.signRequestId);
          processSignRequestWithValidPin(
              signRequest, signRequestReportCallback);
        } else if (attemptNumber < MAXIMUM_PIN_FAILED_ATTEMPT_COUNT) {
          log('The entered PIN is wrong, showing the dialog again');
          inputPinAndProcessSignRequest(
              attemptNumber + 1, 'INVALID_PIN', signRequest,
              signRequestReportCallback);
        } else {
          log('The entered PIN is wrong, and no attempts left');
          stopPinRequest('MAX_ATTEMPTS_EXCEEDED', signRequest.signRequestId);
          abandonSignRequest(signRequest, signRequestReportCallback);
        }
      });
}
function inputPinAndProcessSignRequest ( attemptNumber , errorType , signRequest , signRequestReportCallback ) { requestPin ( signRequest . signRequestId , attemptNumber , errorType , function ( userInput ) { if ( chrome . runtime . lastError ) { logError ( 'The PIN request failed: ' + chrome . runtime . lastError . message ) ; abandonSignRequest ( signRequest , signRequestReportCallback ) ; return ; } log ( 'The PIN dialog returned "' + userInput + '"' ) ; if ( userInput == VALID_PIN ) { log ( 'The entered PIN is correct' ) ; stopPinRequest ( null , signRequest . signRequestId ) ; processSignRequestWithValidPin ( signRequest , signRequestReportCallback ) ; } else if ( attemptNumber < MAXIMUM_PIN_FAILED_ATTEMPT_COUNT ) { log ( 'The entered PIN is wrong, showing the dialog again' ) ; inputPinAndProcessSignRequest ( attemptNumber + 1 , 'INVALID_PIN' , signRequest , signRequestReportCallback ) ; } else { log ( 'The entered PIN is wrong, and no attempts left' ) ; stopPinRequest ( 'MAX_ATTEMPTS_EXCEEDED' , signRequest . signRequestId ) ; abandonSignRequest ( signRequest , signRequestReportCallback ) ; } } ) ; }
some data if the PIN was entered successfully, or with an error otherwise.
some data if the PIN was entered successfully or with an error otherwise .
/* errorType */