B2G/gecko/dom/identity/nsDOMIdentity.js
/*
   * Get an assertion.  This function is deprecated.  RPs are
   * encouraged to use the observer API instead (watch + request).
   */
Get an assertion.  This function is deprecated.  RPs are
encouraged to use the observer API instead (watch + request).
Get an assertion . This function is deprecated . RPs are encouraged to use the observer API instead ( watch + request ) .
function nsDOMIdentity_get(aCallback, aOptions) {
    var opts = {};
    aOptions = aOptions || {};
    this._rpWatcher = null;
    opts._internal = true;
    opts.privacyPolicy = aOptions.privacyPolicy || undefined;
    opts.termsOfService = aOptions.termsOfService || undefined;
    opts.privacyURL = aOptions.privacyURL || undefined;
    opts.tosURL = aOptions.tosURL || undefined;
    opts.siteName = aOptions.siteName || undefined;
    opts.siteLogo = aOptions.siteLogo || undefined;
    opts.oncancel = function get_oncancel() {
      if (aCallback) {
        aCallback(null);
        aCallback = null;
      }
    };
    if (checkDeprecated(aOptions, "silent")) {
      if (aCallback) {
        setTimeout(function() { aCallback(null); }, 0);
      }
      return;
    }
    var self = this;
    this.watch({
      _internal: true,
      onlogin: function get_onlogin(assertion, internalParams) {
        if (assertion && aCallback && internalParams && !internalParams.silent) {
          aCallback(assertion);
          aCallback = null;
        }
      },
      onlogout: function get_onlogout() {},
      onready: function get_onready() {
        self.request(opts);
      }
    });
  }
function nsDOMIdentity_get ( aCallback , aOptions ) { var opts = { } ; aOptions = aOptions || { } ; this . _rpWatcher = null ; opts . _internal = true ; opts . privacyPolicy = aOptions . privacyPolicy || undefined ; opts . termsOfService = aOptions . termsOfService || undefined ; opts . privacyURL = aOptions . privacyURL || undefined ; opts . tosURL = aOptions . tosURL || undefined ; opts . siteName = aOptions . siteName || undefined ; opts . siteLogo = aOptions . siteLogo || undefined ; opts . oncancel = function get_oncancel ( ) { if ( aCallback ) { aCallback ( null ) ; aCallback = null ; } } ; if ( checkDeprecated ( aOptions , "silent" ) ) { if ( aCallback ) { setTimeout ( function ( ) { aCallback ( null ) ; } , 0 ) ; } return ; } var self = this ; this . watch ( { _internal : true , onlogin : function get_onlogin ( assertion , internalParams ) { if ( assertion && aCallback && internalParams && ! internalParams . silent ) { aCallback ( assertion ) ; aCallback = null ; } } , onlogout : function get_onlogout ( ) { } , onready : function get_onready ( ) { self . request ( opts ) ; } } ) ; }
Get an assertion.
Get an assertion .
// We use the observer API (watch + request) to implement get(). // Because the caller can call get() and getVerifiedEmail() as // many times as they want, we lift the restriction that watch() can // only be called once. // This flag tells internal_api.js (in the shim) to record in the // login parameters whether the assertion was acquired silently or // with user interaction. // Silent has been deprecated, do nothing. Placing the check here // prevents the callback from being called twice, once with null and // once after internalWatch has been called. See issue #1532: // https://github.com/mozilla/browserid/issues/1532 // Get an assertion by using our observer api: watch + request.