2 <script src="../js/resources/js-test-pre.js"></script>
4 description('Test that WebKitMutationObserver.disconnect cancels pending delivery');
6 window.jsTestIsAsync = true;
12 div = document.createElement('div');
14 observer = new WebKitMutationObserver(function(m) {
18 observer.observe(div, { attributes: true });
19 div.setAttribute('foo', 'bar');
20 observer.disconnect();
25 debug('Disconnecting should cancel any pending delivery...');
26 shouldBeNull('mutations');
27 observer.observe(div, { attributes: true });
28 div.setAttribute('bar', 'baz');
29 setTimeout(finish, 0);
33 debug('...and re-observing should not see any of the previously-generated records.');
34 shouldBe('mutations.length', '1');
35 shouldBe('mutations[0].attributeName', '"bar"');
39 if (!window.WebKitMutationObserver)
40 testFailed('This test requires ENABLE(MUTATION_OBSERVERS)');
45 <script src="../js/resources/js-test-post.js"></script>