Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <html> |
michael@0 | 2 | <head> |
michael@0 | 3 | <title></title> |
michael@0 | 4 | <script> |
michael@0 | 5 | |
michael@0 | 6 | var div = document.createElement("div"); |
michael@0 | 7 | |
michael@0 | 8 | var M; |
michael@0 | 9 | if ("MozMutationObserver" in window) { |
michael@0 | 10 | M = window.MozMutationObserver; |
michael@0 | 11 | } else if ("WebKitMutationObserver" in window) { |
michael@0 | 12 | M = window.WebKitMutationObserver; |
michael@0 | 13 | } else { |
michael@0 | 14 | M = window.MutationObserver; |
michael@0 | 15 | } |
michael@0 | 16 | |
michael@0 | 17 | var didCall1 = false; |
michael@0 | 18 | var didCall2 = false; |
michael@0 | 19 | function testMutationObserverInDialog() { |
michael@0 | 20 | div.innerHTML = "<span>1</span><span>2</span>"; |
michael@0 | 21 | m = new M(function(records, observer) { |
michael@0 | 22 | opener.is(records[0].type, "childList", "Should have got childList"); |
michael@0 | 23 | opener.is(records[0].removedNodes.length, 2, "Should have got removedNodes"); |
michael@0 | 24 | opener.is(records[0].addedNodes.length, 1, "Should have got addedNodes"); |
michael@0 | 25 | observer.disconnect(); |
michael@0 | 26 | m = null; |
michael@0 | 27 | didCall1 = true; |
michael@0 | 28 | }); |
michael@0 | 29 | m.observe(div, { childList: true }); |
michael@0 | 30 | div.innerHTML = "<span><span>foo</span></span>"; |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | function testMutationObserverInDialog2() { |
michael@0 | 34 | div.innerHTML = "<span>1</span><span>2</span>"; |
michael@0 | 35 | m = new M(function(records, observer) { |
michael@0 | 36 | opener.is(records[0].type, "childList", "Should have got childList"); |
michael@0 | 37 | opener.is(records[0].removedNodes.length, 2, "Should have got removedNodes"); |
michael@0 | 38 | opener.is(records[0].addedNodes.length, 1, "Should have got addedNodes"); |
michael@0 | 39 | observer.disconnect(); |
michael@0 | 40 | m = null; |
michael@0 | 41 | didCall2 = true; |
michael@0 | 42 | }); |
michael@0 | 43 | m.observe(div, { childList: true }); |
michael@0 | 44 | div.innerHTML = "<span><span>foo</span></span>"; |
michael@0 | 45 | } |
michael@0 | 46 | |
michael@0 | 47 | window.addEventListener("load", testMutationObserverInDialog); |
michael@0 | 48 | window.addEventListener("load", testMutationObserverInDialog2); |
michael@0 | 49 | window.addEventListener("load", |
michael@0 | 50 | function() { |
michael@0 | 51 | opener.ok(didCall1, "Should have called 1st mutation callback"); |
michael@0 | 52 | opener.ok(didCall2, "Should have called 2nd mutation callback"); |
michael@0 | 53 | window.close(); |
michael@0 | 54 | }); |
michael@0 | 55 | </script> |
michael@0 | 56 | <style> |
michael@0 | 57 | </style> |
michael@0 | 58 | </head> |
michael@0 | 59 | <body> |
michael@0 | 60 | <input type="button" onclick="window.close()" value="close"> |
michael@0 | 61 | </body> |
michael@0 | 62 | </html> |