Closed Bug 1169568 Opened 9 years ago Closed 9 years ago

alert() / setTimeout(fn, 0) -- event loop broken

Categories

(Firefox :: Untriaged, defect)

38 Branch
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1167575

People

(Reporter: florian, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0
Build ID: 20150518070256

Steps to reproduce:

Get the following code on a page:

<div id="t">go</div>
<script>
function foo() {
    console.log('processing: task #1');
    setTimeout(function () {
        console.log('processing: task #3');
    }, 0);
    alert('See console logs');
    console.log('processing: task #2');
}

t.onclick = foo;
</script>

Live example: http://jsfiddle.net/6xbbgwde/1/


Actual results:

After a couple of runs, the following logs are created:

processing: task #1
processing: task #3
processing: task #2


Expected results:

Should produce the following logs every time the "foo" text is clicked:

processing: task #1
processing: task #2
processing: task #3
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.