Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: LayoutTests/fast/dom/MutationObserver/disconnect-cancel-pending.html

Issue 12317072: Merge 143386 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1410/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../../js/resources/js-test-pre.js"></script> 2 <script src="../../js/resources/js-test-pre.js"></script>
3 <script> 3 <script>
4 description('Test that WebKitMutationObserver.disconnect cancels pending deliver y'); 4 description('Test that WebKitMutationObserver.disconnect cancels pending deliver y');
5 5
6 window.jsTestIsAsync = true; 6 window.jsTestIsAsync = true;
7 var mutations; 7 var mutations;
8 var observer; 8 var observer;
9 9
10 function start() { 10 function start() {
11 mutations = null; 11 mutations = null;
12 div = document.createElement('div'); 12 div = document.createElement('div');
13 13
14 observer = new WebKitMutationObserver(function(m) { 14 observer = new MutationObserver(function(m) {
15 mutations = m; 15 mutations = m;
16 }); 16 });
17 17
18 observer.observe(div, { attributes: true }); 18 observer.observe(div, { attributes: true });
19 div.setAttribute('foo', 'bar'); 19 div.setAttribute('foo', 'bar');
20 observer.disconnect(); 20 observer.disconnect();
21 setTimeout(next, 0); 21 setTimeout(next, 0);
22 } 22 }
23 23
24 function next() { 24 function next() {
25 debug('Disconnecting should cancel any pending delivery...'); 25 debug('Disconnecting should cancel any pending delivery...');
26 shouldBeNull('mutations'); 26 shouldBeNull('mutations');
27 observer.observe(div, { attributes: true }); 27 observer.observe(div, { attributes: true });
28 div.setAttribute('bar', 'baz'); 28 div.setAttribute('bar', 'baz');
29 setTimeout(finish, 0); 29 setTimeout(finish, 0);
30 } 30 }
31 31
32 function finish() { 32 function finish() {
33 debug('...and re-observing should not see any of the previously-generated re cords.'); 33 debug('...and re-observing should not see any of the previously-generated re cords.');
34 shouldBe('mutations.length', '1'); 34 shouldBe('mutations.length', '1');
35 shouldBe('mutations[0].attributeName', '"bar"'); 35 shouldBe('mutations[0].attributeName', '"bar"');
36 finishJSTest(); 36 finishJSTest();
37 } 37 }
38 38
39 start(); 39 start();
40 </script> 40 </script>
41 <script src="../../js/resources/js-test-post.js"></script> 41 <script src="../../js/resources/js-test-post.js"></script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698