Wait until the modal dialog has been processed.

@param {Number} aTimeout (optional - default 5s)
Duration to wait
428177
function modalDialog_waitForDialog(aTimeout) {
    var timeout = aTimeout || TIMEOUT_MODAL_DIALOG;

    if (!this._observer) {
      return;
    }

    try {
      mozmill.utils.waitFor(function () {
        return this.finished;
      }, "Modal dialog has been found and processed", timeout, undefined, this);

      // Forward the raised exception so we can detect failures in modal dialogs
      if (this._observer.exception) {
        throw this._observer.exception;
      }
    }
    finally {
      this.stop();
    }
  }
712787
def wait_for_mode(self, mode, timeout=None):
        '''
        '''

        if not isinstance(mode, VehicleMode):
            mode = VehicleMode(mode)

        self.mode = mode

        self.wait_for(lambda: self.mode.name == mode.name,
                      timeout=timeout,
                      errmsg='failed to set flight mode')
92099
protected void handleTimeout(REQID rid) {
    if (contextMap.containsKey(rid)) {
      Object ctx = contextMap.get(rid);
      contextMap.remove(rid);
      responseMessageMap.remove(rid);
      onResponse(StatusCode.TIMEOUT_ERROR, ctx, null);
    } else {
      // Since we dont do cancel timer, this is because we already have
      // the response. So just disregard this timeout
      // TODO:- implement cancel timer to avoid this overhead
    }
  }
547652
function () {

            if (timeout) {
                clearTimeout(timeout);
                timeout = undefined;
            }

            if (startType !== "manual") {

                var delay = 0;

                if (startType === "delayed") {
                    delay = elapsedTime;
                }

                if (delay > maxDelay) {
                    delay = maxDelay;
                }
                timeout = setTimeout(makePreviewHtml, delay);
            }
        }
333172
void waitRun(long waitMillis, int waitNanos, boolean cancelOnTimeOut) {
        if (!mDone) {
            synchronized (this) {
                if (!mDone) {
                    try {
                        this.wait(waitMillis, waitNanos);
                    } catch (InterruptedException ignored) {
                    } finally {
                        if (!mDone && cancelOnTimeOut)
                            mDone = true;
                    }
                }
            }
        }
    }
83642
function waitTimer (self) {
  self = self || this
  if (self._waitTime) {
    clearTimeout(self._timer)
    self._timer = setTimeout(function () {
      self.emit('waitTimeout')
      self.debug('Closed by waitTimer')
      self.close()
    }, self._waitTime)
  }
}
983688
function startTimeout(func, time, self) {
  return {
    timer: setTimeout(func.bind(self), time),
    stopped: false
  };
}
33656
function when (condition, fn, interval) {
  if (condition()) return callback.async(fn);

  var ref = setInterval(function () {
    if (!condition()) return;
    callback(fn);
    clearInterval(ref);
  }, interval || 10);
}
575858
public void processTimeout(TimeoutEvent timeout) {
    ClientTransaction trans = timeout.getClientTransaction();
    if (trans == null) {
      return;
    }

    SipTransaction sip_trans = null;
    synchronized (respTransactions) {
      sip_trans = (SipTransaction) respTransactions.get(trans);
    }

    if (sip_trans == null) {
      return;
    }

    if (trans.getState().getValue() == TransactionState._TERMINATED) {
      synchronized (respTransactions) {
        respTransactions.remove(trans);
      }
    }

    // check for listener handling
    MessageListener listener = sip_trans.getClientListener();
    if (listener != null) {
      listener.processEvent(timeout);
      return;
    }

    // if no listener, use the default blocking mechanism
    synchronized (sip_trans.getBlock()) {
      sip_trans.getEvents().addLast(timeout);
      sip_trans.getBlock().notifyEvent();
    }
  }
1074549
def wait_for_event(self, event, timeout=10):
        
        return self.__handler.wait_for_event(event, timeout=timeout)
852348
function addonsManager_waitforOpened(aSpec) {
    var spec = aSpec || { };
    var timeout = (spec.timeout == undefined) ? TIMEOUT : spec.timeout;

    // TODO: restore after 1.5.1 has landed
    // var self = this;
    //
    // mozmill.utils.waitFor(function() {
    //   return self.isOpen;
    // }, timeout, 100, "Add-ons Manager has been opened");
    
    mozmill.utils.waitForEval("subject.isOpen", timeout, 100, this);

    // The first tab found will be the selected one
    var tab = this.getTabs()[0];
    tab.controller.waitForPageLoad();

    return tab;
  }
830724
protected void waitForCommand(ITimerCallback callback, long timeout) throws WidgetTimeoutException {
		WaitForConditionTimer t = new WaitForConditionTimer(getByLocator(), callback);
		t.waitUntil(timeout);
	}
433425
function waitFor(check, cb, params) {
    params = params || {};
    if (typeof cb === 'object') {
      params = cb;
      cb = params.done;
    }

    var milliseconds = params.interval || 30,
        j = 0;

    var i = setInterval(function() {
      if (check()) {
        clearInterval(i);
        cb(null);
      }

      if (params.timeout && params.timeout - (j * milliseconds) <= 0) {
        clearInterval(i);
        cb(new Error('timeout'));
      }

      j++;
    }, milliseconds);
  }
560878
def wait(self, timeout):
        """"""
        self.condition.acquire()
        self.condition.wait(timeout // 1000)
        self.condition.release()
235898
private synchronized void waitForPush() {
        long waitStart = -1L;
        
        while( waiting != null && waiting.isEmpty() && !loaded ) {
            long untouched = System.currentTimeMillis() - lastTouch;
            
            if( untouched > timeout.longValue() ) {
                logger.error("[" + this + "] Jiterator timeout for " + getName());
                setLoadException(new TimeoutException("Jiterator " + getName() + " timed out while loading"));
            }
            if( waitStart == -1L ) {
                waitStart = System.currentTimeMillis();
            }
            else {
                if( (System.currentTimeMillis() - waitStart) > CalendarWrapper.MINUTE ) {
                    if( (System.currentTimeMillis() - scream) > CalendarWrapper.MINUTE ) {
                        scream = System.currentTimeMillis();
                        logger.warn("[" + this + "] " + ((System.currentTimeMillis()-lastTouch)/1000) + " seconds since last touch.");
                    }
                }
            }
            long multiplier = (untouched/(15 * CalendarWrapper.SECOND)) + 1;

            try { wait(150L * multiplier); }
            catch( InterruptedException ignore ) { }
        }        
    }
422342
function(cls, options) {
            var d = Q.defer();

            cls = cls || DialogView;
            var diag = new cls(options);

            diag.once("close", function(result, e) {
                if (result != null) {
                    d.resolve(result);
                } else {
                    d.reject(result);
                }
            });
            setTimeout(function() {
                d.notify(diag);
            }, 1);
            diag.update();

            return d.promise;
        }
68358
function setTimeoutContext(fn, ctx, timeout) {
  var id;

  var cancel = function() {
    clearTimeout(id);
  };

  id = setTimeout(function() {
    ctx.removeListener('cancel', cancel);

    fn();
  }, timeout);

  ctx.once('cancel', cancel);
}