User Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36
Steps to reproduce:
Click a link with target="_blank".
Then, click a link with window.close() in the new window/tab.
These links are internal link. Not cross domain, but inside my site.
A warning "Scripts may not close windows that were not opened by script." occurs, and window.close() is blocked on Firefox 72.0a1 nightly.
window.close() should work, and shouldn't be blocked.
Chrome 78.0.3904.70 and Chrome Canary 80.0.3949.0 allow window.close() to close target="_blank" window. Firefox 70.0 also allows this.
However, Firefox 72.0a1 nightly only allows window.close() to close windows opened by window.open(), and not allows to close windows opened by target="_blank".
I understand that this behavior is due to this document:
But I think this is too strict.
I recommend that Firefox should allow window.close() to close not only windows that were opened by script, but also windows with target="_blank" that were opened by user's action.
These links are clicked by user's action, not by script.
Users intend to close the window by themselves, by clicking the window.close() link.
If such window.close() is blocked, users are confused.
So Firefox shouldn't block this window.close().
Firefox should allow window.close() to close windows that were opened by target="_blank" links, which are clicked by users themselves.
In fact, Chrome allows to close them.