This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 22318 - Should window.close() be affected by sandboxing restrictions.
Summary: Should window.close() be affected by sandboxing restrictions.
Status: RESOLVED INVALID
Alias: None
Product: HTML WG
Classification: Unclassified
Component: HTML5 spec (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: This bug has no owner yet - up for the taking
QA Contact: HTML WG Bugzilla archive list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-10 18:02 UTC by Bob Owen
Modified: 2013-06-10 18:09 UTC (History)
3 users (show)

See Also:


Attachments
Test window.close() from sandbox - closeTestOpener.html starts the test. (1.26 KB, application/x-zip-compressed)
2013-06-10 18:02 UTC, Bob Owen
Details

Description Bob Owen 2013-06-10 18:02:36 UTC
Created attachment 1370 [details]
Test window.close() from sandbox - closeTestOpener.html starts the test.

As part of discussions on bug 20939, I've been asked to raise this bug.
The purpose is to look at whether window.close() should be affected by sandboxing rules.

In the specification at http://www.w3.org/html/wg/drafts/html/master/browsers.html#dom-window-close, it states:

"The close() method on Window objects should, if the corresponding browsing context A is script-closable and the browsing context of the script that invokes the method is allowed to navigate the browsing context A, close the browsing context A."

The "allowed to navigate" rules at http://www.w3.org/html/wg/drafts/html/master/browsers.html#allowed-to-navigate, don't include the sandboxing rules, but sandboxing could actually affect whether navigation takes place.
So the question is, if navigation of a browsing context is blocked by sandboxing rules, should window.close() also be blocked.

I believe it should, as (for example) it seems wrong that a sandboxed browsing context is not allowed to navigate top, but is allowed to close it.

I did a quick test to see what happens in a sandbox with allow-scripts, but not allow-top-navigation.
closeTestOpener.html starts the test.
(This test was done in early May, I'm sorry I don't have the versions that were used.)

Firefox, IE10, Chrome and Opera all seem to block the direct navigation of top with window.open(..., "_top").

Only Chrome stops the window.top.close().  It gives the same error as for the navigation, which complains that you are trying to navigate top without allow-top-navigation.

As I have said, Chrome's behaviour seems correct to me.

Thanks,
Bob
Comment 1 Bob Owen 2013-06-10 18:09:29 UTC
Sorry, raised against wrong product.