Closed Bug 1395767 Opened 7 years ago Closed 6 years ago

Changing attributes in a MutationObserver hangs FF

Categories

(Core :: CSS Parsing and Computation, defect, P3)

57 Branch
x86_64
All
defect

Tracking

()

VERIFIED FIXED
mozilla63
Tracking Status
firefox-esr52 --- wontfix
firefox-esr60 --- wontfix
firefox55 - wontfix
firefox56 - wontfix
firefox57 - wontfix
firefox61 --- wontfix
firefox62 --- wontfix
firefox63 --- verified

People

(Reporter: ryan.jentzsch, Unassigned)

References

Details

(Keywords: regression, regressionwindow-wanted)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0 Build ID: 20170817115854 Steps to reproduce: See this JSFiddle: https://jsfiddle.net/RyanNerd/60xw1mbd/6/ Stretch the textarea element to more than 300px. Actual results: FF Hangs when the style attribute is changed inside the MutationObserver callback function. Note: I'm guessing that this is a recursion issue since attributes are being observed by the MutationObserver and within the callback function the observed attribute gets changed. My platform info: FF 55.0.2 (64-bit) Linux Mint 18.1 Expected results: FF should not hang when an attribute is updated in a MutationObserver callback function. The Fiddle works without issue in Chrome 60.
Bug is present in this release (I assume it is also present in 56 and 57).
OS: Unspecified → Linux
Hardware: Unspecified → x86_64
Version: 55 Branch → 57 Branch
Fixing status to include 56 and 57.
Unless this is a very widespread problem we are unlikely to fix this for 55.
At least on windows, the hang is reproduced since Firefox 14. So, this seems the implementation level problem.
OS: Linux → All
Priority: -- → P3
This is not a major bug and the work-around is to issue a takeRecords()` after making changes to the observed attribute within the call-back function. This clears the event queue and prevents the recursion I believe.` I posted this bug so you are aware of the issue and also anything that can consistently crash or hang a process is a potential security risk in my experience.
(In reply to Ryan Jentzsch from comment #5) > This is not a major bug and the work-around is to issue a takeRecords()` > after making changes to the observed attribute within the call-back > function. This clears the event queue and prevents the recursion I believe.` > I posted this bug so you are aware of the issue and also anything that can > consistently crash or hang a process is a potential security risk in my > experience. Thanks for the report. The workaround suggests that this is an issue with MutationObserver and not CSS. Moving to get the right folks looking into it.
Component: DOM: CSS Object Model → DOM: Core & HTML
Chrome has had issues with dealing with nested mutations, for example https://bugs.chromium.org/p/chromium/issues/detail?id=634005
Hmm, but why is there any attribute change when one resizes textarea.
Aha, style attribute is modified both in Chrome an Firefox. And that is supposed to change the attribute https://drafts.csswg.org/cssom/#the-elementcssinlinestyle-interface But I guess the question is that whether calling target.style.backgroundColor ="blue"; when the background color is already blue is supposed to trigger attribute change.
Component: DOM: Core & HTML → CSS Parsing and Computation
Flags: needinfo?(dbaron)
(In reply to Olli Pettay [:smaug] from comment #9) > Aha, style attribute is modified both in Chrome an Firefox. > And that is supposed to change the attribute > https://drafts.csswg.org/cssom/#the-elementcssinlinestyle-interface > > But I guess the question is that whether calling > target.style.backgroundColor ="blue"; when the background color is already > blue is supposed to trigger attribute change. Yes. The example fiddle is intentionally bad programming practice and a second work-around for this issue is to check if the style attribute needs to be modified: if (target.style.background.color !== "blue") {target.style.background.color="blue"};
Old bug, sounds minor, setting status to fix-optional and not tracking.
(In reply to Julien Cristau [:jcristau] from comment #11) > Old bug, sounds minor, setting status to fix-optional and not tracking. I'm going to repeat this (not that I think that this is always so or present in this case). However, in my experience any code that can consistently hang or crash a process carries with it a potential security exploit. Although an old bug it may potentially carry a security risk (once again not that I have found one in this case. Just stating from my experience).
I can't reproduce using the testcase from comment 0 as of bug 1473180 landing. Hey Ryan, did bug 1473180 totally fix the issue here, or is there a variation of the test case that will still hang?
Flags: needinfo?(ryan.jentzsch)
See Also: → 1473180
(In reply to Mike Conley (:mconley) (:⚙️) from comment #13) > I can't reproduce using the testcase from comment 0 as of bug 1473180 > landing. > To be clear, bug 1473180 landed in Nightly only 25 days ago, so to test variations, you'll need to use Firefox Nightly.
This should have been fixed by the combination of the two bugs mentioned in depends on.
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Depends on: 1428246, 1473180
Flags: needinfo?(ryan.jentzsch)
Flags: needinfo?(dbaron)
Resolution: --- → FIXED
(In reply to Mike Conley (:mconley) (:⚙️) from comment #13) > I can't reproduce using the testcase from comment 0 as of bug 1473180 > landing. > > Hey Ryan, did bug 1473180 totally fix the issue here, or is there a > variation of the test case that will still hang? I'm not able to test. My version of FF is 62.0b16 (64-bit). If the fiddle I provided doesn't hang then yes the bug is fixed.
Target Milestone: --- → mozilla63
Flags: qe-verify+
Managed to reproduce the issue on 62.0.2. Verified with 63.0b9 and 64.0a1 (2018-09-27) on Windows 10, MacOS 10.9, Ubuntu 16.04 and did not encounter any issue after the resize (no hang/freezes).
Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.