FWIW, every time a browser pops up a modal that I find suspicious, I use a task manager or an OS shell to kill the process. If I have lost faith in anything a program has rendered to the screen, I no longer trust any of the program's own ways -- including the topmost 'x' -- of making the modal cleanly go away without triggering an action I didn't want to approve of.
The essay 'The Line of Death' [1] talks about users' trust placed into UI elements, and the implications thereof.
I think Safari has actually made some good improvements here. It now renders all JS-initiated alerts with a different chrome app fully within the page’s frame with a different UI than what’s used elsewhere on the system.
The essay 'The Line of Death' [1] talks about users' trust placed into UI elements, and the implications thereof.
[1] https://textslashplain.com/2017/01/14/the-line-of-death/