B2G/gecko/layout/tools/reftest/reftest-content.js
// of event listener which eventually calls this function.
of event listener which eventually calls this function.
of event listener which eventually calls this function .
function MakeProgress() {
        if (state >= STATE_COMPLETED) {
            LogInfo("MakeProgress: STATE_COMPLETED");
            return;
        }
        FlushRendering();
        switch (state) {
        case STATE_WAITING_TO_FIRE_INVALIDATE_EVENT: {
            LogInfo("MakeProgress: STATE_WAITING_TO_FIRE_INVALIDATE_EVENT");
            if (shouldWaitForExplicitPaintWaiters() || shouldWaitForPendingPaints()) {
                gFailureReason = "timed out waiting for pending paint count to reach zero";
                if (shouldWaitForExplicitPaintWaiters()) {
                    gFailureReason += " (waiting for MozPaintWaitFinished)";
                    LogInfo("MakeProgress: waiting for MozPaintWaitFinished");
                }
                if (shouldWaitForPendingPaints()) {
                    gFailureReason += " (waiting for MozAfterPaint)";
                    LogInfo("MakeProgress: waiting for MozAfterPaint");
                }
                return;
            }
            state = STATE_WAITING_FOR_REFTEST_WAIT_REMOVAL;
            var hasReftestWait = shouldWaitForReftestWaitRemoval(contentRootElement);
            LogInfo("MakeProgress: dispatching MozReftestInvalidate");
            if (contentRootElement) {
                var notification = content.document.createEvent("Events");
                notification.initEvent("MozReftestInvalidate", true, false);
                contentRootElement.dispatchEvent(notification);
            }
            if (hasReftestWait && !shouldWaitForReftestWaitRemoval(contentRootElement)) {
                FlushRendering();
                if (!shouldWaitForPendingPaints() && !shouldWaitForExplicitPaintWaiters()) {
                    LogWarning("MozInvalidateEvent didn't invalidate");
                }
            }
            MakeProgress();
            return;
        }
        case STATE_WAITING_FOR_REFTEST_WAIT_REMOVAL:
            LogInfo("MakeProgress: STATE_WAITING_FOR_REFTEST_WAIT_REMOVAL");
            if (shouldWaitForReftestWaitRemoval(contentRootElement)) {
                gFailureReason = "timed out waiting for reftest-wait to be removed";
                LogInfo("MakeProgress: waiting for reftest-wait to be removed");
                return;
            }
            state = STATE_WAITING_TO_FINISH;
            if (!inPrintMode && doPrintMode(contentRootElement)) {
                LogInfo("MakeProgress: setting up print mode");
                setupPrintMode();
            }
            MakeProgress();
            return;
        case STATE_WAITING_TO_FINISH:
            LogInfo("MakeProgress: STATE_WAITING_TO_FINISH");
            if (shouldWaitForExplicitPaintWaiters() || shouldWaitForPendingPaints()) {
                gFailureReason = "timed out waiting for pending paint count to " +
                    "reach zero (after reftest-wait removed and switch to print mode)";
                if (shouldWaitForExplicitPaintWaiters()) {
                    gFailureReason += " (waiting for MozPaintWaitFinished)";
                    LogInfo("MakeProgress: waiting for MozPaintWaitFinished");
                }
                if (shouldWaitForPendingPaints()) {
                    gFailureReason += " (waiting for MozAfterPaint)";
                    LogInfo("MakeProgress: waiting for MozAfterPaint");
                }
                return;
            }
            LogInfo("MakeProgress: Completed");
            state = STATE_COMPLETED;
            gFailureReason = "timed out while taking snapshot (bug in harness?)";
            RemoveListeners();
            CheckForProcessCrashExpectation();
            setTimeout(RecordResult, 0);
            return;
        }
    }
