<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>22318</bug_id>
          
          <creation_ts>2013-06-10 18:02:36 +0000</creation_ts>
          <short_desc>Should window.close() be affected by sandboxing restrictions.</short_desc>
          <delta_ts>2013-06-10 18:09:29 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>HTML WG</product>
          <component>HTML5 spec</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Bob Owen">bobowencode</reporter>
          <assigned_to name="This bug has no owner yet - up for the taking">dave.null</assigned_to>
          <cc>mike</cc>
    
    <cc>public-html-admin</cc>
    
    <cc>public-html-wg-issue-tracking</cc>
          
          <qa_contact name="HTML WG Bugzilla archive list">public-html-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>89002</commentid>
    <comment_count>0</comment_count>
      <attachid>1370</attachid>
    <who name="Bob Owen">bobowencode</who>
    <bug_when>2013-06-10 18:02:36 +0000</bug_when>
    <thetext>Created attachment 1370
Test window.close() from sandbox - closeTestOpener.html starts the test.

As part of discussions on bug 20939, I&apos;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:

&quot;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.&quot;

The &quot;allowed to navigate&quot; rules at http://www.w3.org/html/wg/drafts/html/master/browsers.html#allowed-to-navigate, don&apos;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&apos;m sorry I don&apos;t have the versions that were used.)

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

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&apos;s behaviour seems correct to me.

Thanks,
Bob</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89003</commentid>
    <comment_count>1</comment_count>
    <who name="Bob Owen">bobowencode</who>
    <bug_when>2013-06-10 18:09:29 +0000</bug_when>
    <thetext>Sorry, raised against wrong product.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>1370</attachid>
            <date>2013-06-10 18:02:36 +0000</date>
            <delta_ts>2013-06-10 18:02:36 +0000</delta_ts>
            <desc>Test window.close() from sandbox - closeTestOpener.html starts the test.</desc>
            <filename>closeTest.zip</filename>
            <type>application/x-zip-compressed</type>
            <size>1286</size>
            <attacher name="Bob Owen">bobowencode</attacher>
            
              <data encoding="base64">UEsDBBQAAAAAAEyXykIAAAAAAAAAAAAAAAAKAAAAY2xvc2VUZXN0L1BLAwQUAAAACACilspCLdJX
GxABAABlAgAAHgAAAGNsb3NlVGVzdC9jbG9zZVRlc3RJZnJhbWUuaHRtbJ1SPU/DMBDdkfgPx02J
gGZFJekSKjHwNWRhQo7jNlYTO3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