Bug 140043
Summary: | js/dom/Promise.html is flaky | ||
---|---|---|---|
Product: | WebKit | Reporter: | Alexey Proskuryakov <ap> |
Component: | Tools / Tests | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW | ||
Severity: | Normal | CC: | ggaren, ryanhaddad, sam |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
See Also: | https://bugs.webkit.org/show_bug.cgi?id=160857 | ||
Bug Depends on: | 147933 | ||
Bug Blocks: |
Alexey Proskuryakov
js/dom/Promise.html is flaky, frequently failing in debug builds. Not sure if it's a test deficiency, or a legitimate bug.
About to run test - promiseAsync
PASS foo is foo
PASS foo is foo
PASS foo is foo
FAIL foo should be bar
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Alexey Proskuryakov
Marked as flaky in <http://trac.webkit.org/r177865>.
Alexey Proskuryakov
Are promise and setTimeout timers on different event queues?
function promiseAsync() {
var global = "foo";
var f = new Promise(function(r1, r2) {
is(global, "foo", "Global should be foo");
r1(42);
is(global, "foo", "Global should still be foo");
setTimeout(function() {
is(global, "bar", "Global should still be bar!");
runTest();
}, 0);
}).then(function() {
global = "bar";
});
is(global, "foo", "Global should still be foo (2)");
}
Sam Weinig
(In reply to comment #2)
> Are promise and setTimeout timers on different event queues?
They are...kind of.
Sam Weinig
(In reply to comment #3)
> (In reply to comment #2)
> > Are promise and setTimeout timers on different event queues?
>
> They are...kind of.
I don't think anything in our implementation ensures this ordering, but it really should. This is a great example of why it would be great if we have a unified event loop mechanism.
In this case, the bug is that the .then() should run at the next microtask checkpoint, which is defined as being before the next chance for a timer to fire. Our implementation of Promises does not use the microtask checkpoint, but rather uses ScriptExecutionContext::postTask() mechanism, which is not quite the same thing.
Ryan Haddad
The test is also flaky on release, so I removed the debug flag in http://trac.webkit.org/projects/webkit/changeset/210898
https://webkit-test-results.webkit.org/dashboards/flakiness_dashboard.html#showAllRuns=true&tests=js%2Fdom%2FPromise.html