function MakeProgress ( ) { if ( state >= STATE_COMPLETED ) { LogInfo ( "MakeProgress: STATE_COMPLETED" ) ; return ; } FlushRendering ( ) ; switch ( state ) { case STATE_WAITING_TO_FIRE_INVALIDATE_EVENT : { LogInfo ( "MakeProgress: STATE_WAITING_TO_FIRE_INVALIDATE_EVENT" ) ; if ( shouldWaitForExplicitPaintWaiters ( ) || shouldWaitForPendingPaints ( ) ) { gFailureReason = "timed out waiting for pending paint count to reach zero" ; if ( shouldWaitForExplicitPaintWaiters ( ) ) { gFailureReason += " (waiting for MozPaintWaitFinished)" ; LogInfo ( "MakeProgress: waiting for MozPaintWaitFinished" ) ; } if ( shouldWaitForPendingPaints ( ) ) { gFailureReason += " (waiting for MozAfterPaint)" ; LogInfo ( "MakeProgress: waiting for MozAfterPaint" ) ; } return ; } state = STATE_WAITING_FOR_REFTEST_WAIT_REMOVAL ; var hasReftestWait = shouldWaitForReftestWaitRemoval ( contentRootElement ) ; LogInfo ( "MakeProgress: dispatching MozReftestInvalidate" ) ; if ( contentRootElement ) { var notification = content . document . createEvent ( "Events" ) ; notification . initEvent ( "MozReftestInvalidate" , true , false ) ; contentRootElement . dispatchEvent ( notification ) ; } if ( hasReftestWait && ! shouldWaitForReftestWaitRemoval ( contentRootElement ) ) { FlushRendering ( ) ; if ( ! shouldWaitForPendingPaints ( ) && ! shouldWaitForExplicitPaintWaiters ( ) ) { LogWarning ( "MozInvalidateEvent didn't invalidate" ) ; } } MakeProgress ( ) ; return ; } case STATE_WAITING_FOR_REFTEST_WAIT_REMOVAL : LogInfo ( "MakeProgress: STATE_WAITING_FOR_REFTEST_WAIT_REMOVAL" ) ; if ( shouldWaitForReftestWaitRemoval ( contentRootElement ) ) { gFailureReason = "timed out waiting for reftest-wait to be removed" ; LogInfo ( "MakeProgress: waiting for reftest-wait to be removed" ) ; return ; } state = STATE_WAITING_TO_FINISH ; if ( ! inPrintMode && doPrintMode ( contentRootElement ) ) { LogInfo ( "MakeProgress: setting up print mode" ) ; setupPrintMode ( ) ; } MakeProgress ( ) ; return ; case STATE_WAITING_TO_FINISH : LogInfo ( "MakeProgress: STATE_WAITING_TO_FINISH" ) ; if ( shouldWaitForExplicitPaintWaiters ( ) || shouldWaitForPendingPaints ( ) ) { gFailureReason = "timed out waiting for pending paint count to " + "reach zero (after reftest-wait removed and switch to print mode)" ; if ( shouldWaitForExplicitPaintWaiters ( ) ) { gFailureReason += " (waiting for MozPaintWaitFinished)" ; LogInfo ( "MakeProgress: waiting for MozPaintWaitFinished" ) ; } if ( shouldWaitForPendingPaints ( ) ) { gFailureReason += " (waiting for MozAfterPaint)" ; LogInfo ( "MakeProgress: waiting for MozAfterPaint" ) ; } return ; } LogInfo ( "MakeProgress: Completed" ) ; state = STATE_COMPLETED ; gFailureReason = "timed out while taking snapshot (bug in harness?)" ; RemoveListeners ( ) ; CheckForProcessCrashExpectation ( ) ; setTimeout ( RecordResult , 0 ) ; return ; } }
of event listener which eventually calls this function.
of event listener which eventually calls this function .
// Notify the test document that now is a good time to test some invalidation // MozReftestInvalidate handler removed reftest-wait. // We expect something to have been invalidated... // Try next state // Try next state