MutationObserver stops working very easily when there are nested mutations
Reported by
opet...@mozilla.com,
Aug 3 2016
|
|||||
Issue description
UserAgent: Mozilla/5.0 (X11; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0
Example URL:
data:text/html,<script>var c = 0; var node = document.createElement('div'); var appendNode = function() { console.log(++c); document.documentElement.appendChild(node); }; var observer = new MutationObserver(appendNode); observer.observe(document.documentElement, { childList: true }); appendNode(); </script>
Steps to reproduce the problem:
1. load data:text/html,<script>var c = 0; var node = document.createElement('div'); var appendNode = function() { console.log(++c); document.documentElement.appendChild(node); }; var observer = new MutationObserver(appendNode); observer.observe(document.documentElement, { childList: true }); appendNode(); </script>
2. looks at the web console
What is the expected behavior?
The script should lead to endless loop, so some warning should be shown to user about slow script or the child process should be killed.
What went wrong?
MutationObserver just stops working without any exceptions or warnings.
Does it occur on multiple sites: N/A
Is it a problem with a plugin? N/A
Did this work before? N/A
Does this work in other browsers? N/A
Chrome version: Channel: n/a
OS Version:
Flash Version:
,
Aug 12 2016
,
Aug 19 2016
FWIW Firefox does hang and show the unresponsive script dialog. Chrome counts to 4 and stops.
,
Oct 3 2016
Bulk-adding Hotlist-Interop to bugs filed by other browser vendors based on the summary. Feel free to remove if this issue doesn't actually reflect a difference in behavior between engines.
,
Nov 14 2016
This is due to Issue 441355 . In the last call of appendChild callback, document.documentElement.lastChild is |node| itself. So, documentElement.appendChild(node) do nothing because of Issue 441355 . |
|||||
►
Sign in to add a comment |
|||||
Comment 1 by brajkumar@chromium.org
, Aug 4 2016Status: Untriaged (was: Unconfirmed)