Firefox's current problems go back to around 2011, and you can see this in the trend graphs.
At that time, there was still a hot three-way race between Chrome, Firefox, and IE. But Mozilla made a misstep: they decided that, to compete with Chrome, they would adopt a new "Rapid Release" model. This resulted in a massively pissed-off base of former supporters and articles like "Rapid-release Firefox meets corporate backlash" [1] and "Understanding the Corporate Impact" [2]. There were multiple discussions with titles like, "Mozilla Executive: We're Not Interested In Enterprise Level Users", and it was still going on a year later with, "Everybody Hates Firefox Updates" [3].
People have been conditioned now to accept frequent updates, and -- years later -- the browser vendors have mostly stopped reskinning their interface every other release. But that wasn't the situation at the time, and so Firefox gave up their one competitive advantage over Chrome, and leveled the playing field in Chrome's favor.
Mozilla could have instead embraced that big, loyal enterprise base, and found a sane middle road for updates that allowed them to keep a healthy release schedule for DOM, JS, and CSS support. But, they didn't.
So all of that good will that Mozilla had fostered over the years just evaporated, and Mozilla never looked back.
(It didn't help that, just after alienating their enterprise user base, Mozilla also kicked off some drama with a developer [5].)
This falls into that category of mistakes-that-kill-your-business-years-later, alongside other case studies like Sears and RadioShack.
[1]: https://www.cnet.com/news/rapid-release-firefox-meets-corpor...
[2]: https://mike.kaply.com/2011/06/23/understanding-the-corporat...
[3]: https://news.ycombinator.com/item?id=2692205
[4]: https://news.ycombinator.com/item?id=4209384
[5]: https://news.ycombinator.com/item?id=2741660