| <script src="../../resources/js-test-pre.js"></script> |
| description("Test that promises and mutation observers are both delivered from the same microtask queue."); |
| var jsTestIsAsync = true; |
| new MutationObserver(function() { |
| actualResult.push('mutate'); |
| }).observe(document.body, { attributes: true }); |
| document.body.setAttribute('data-random', Math.random()); |
| Promise.resolve().then(function() { |
| actualResult.push('promise'); |
| actualResult.push('timeout'); |
| if (actualResult.length != expectedResult.length) |
| debug("Expected result: " + expectedResult); |
| debug("Actual result: " + actualResult); |
| shouldBe("actualResult", "expectedResult"); |
| [[timeout, promise, mutate], ["promise", "mutate", "timeout"]], |
| [[timeout, mutate, promise], ["mutate", "promise", "timeout"]] |
| if (currentTest >= tests.length) { |
| tasks = tests[currentTest][0]; |
| expectedResult = tests[currentTest][1]; |
| <script src="../../resources/js-test-post.js"></script> |