Bug 23634
| Summary: | Synchronize window.close() policy with HTML 5 | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Adam Barth <abarth> |
| Component: | DOM | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW | ||
| Severity: | Normal | CC: | abarth, ahmad.saleem792, ap, beidson, bfulgham, dbates, rniwa, sam, skylined, webkit-bug-importer, woodlxf00 |
| Priority: | P2 | Keywords: | InRadar |
| Version: | 528+ (Nightly build) | ||
| Hardware: | All | ||
| OS: | All | ||
Adam Barth
Spun off from Bug 20661. We should match HTML5's policy for window.close():
"The close() method on Window objects should, if the corresponding browsing context A is an auxiliary browsing context that was created by a script (as opposed to by an action of the user), and if the browsing context of the script that invokes the method is allowed to navigate the browsing context A, close the browsing context A (and may discard it too)."
http://www.whatwg.org/specs/web-apps/current-work/#dom-window-close
Here is Firefox's implementation:
http://mxr.mozilla.org/mozilla-central/source/dom/src/base/nsGlobalWindow.cpp#5348
Here is our implementation:
http://trac.webkit.org/browser/trunk/WebCore/page/DOMWindow.cpp#L447
The main goofy thing we do is that we allow window.close() if
|| m_frame->loader()->getHistoryLength() <= 1
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Ahmad Saleem
It seems that it was updated in this commit:
https://github.com/WebKit/WebKit/commit/ad05b3b957d598dd2fc12542d6f93c6b3dca046f#diff-a906690109f28a0283c513d9f09976d4bf6f53b99569113eb2fda779cff23b39R876
I don't know whether it have fixed the issue but we also pass tests in WPT:
https://wpt.fyi/results/html/browsers/the-window-object?label=master&label=experimental&aligned&view=subtest&q=window%20close
For close-method.window.html & closed-attribute.window.html and latter do cover - auxiliary browsing context:
closed/close() and cross-site auxiliary browsing context.
rniwa@webkit.org - Is this needed anymore? Thanks!
Ryosuke Niwa
I'm pretty sure this bug still exists.
Radar WebKit Bug Importer
<rdar://problem/98459982>
Woody Lee
Still cannot close tab via window.close in iPhone/iPad Safari 15.6/16.
It works well in MacOS Safari.
Woody Lee
#c4
Sorry for error information. It's another issue https://bugs.webkit.org/show_bug.cgi?id=245171