Firefox’s decline has been in progress for a long time, starting when Google deployed billions of dollars of Chrome ads and pushing users of Gmail, YouTube, etc. to switch, and as people moved onto mobile devices where Firefox couldn’t run (iOS) or was at a disadvantage competing with the OS developer (everything else). Don’t forget things like the video wars where Google made a promise to drop H.264 support in the name of openness, let Firefox suffer the compatibility hit, and then retracted that promise.
Mozilla has made some bad decisions but we should acknowledge that a fair fraction of them were also flailing around trying to recover from those competitors’ actions. I don’t think Firefox OS would have happened if, for example, iOS allowed a real browser market.