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

已查看 583 次
跳至第一个未读帖子

Avi Drissman

未读,
2018年5月18日 下午4:41:002018/5/18
收件人 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

未读,
2018年5月18日 下午4:45:232018/5/18
收件人 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

未读,
2018年5月18日 下午5:55:242018/5/18
收件人 blink-dev

oj...@google.com

未读,
2018年5月18日 下午7:16:482018/5/18
收件人 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

未读,
2018年5月19日 上午1:13:552018/5/19
收件人 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

未读,
2018年5月19日 下午12:38:142018/5/19
收件人 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

未读,
2018年5月20日 上午9:33:152018/5/20
收件人 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

未读,
2018年5月21日 上午4:50:052018/5/21
收件人 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

未读,
2018年5月21日 上午6:21:212018/5/21
收件人 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

未读,
2018年5月21日 上午6:34:172018/5/21
收件人 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

未读,
2018年5月21日 下午12:06:402018/5/21
收件人 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

未读,
2018年5月21日 下午3:34:122018/5/21
收件人 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

未读,
2018年5月22日 上午5:53:222018/5/22
收件人 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

未读,
2018年5月22日 上午11:02:452018/5/22
收件人 Philip Jägenstedt、Mike West、blink-dev
Sure.

Rick Byers

未读,
2018年5月24日 下午12:43:252018/5/24
收件人 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

未读,
2018年10月31日 下午4:27:112018/10/31
收件人 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

未读,
2018年10月31日 下午4:39:062018/10/31
收件人 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

未读,
2018年10月31日 下午4:43:212018/10/31
收件人 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

未读,
2018年10月31日 下午5:42:342018/10/31
收件人 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

未读,
2018年10月31日 下午8:35:352018/10/31
收件人 Yoav Weiss、Avi Drissman、Philip Jägenstedt、Rick Byers、Mike West、blin...@chromium.org
LGTM3.




--
TAMURA Kent
Software Engineer, Google


Avi Drissman

未读,
2019年3月5日 下午4:02:142019/3/5
收件人 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

未读,
2020年4月3日 上午2:00:562020/4/3
收件人 blink-dev


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

harak...@gmail.com

未读,
2020年4月3日 上午2:00:572020/4/3
收件人 blink-dev


2018년 5월 19일 토요일 오전 5시 41분 0초 UTC+9, Avi Drissman 님의 말:
Contact emails
回复全部
回复作者
转发
0 个新帖子