Defeat Feature for "Are you sure you want to leave" dialogues

I’d like to request a defeat feature similar to what can be found in contemporary Firefox versions.
When a page displays an “are you sure you want to leave” dialogue, clicking the “close tab” button a second time could close the tab without having to interact with the prompt. When such a dialogue is open, the user could be able to switch tabs, or close the browser as a whole.

While this is certainly a convenience feature, it’s also an important escape hatch mechanic for sites that use this browser feature maliciously, in excess, or in error.