B2G/gecko/accessible/tests/mochitest/common.js
/**
 * Invokes the given function when document is loaded and focused. Preferable
 * to mochitests 'addLoadEvent' function -- additionally ensures state of the
 * document accessible is not busy.
 *
 * @param aFunc  the function to invoke
 */
Invokes the given function when document is loaded and focused. Preferable
to mochitests 'addLoadEvent' function -- additionally ensures state of the
document accessible is not busy.

@param aFunc  the function to invoke
Invokes the given function when document is loaded and focused . Preferable to mochitests ' addLoadEvent ' function -- additionally ensures state of the document accessible is not busy . @param aFunc the function to invoke
function addA11yLoadEvent(aFunc, aWindow)
{
  function waitForDocLoad()
  {
    window.setTimeout(
      function()
      {
        var targetDocument = aWindow ? aWindow.document : document;
        var accDoc = getAccessible(targetDocument);
        var state = {};
        accDoc.getState(state, {});
        if (state.value & STATE_BUSY)
          return waitForDocLoad();
        window.setTimeout(aFunc, 0);
      },
      0
    );
  }
  SimpleTest.waitForFocus(waitForDocLoad, aWindow);
}
function addA11yLoadEvent ( aFunc , aWindow ) { function waitForDocLoad ( ) { window . setTimeout ( function ( ) { var targetDocument = aWindow ? aWindow . document : document ; var accDoc = getAccessible ( targetDocument ) ; var state = { } ; accDoc . getState ( state , { } ) ; if ( state . value & STATE_BUSY ) return waitForDocLoad ( ) ; window . setTimeout ( aFunc , 0 ) ; } , 0 ) ; } SimpleTest . waitForFocus ( waitForDocLoad , aWindow ) ; }
Invokes the given function when document is loaded and focused.
Invokes the given function when document is loaded and focused .