-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Consider this testcase: Page A opens a same-origin page B in a new window/tab, page B runs the following code:
(function f() { ++opener.counter; return Promise.resolve().then(f) })()
then the user gets sick of the proceedings closes the window/tab B is in.
What should happen?
Per current spec, the answer is "User can never interact with A again, because that promise loop never terminates". This is in fact what Chrome implements, until it crashes on OOM. Same for Safari. This is obviously somewhat user-hostile; users expect that when they close a page it gets closed.
Firefox seems to show a "would you like to stop this script?" dialog after some time, independently of whether the window/tab is closed or not.
What should the spec require here?
Also, what should happen to attempts to do such promise loops on already-closed or navigated-away-from pages? What should happen on navigation attempts in the middle of a loop like the one above? Can those even happen?
Some relevant reading:
https://bugzilla.mozilla.org/show_bug.cgi?id=1058695
https://bugzilla.mozilla.org/show_bug.cgi?id=1165237
https://bugzilla.mozilla.org/show_bug.cgi?id=1124322