And how would you prevent this sort of thing in a way that won't interfere with legit Javascript apps or be easily defeated? If it were that easy we'd have it as an extension or core feature by now. Instead we have things like uMatrix that generally work but are really fiddly.
Firefox definitely has its downsides. It gradually eats RAM until it gets too slow to use and needs to be restarted. That's why I use Chromium for most browsing - its memory leaks are mostly per tab-process and reset when you close a tab. I keep it around for things like YouTube where Chromium and its extensions can't block obnoxious ads. And on Android Firefox wins hands-down since Chrome/ium have no extension support, very basic options, and even no way to back out of a site that pollutes your history to trap you.
Of course I long for the Firefox 2.x days, where you could browse with fifty tabs on a Pentium 4 with half a gig of RAM and not have problems until XP ran out of window handles. But that wasn't the same stupidly Javascript-heavy web we have today, where a single page load couldn't fit on a floppy and basic news sites pull shenanigans to defeat no-autoplay settings and make an unwanted streaming video follow you down the page while you attempt to read.