Intent to Implement and Ship: Don't allow popups during page unload

663 مرّة مشاهدة
التخطي إلى أول رسالة غير مقروءة

Avi Drissman

غير مقروءة،
18‏/05‏/2018، 4:41:00 م18‏/5‏/2018
إلى blink-dev
Contact emails

Summary
A web page can use the window.open() API to create popups or tabs. This is a highly abusable feature, so we have a system in place called the "popup blocker" to put strict limits on the use of this API.

Motivation
I would like to remove the ability of a page to use the window.open() API during page unload, whether or not the popup blocker is enabled. This would simplify browser shutdown and improve our ability to make it correct.

This is mostly already prohibited by the popup blocker which is enabled by default; as such it is minimally web-visible.

Implementation

Interoperability and Compatibility
Edge: No Signals
Firefox: No Signals
Safari: Shipped
Web developers: No Signals

Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?
Yes.

Is this feature fully tested by web-platform-tests?
No; can WPTs test opening windows/failure to open windows?

This is tested by Chromium's browser tests.

Link to entry on the feature dashboard

Ship bug

Requesting approval to ship?
Yes.

Charles Harrison

غير مقروءة،
18‏/05‏/2018، 4:45:23 م18‏/5‏/2018
إلى Avi Drissman،blink-dev
The tricky part of testing this via WPT will be evaluating success/failure after the unload handler is called on the page :)

For determining whether a window was opened, you should be able to just inspect the return value of `window.open`.

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CACWgwAYbX5Um36P2m3XCD_0bPvpm%2B5nX2%2BDwYPTU1GOo6k4pkA%40mail.gmail.com.

Avi Drissman

غير مقروءة،
18‏/05‏/2018، 5:55:24 م18‏/5‏/2018
إلى blink-dev

oj...@google.com

غير مقروءة،
18‏/05‏/2018، 7:16:48 م18‏/5‏/2018
إلى blink-dev
LGTM1

Is it hard to add a histogram or UseCounter while you're at it? That way if we get complaints of site breakage, we'll be able to reason about it and avoid rolling back.

Boris Zbarsky

غير مقروءة،
19‏/05‏/2018، 1:13:55 ص19‏/5‏/2018
إلى Avi Drissman،blink-dev
On 5/18/18 4:40 PM, Avi Drissman wrote:
> I would like to remove the ability of a page to use thewindow.open()API
> during page unload

Just to check, which page? The one that lives in "window" (relevant
global), the one the "open" method comes from (current global), the one
making the call (incumbent global) or something else?

What is the definition of "during page unload" being used here?

-Boris

Avi Drissman

غير مقروءة،
19‏/05‏/2018، 12:38:14 م19‏/5‏/2018
إلى Ojan Vafai،blink-dev
Apologies, this is a double post. Please post on the other thread.

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/7d5b1e13-8eba-4a14-b261-499bd610384b%40chromium.org.

Fernando Serboncini

غير مقروءة،
20‏/05‏/2018، 9:33:15 ص20‏/5‏/2018
إلى Boris Zbarsky،Avi Drissman،blink-dev
If this already happens with the popup blocker on, this change would prevent a site from creating a popup EVEN if the user has given explicit permission to allow popups from this site. Is this true? And if so, what's the reasoning behind this?


--
You received this message because you are subscribed to the Google Groups "blink-dev" group.

Philip Jägenstedt

غير مقروءة،
21‏/05‏/2018، 4:50:05 ص21‏/5‏/2018
إلى Fernando Serboncini،Boris Zbarsky،Avi Drissman،blink-dev
Avi, do you have a pointer to what Safari has shipped?

Since this is web exposed, should we change the spec to match what Safari already does and ship that? I think it's https://html.spec.whatwg.org/multipage/browsers.html#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name that needs to be tweaked here, by consulting some notion of "during page unload", which gets to Boris's question.

It ought to be possible to test this in WPT by window.open()ing another window which is tries to open a popup while being unloaded. If nothing else, the would-be-opened popup could postMessage something, and if that message isn't received the test passes.

PhistucK

غير مقروءة،
21‏/05‏/2018، 6:21:21 ص21‏/5‏/2018
إلى Philip Jägenstedt،Fernando Serboncini،Boris Zbarsky،Avi Drissman،blink-dev
But postMessage is asynchronous, if I remember correctly, so the window may close before it has a chance to receive a message? On the other hand, postMessage from the opener to the popup would be received by the popup if it is open and fail the test, if that is possible.

PhistucK


To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.

Philip Jägenstedt

غير مقروءة،
21‏/05‏/2018، 6:34:17 ص21‏/5‏/2018
إلى PhistucK،Fernando Serboncini،Boris Zbarsky،Avi Drissman،blink-dev
I mean that the window which shouldn't be opened posts a message, and if that message is received the test fails. This style of test a last resort, because it means that the pass condition is "nothing happened" after a timeout.

Avi Drissman

غير مقروءة،
21‏/05‏/2018، 12:06:40 م21‏/5‏/2018
إلى Philip Jägenstedt،fs...@google.com،bzba...@mit.edu،blink-dev
I don't have a pointer; this is based on experimentation with Safari on my machine.

mk...@chromium.org

غير مقروءة،
21‏/05‏/2018، 3:34:12 م21‏/5‏/2018
إلى blink-dev،a...@chromium.org
My understanding of Avi's proposal is that a page shouldn't be able to call `window.open()` from a `beforeunload` event. Skimming the spec, it seems reasonable to extend that "shouldn't" somewhat widely, perhaps altering the window open steps to exit early if the termination nesting level counter is anything other than 0. That seems marginally simpler than Philip's suggestion that we wait until we're choosing a browsing context (as I don't believe there's any vector other than `window.open()` for opening a new browsing context during `beforeunload`?).

That said, I do agree with Philip that it would be nice to specify the behavior, and add some tests to confirm it. It is certainly web visible in edge cases like opening and closing a same-origin window that opens a same-origin window during its `beforeunload`, then BroadcastChanneling and waiting for a lack of response. Not a great test, but a test.

If you put something like that together, and file a bug against HTML accordingly, LGTM2.

Thanks!

-mike

Philip Jägenstedt

غير مقروءة،
22‏/05‏/2018، 5:53:22 ص22‏/5‏/2018
إلى Mike West،blink-dev،Avi Drissman
Something like that SGTM too. Avi, would it be OK to put this intent on hold until the spec change is done and ready to be merged? Open spec issues, even with agreement, can get left sitting around forever, so I think it makes sense to default to making the spec changes up front.

Avi Drissman

غير مقروءة،
22‏/05‏/2018، 11:02:45 ص22‏/5‏/2018
إلى Philip Jägenstedt،Mike West،blink-dev
Sure.

Rick Byers

غير مقروءة،
24‏/05‏/2018، 12:43:25 م24‏/5‏/2018
إلى Avi Drissman،Philip Jägenstedt،Mike West،blink-dev
We discussed this in the API owners meeting today (Ojan, Yoav, Alex, Daniel, Rick).  We agree it's reasonable to require at least a concrete proposed spec/test change along the lines that Mike and Philip are asking for before approving this intent.  Like other interventions, we may not get agreement that the proposal should land prior to shipping it and collecting data on how it works in practice.

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.

Avi Drissman

غير مقروءة،
31‏/10‏/2018، 4:27:11 م31‏/10‏/2018
إلى Rick Byers،Philip Jägenstedt،Mike West،blin...@chromium.org
Coming back to this.

This landed as a spec change, so may I have approval to land our implementation of it? Pretty please? :)

Thank you,

Avi

Philip Jägenstedt

غير مقروءة،
31‏/10‏/2018، 4:39:06 م31‏/10‏/2018
إلى Avi Drissman،Rick Byers،Mike West،blin...@chromium.org
That makes it an an easy case, LGTM1 :)

Looking for the tests led me to https://chromium-review.googlesource.com/c/chromium/src/+/1180296/, so once this is landed the tests will be upstreamed to wpt too. Yay.

Avi Drissman

غير مقروءة،
31‏/10‏/2018، 4:43:21 م31‏/10‏/2018
إلى Philip Jägenstedt،Rick Byers،Mike West،blin...@chromium.org
Yes, this has WPT tests by request from this thread.

Your support is appreciated.

Avi

Yoav Weiss

غير مقروءة،
31‏/10‏/2018، 5:42:34 م31‏/10‏/2018
إلى Avi Drissman،Philip Jägenstedt،Rick Byers،Mike West،blin...@chromium.org
LGTM2

To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.

TAMURA, Kent

غير مقروءة،
31‏/10‏/2018، 8:35:35 م31‏/10‏/2018
إلى Yoav Weiss،Avi Drissman،Philip Jägenstedt،Rick Byers،Mike West،blin...@chromium.org
LGTM3.




--
TAMURA Kent
Software Engineer, Google


Avi Drissman

غير مقروءة،
05‏/03‏/2019، 4:02:14 م5‏/3‏/2019
إلى TAMURA, Kent،Yoav Weiss،Philip Jägenstedt،Rick Byers،Mike West،blink-dev
To follow up: this landed in 72, but it apparently caused breakage in some enterprise apps.

Therefore, this was reverted in 72 and 73, but is landing again in 74. There will be a policy flag in 74 to allow popups during page unload. That policy flag will be removed in 82, which will allow enterprises time to stop this practice.


Avi

harak...@gmail.com

غير مقروءة،
03‏/04‏/2020، 2:00:56 ص3‏/4‏/2020
إلى blink-dev


2018년 5월 19일 토요일 오전 5시 41분 0초 UTC+9, Avi Drissman 님의 말:

harak...@gmail.com

غير مقروءة،
03‏/04‏/2020، 2:00:57 ص3‏/4‏/2020
إلى blink-dev


2018년 5월 19일 토요일 오전 5시 41분 0초 UTC+9, Avi Drissman 님의 말:
Contact emails
الرد على الكل
رد على الكاتب
إعادة توجيه
0 رسالة جديدة