WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
23634
Synchronize window.close() policy with HTML 5
https://bugs.webkit.org/show_bug.cgi?id=23634
Summary
Synchronize window.close() policy with HTML 5
Adam Barth
Reported
2009-01-29 18:57:48 PST
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
Comment 1
2022-08-09 14:35:30 PDT
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
Comment 2
2022-08-10 00:07:50 PDT
I'm pretty sure this bug still exists.
Radar WebKit Bug Importer
Comment 3
2022-08-10 10:54:25 PDT
<
rdar://problem/98459982
>
Woody Lee
Comment 4
2022-09-14 01:18:30 PDT
Still cannot close tab via window.close in iPhone/iPad Safari 15.6/16. It works well in MacOS Safari.
Woody Lee
Comment 5
2022-09-14 01:42:04 PDT
#c4 Sorry for error information. It's another issue
https://bugs.webkit.org/show_bug.cgi?id=245171
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug