emberjs/ember.js — pull request #2514 by tricknotes (2013-04-21 07:04:11+00:00)
Title: Fix to keep timers order

When the `Ember.run.later`'s callbacks are given wait-time less than resolution capability of `setTimeout`, they run incorrect order.

My test environment: Opera(12.15) - Mac OS X

Example code:

``` javascript
Ember.run.later(function() {
console.log(2);
}, 3);
Ember.run.later(function() {
console.log(3);
}, 5);
Ember.run.later(function() {
console.log(1);
}, 1);
```

Expected:

```
1
2
3
```

But actual:

```
2
3
1
```

This reason is that expired callbacks run in order by set order (not expires order) in Ember's run loop.

So I modified to sort expired callbacks in order by their expires.