diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2020-01-22 21:07:19 -0500 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2020-01-26 15:50:50 -0500 |
commit | 2077cdb41e3ef814cbbef482774d8bbec464fb1c (patch) | |
tree | 4646b9f4e1568da54c06adcf6ed3a4c27b9d7e60 /dom/base/test | |
parent | 43a8113072b96affb2b7a3a7a4e965547d3d0c41 (diff) | |
download | uxp-2077cdb41e3ef814cbbef482774d8bbec464fb1c.tar.gz |
Bug 1406922 - Make CycleCollectedJSContext to handle microtasks and make MutationObserver to use them
Tag UXP Issue #1344
Diffstat (limited to 'dom/base/test')
-rw-r--r-- | dom/base/test/test_mutationobservers.html | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/dom/base/test/test_mutationobservers.html b/dom/base/test/test_mutationobservers.html index a6de89595b..7e4c994235 100644 --- a/dom/base/test/test_mutationobservers.html +++ b/dom/base/test/test_mutationobservers.html @@ -362,7 +362,7 @@ function testChildList5() { is(records[5].previousSibling, c3, ""); is(records[5].nextSibling, c5, ""); observer.disconnect(); - then(testAdoptNode); + then(testNestedMutations); m = null; }); m.observe(div, { childList: true, subtree: true }); @@ -375,6 +375,37 @@ function testChildList5() { div.appendChild(emptyDF); // empty document shouldn't cause mutation records } +function testNestedMutations() { + div.textContent = null; + div.appendChild(document.createTextNode("foo")); + var m2WasCalled = false; + m = new M(function(records, observer) { + is(records[0].type, "characterData", "Should have got characterData"); + observer.disconnect(); + m = null; + m3 = new M(function(records, observer) { + ok(m2WasCalled, "m2 should have been called before m3!"); + is(records[0].type, "characterData", "Should have got characterData"); + observer.disconnect(); + then(testAdoptNode); + m3 = null; + }); + m3.observe(div, { characterData: true, subtree: true}); + div.firstChild.data = "foo"; + }); + m2 = new M(function(records, observer) { + m2WasCalled = true; + is(records[0].type, "characterData", "Should have got characterData"); + observer.disconnect(); + m2 = null; + }); + m2.observe(div, { characterData: true, subtree: true}); + div.appendChild(document.createTextNode("foo")); + m.observe(div, { characterData: true, subtree: true }); + + div.firstChild.data = "bar"; +} + function testAdoptNode() { var d1 = document.implementation.createHTMLDocument(null); var d2 = document.implementation.createHTMLDocument(null); |