B2G/gecko/toolkit/mozapps/update/test/chrome/utils.js
/**
 * If an update window is found SimpleTest.executeSoon can callback before the
 * update window is fully closed especially with debug builds. If an update
 * window is found this function will call itself using SimpleTest.executeSoon
 * up to the amount declared in CLOSE_WINDOW_TIMEOUT_MAXCOUNT until the update
 * window has closed before continuing the test.
 */
If an update window is found SimpleTest.executeSoon can callback before the
update window is fully closed especially with debug builds. If an update
window is found this function will call itself using SimpleTest.executeSoon
up to the amount declared in CLOSE_WINDOW_TIMEOUT_MAXCOUNT until the update
window has closed before continuing the test.
If an update window is found SimpleTest . executeSoon can callback before the update window is fully closed especially with debug builds . If an update window is found this function will call itself using SimpleTest . executeSoon up to the amount declared in CLOSE_WINDOW_TIMEOUT_MAXCOUNT until the update window has closed before continuing the test .
function runTestDefaultWaitForWindowClosed() {
  gCloseWindowTimeoutCounter++;
  if (gCloseWindowTimeoutCounter > CLOSE_WINDOW_TIMEOUT_MAXCOUNT) {
    try {
      finishTest();
    }
    catch (e) {
      finishTestDefault();
    }
    return;
  }
  if (closeUpdateWindow()) {
    SimpleTest.executeSoon(runTestDefaultWaitForWindowClosed);
  }
  else {
    Services.ww.registerNotification(gWindowObserver);
    gCloseWindowTimeoutCounter = 0;
    setupPrefs();
    removeUpdateDirsAndFiles();
    reloadUpdateManagerData();
    setupAddons(runTest);
  }
}
function runTestDefaultWaitForWindowClosed ( ) { gCloseWindowTimeoutCounter ++ ; if ( gCloseWindowTimeoutCounter > CLOSE_WINDOW_TIMEOUT_MAXCOUNT ) { try { finishTest ( ) ; } catch ( e ) { finishTestDefault ( ) ; } return ; } if ( closeUpdateWindow ( ) ) { SimpleTest . executeSoon ( runTestDefaultWaitForWindowClosed ) ; } else { Services . ww . registerNotification ( gWindowObserver ) ; gCloseWindowTimeoutCounter = 0 ; setupPrefs ( ) ; removeUpdateDirsAndFiles ( ) ; reloadUpdateManagerData ( ) ; setupAddons ( runTest ) ; } }
If an update window is found SimpleTest.executeSoon can callback before the
 update window is fully closed especially with debug builds.
If an update window is found SimpleTest . executeSoon can callback before the update window is fully closed especially with debug builds .
// The update window should not be open at this time. If it is the call to // |closeUpdateWindow| will close it and cause the test to fail.