I am kind surprised that Firefox still doesn't not have it.
Chrome used to have this feature as a flag sometime ago and they have enabled by default years ago.
It was named "Frame busting requires same-origin".
It protects from:
1 doorways and similar stuff that are embedded, framed into another site. Example, I have recently visited a site that has a blogspot page embedded and that page had a doorway to adult content so when i visited a site that embedded broke top frame and redirected to an adult content site, was i happy to see it - nope.
2 Expired domains and bad configured sites. I have noticed that some expired domain landing pages are frame breakers and i when a site has third party content from expired domain then it also breaks a top frame.
I have not found any about:config option that fix this issue.
I can provide more examples if needed but lets start with this one:
Test it with Chrome and Firefox.