B2G/gecko/services/aitc/modules/browserid.js
/**
   * Gets an assertion for the specified 'email' and 'audience'
   */
Gets an assertion for the specified 'email' and 'audience'
Gets an assertion for the specified ' email ' and ' audience '
function _getAssertionWithEmail(sandbox, cb, email,
                                                          audience) {
    let self = this;
    function onSuccess(res) {
      sandbox.free();
      if (!res) {
        let msg = "BrowserID.User.getAssertion empty assertion for " + email;
        self._log.error(msg);
        try {
          cb(new Error(msg), null);
        } catch(e) {
          self._log.warn("Callback threw in _getAssertionWithEmail " +
                         CommonUtils.exceptionStr(e));
        }
        return;
      }
      self._log.info("BrowserID.User.getAssertion succeeded");
      try {
        cb(null, res);
      } catch(e) {
        self._log.warn("Callback threw in _getAssertionWithEmail " +
                       CommonUtils.exceptionStr(e));
      }
    }
    function onError(err) {
      sandbox.free();
      self._log.info("BrowserID.User.getAssertion failed");
      try {
        cb(err, null);
      } catch(e) {
        self._log.warn("Callback threw in _getAssertionWithEmail " +
                       CommonUtils.exceptionStr(e));
      }
    }
    sandbox.box.importFunction(onSuccess);
    sandbox.box.importFunction(onError);
    self._log.info("_getAssertionWithEmail Started");
    let scriptText =
      "window.BrowserID.User.getAssertion(" +
        "'" + email + "', "     +
        "'" + audience + "', "  +
        "onSuccess, "           +
        "onError"               +
      ");";
    Cu.evalInSandbox(scriptText, sandbox.box, "1.8", this.ID_URI, 1);
  }
function _getAssertionWithEmail ( sandbox , cb , email , audience ) { let self = this ; function onSuccess ( res ) { sandbox . free ( ) ; if ( ! res ) { let msg = "BrowserID.User.getAssertion empty assertion for " + email ; self . _log . error ( msg ) ; try { cb ( new Error ( msg ) , null ) ; } catch ( e ) { self . _log . warn ( "Callback threw in _getAssertionWithEmail " + CommonUtils . exceptionStr ( e ) ) ; } return ; } self . _log . info ( "BrowserID.User.getAssertion succeeded" ) ; try { cb ( null , res ) ; } catch ( e ) { self . _log . warn ( "Callback threw in _getAssertionWithEmail " + CommonUtils . exceptionStr ( e ) ) ; } } function onError ( err ) { sandbox . free ( ) ; self . _log . info ( "BrowserID.User.getAssertion failed" ) ; try { cb ( err , null ) ; } catch ( e ) { self . _log . warn ( "Callback threw in _getAssertionWithEmail " + CommonUtils . exceptionStr ( e ) ) ; } } sandbox . box . importFunction ( onSuccess ) ; sandbox . box . importFunction ( onError ) ; self . _log . info ( "_getAssertionWithEmail Started" ) ; let scriptText = "window.BrowserID.User.getAssertion(" + "'" + email + "', " + "'" + audience + "', " + "onSuccess, " + "onError" + ");" ; Cu . evalInSandbox ( scriptText , sandbox . box , "1.8" , this . ID_URI , 1 ) ; }
Gets an assertion for the specified 'email' and 'audience'
Gets an assertion for the specified ' email ' and ' audience '
// Cleanup first. // The internal API sometimes calls onSuccess even though no assertion // could be obtained! Double check: // Success