Skip to content
Permalink
Browse files

[giow] (3) Better define window.close() and how to close tabs.

Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=17631
Affected topics: DOM APIs, HTML

git-svn-id: http://svn.whatwg.org/webapps@7393 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information...
Hixie committed Sep 23, 2012
1 parent ce5f496 commit 98cd5df7db72012cfdcd54a73e6c762865ed60f5
Showing with 107 additions and 25 deletions.
  1. +35 −9 complete.html
  2. +35 −9 index
  3. +37 −7 source
<li><a href=#accessing-other-browsing-contexts><span class=secno>6.2.3 </span>Accessing other browsing contexts</a></li>
<li><a href=#named-access-on-the-window-object><span class=secno>6.2.4 </span>Named access on the <code>Window</code> object</a></li>
<li><a href=#garbage-collection-and-browsing-contexts><span class=secno>6.2.5 </span>Garbage collection and browsing contexts</a></li>
<li><a href=#browser-interface-elements><span class=secno>6.2.6 </span>Browser interface elements</a></li>
<li><a href=#the-windowproxy-object><span class=secno>6.2.7 </span>The <code>WindowProxy</code> object</a></ol></li>
<li><a href=#closing-browsing-contexts><span class=secno>6.2.6 </span>Closing browsing contexts</a></li>
<li><a href=#browser-interface-elements><span class=secno>6.2.7 </span>Browser interface elements</a></li>
<li><a href=#the-windowproxy-object><span class=secno>6.2.8 </span>The <code>WindowProxy</code> object</a></ol></li>
<li><a href=#origin-0><span class=secno>6.3 </span>Origin</a>
<ol>
<li><a href=#relaxing-the-same-origin-restriction><span class=secno>6.3.1 </span>Relaxing the same-origin restriction</a></ol></li>
<hr><p>The <dfn id=dom-window-close title=dom-window-close><code>close()</code></dfn>
method on <code><a href=#window>Window</a></code> objects should, if the corresponding
<a href=#browsing-context>browsing context</a> <var title="">A</var> is
<a href=#script-closable>script-closable</a> and the <a href="#script's-browsing-context" title="script's
browsing context">browsing context</a> of the <a href=#concept-script title=concept-script>script</a> that invokes the method is
<a href=#script-closable>script-closable</a> and the <a href="#script's-browsing-context" title="script's browsing
context">browsing context</a> of the <a href=#concept-script title=concept-script>script</a> that invokes the method is
<a href=#allowed-to-navigate>allowed to navigate</a> the <a href=#browsing-context>browsing context</a>
<var title="">A</var>, close the <a href=#browsing-context>browsing context</a> <var title="">A</var> (and may <a href=#a-browsing-context-is-discarded title="a browsing context is
discarded">discard</a> it too).</p>
<var title="">A</var>, <a href=#close-a-browsing-context title="close a browsing
context">close</a> the <a href=#browsing-context>browsing context</a> <var title="">A</var>.</p>

<p>A <a href=#browsing-context>browsing context</a> is <dfn id=script-closable>script-closable</dfn> if
it is an <a href=#auxiliary-browsing-context>auxiliary browsing context</a> that was created by
<p>User agents may <a href=#a-browsing-context-is-discarded title="a browsing context is
discarded">discard</a> <a href=#top-level-browsing-context title="top-level browsing
context">top-level browsing contexts</a> at any time (typically,
in response to user requests, e.g. when a user closes a window
in response to user requests, e.g. when a user force-closes a window
containing one or more <a href=#top-level-browsing-context title="top-level browsing
context">top-level browsing contexts</a>). Other <a href=#browsing-context title="browsing context">browsing contexts</a> must be discarded
once their <code><a href=#windowproxy>WindowProxy</a></code> object is eligible for garbage
</div>


<h4 id=closing-browsing-contexts><span class=secno>6.2.6 </span>Closing browsing contexts</h4>

<h4 id=browser-interface-elements><span class=secno>6.2.6 </span>Browser interface elements</h4>
<p>When the user agent is required to <dfn id=close-a-browsing-context>close a browsing context</dfn>, it must run the
following steps:</p>

<ol><li><p>Let <var title="">specified browsing context</var> be the <a href=#browsing-context>browsing context</a>
being closed.</li>

<li><p><a href=#prompt-to-unload-a-document title="prompt to unload a document">Prompt to unload</a> the <a href=#active-document>active
document</a> of the <var title="">specified browsing context</var>. If the user <a href=#refused-to-allow-the-document-to-be-unloaded>refused
to allow the document to be unloaded</a>, then abort these steps.</li>

<li><p><a href=#unload-a-document title="unload a document">Unload</a> the <a href=#active-document>active document</a> of the <var title="">specified browsing context</var> with the <var title="">recycle</var> parameter set to
false.</li>

<li><p>Remove the <var title="">specified browsing context</var> from the user interface (e.g.
close or hide its tab in a tabbed browser).</li>

<li><p><a href=#a-browsing-context-is-discarded title="a browsing context is discarded">Discard</a> the <var title="">specified
browsing context</var>.</li>

</ol><p>User agents should offer users the ability to arbitrarily <a href=#close-a-browsing-context title="close a browsing
context">close</a> any <a href=#top-level-browsing-context>top-level browsing context</a>.</p>



<h4 id=browser-interface-elements><span class=secno>6.2.7 </span>Browser interface elements</h4>

<p>To allow Web pages to integrate with Web browsers, certain Web
browser interface elements are exposed in a limited way to scripts

<div class=impl>

<h4 id=the-windowproxy-object><span class=secno>6.2.7 </span>The <code><a href=#windowproxy>WindowProxy</a></code> object</h4>
<h4 id=the-windowproxy-object><span class=secno>6.2.8 </span>The <code><a href=#windowproxy>WindowProxy</a></code> object</h4>


<p>As mentioned earlier, each <a href=#browsing-context>browsing context</a> has a
44 index
<li><a href=#accessing-other-browsing-contexts><span class=secno>6.2.3 </span>Accessing other browsing contexts</a></li>
<li><a href=#named-access-on-the-window-object><span class=secno>6.2.4 </span>Named access on the <code>Window</code> object</a></li>
<li><a href=#garbage-collection-and-browsing-contexts><span class=secno>6.2.5 </span>Garbage collection and browsing contexts</a></li>
<li><a href=#browser-interface-elements><span class=secno>6.2.6 </span>Browser interface elements</a></li>
<li><a href=#the-windowproxy-object><span class=secno>6.2.7 </span>The <code>WindowProxy</code> object</a></ol></li>
<li><a href=#closing-browsing-contexts><span class=secno>6.2.6 </span>Closing browsing contexts</a></li>
<li><a href=#browser-interface-elements><span class=secno>6.2.7 </span>Browser interface elements</a></li>
<li><a href=#the-windowproxy-object><span class=secno>6.2.8 </span>The <code>WindowProxy</code> object</a></ol></li>
<li><a href=#origin-0><span class=secno>6.3 </span>Origin</a>
<ol>
<li><a href=#relaxing-the-same-origin-restriction><span class=secno>6.3.1 </span>Relaxing the same-origin restriction</a></ol></li>
<hr><p>The <dfn id=dom-window-close title=dom-window-close><code>close()</code></dfn>
method on <code><a href=#window>Window</a></code> objects should, if the corresponding
<a href=#browsing-context>browsing context</a> <var title="">A</var> is
<a href=#script-closable>script-closable</a> and the <a href="#script's-browsing-context" title="script's
browsing context">browsing context</a> of the <a href=#concept-script title=concept-script>script</a> that invokes the method is
<a href=#script-closable>script-closable</a> and the <a href="#script's-browsing-context" title="script's browsing
context">browsing context</a> of the <a href=#concept-script title=concept-script>script</a> that invokes the method is
<a href=#allowed-to-navigate>allowed to navigate</a> the <a href=#browsing-context>browsing context</a>
<var title="">A</var>, close the <a href=#browsing-context>browsing context</a> <var title="">A</var> (and may <a href=#a-browsing-context-is-discarded title="a browsing context is
discarded">discard</a> it too).</p>
<var title="">A</var>, <a href=#close-a-browsing-context title="close a browsing
context">close</a> the <a href=#browsing-context>browsing context</a> <var title="">A</var>.</p>

<p>A <a href=#browsing-context>browsing context</a> is <dfn id=script-closable>script-closable</dfn> if
it is an <a href=#auxiliary-browsing-context>auxiliary browsing context</a> that was created by
<p>User agents may <a href=#a-browsing-context-is-discarded title="a browsing context is
discarded">discard</a> <a href=#top-level-browsing-context title="top-level browsing
context">top-level browsing contexts</a> at any time (typically,
in response to user requests, e.g. when a user closes a window
in response to user requests, e.g. when a user force-closes a window
containing one or more <a href=#top-level-browsing-context title="top-level browsing
context">top-level browsing contexts</a>). Other <a href=#browsing-context title="browsing context">browsing contexts</a> must be discarded
once their <code><a href=#windowproxy>WindowProxy</a></code> object is eligible for garbage
</div>


<h4 id=closing-browsing-contexts><span class=secno>6.2.6 </span>Closing browsing contexts</h4>

<h4 id=browser-interface-elements><span class=secno>6.2.6 </span>Browser interface elements</h4>
<p>When the user agent is required to <dfn id=close-a-browsing-context>close a browsing context</dfn>, it must run the
following steps:</p>

<ol><li><p>Let <var title="">specified browsing context</var> be the <a href=#browsing-context>browsing context</a>
being closed.</li>

<li><p><a href=#prompt-to-unload-a-document title="prompt to unload a document">Prompt to unload</a> the <a href=#active-document>active
document</a> of the <var title="">specified browsing context</var>. If the user <a href=#refused-to-allow-the-document-to-be-unloaded>refused
to allow the document to be unloaded</a>, then abort these steps.</li>

<li><p><a href=#unload-a-document title="unload a document">Unload</a> the <a href=#active-document>active document</a> of the <var title="">specified browsing context</var> with the <var title="">recycle</var> parameter set to
false.</li>

<li><p>Remove the <var title="">specified browsing context</var> from the user interface (e.g.
close or hide its tab in a tabbed browser).</li>

<li><p><a href=#a-browsing-context-is-discarded title="a browsing context is discarded">Discard</a> the <var title="">specified
browsing context</var>.</li>

</ol><p>User agents should offer users the ability to arbitrarily <a href=#close-a-browsing-context title="close a browsing
context">close</a> any <a href=#top-level-browsing-context>top-level browsing context</a>.</p>



<h4 id=browser-interface-elements><span class=secno>6.2.7 </span>Browser interface elements</h4>

<p>To allow Web pages to integrate with Web browsers, certain Web
browser interface elements are exposed in a limited way to scripts

<div class=impl>

<h4 id=the-windowproxy-object><span class=secno>6.2.7 </span>The <code><a href=#windowproxy>WindowProxy</a></code> object</h4>
<h4 id=the-windowproxy-object><span class=secno>6.2.8 </span>The <code><a href=#windowproxy>WindowProxy</a></code> object</h4>


<p>As mentioned earlier, each <a href=#browsing-context>browsing context</a> has a
44 source
@@ -1,4 +1,4 @@
<!-- EDITOR NOTES
<!-- EDITOR NOTES -*- mode: Text; fill-column: 100 -*-
!
! Adding a new element involves editing the following sections:
! - section for the element itself
<p>The <dfn title="dom-window-close"><code>close()</code></dfn>
method on <code>Window</code> objects should, if the corresponding
<span>browsing context</span> <var title="">A</var> is
<span>script-closable</span> and the <span title="script's
browsing context">browsing context</span> of the <span
<span>script-closable</span> and the <span title="script's browsing
context">browsing context</span> of the <span
title="concept-script">script</span> that invokes the method is
<span>allowed to navigate</span> the <span>browsing context</span>
<var title="">A</var>, close the <span>browsing context</span> <var
title="">A</var> (and may <span title="a browsing context is
discarded">discard</span> it too).</p>
<var title="">A</var>, <span title="close a browsing
context">close</span> the <span>browsing context</span> <var
title="">A</var>.</p>

<p>A <span>browsing context</span> is <dfn>script-closable</dfn> if
it is an <span>auxiliary browsing context</span> that was created by
<p>User agents may <span title="a browsing context is
discarded">discard</span> <span title="top-level browsing
context">top-level browsing contexts</span> at any time (typically,
in response to user requests, e.g. when a user closes a window
in response to user requests, e.g. when a user force-closes a window
containing one or more <span title="top-level browsing
context">top-level browsing contexts</span>). Other <span
title="browsing context">browsing contexts</span> must be discarded
</div>


<h4>Closing browsing contexts</h4>

<p>When the user agent is required to <dfn>close a browsing context</dfn>, it must run the
following steps:</p>

<ol>

<li><p>Let <var title="">specified browsing context</var> be the <span>browsing context</span>
being closed.</p></li>

<li><p><span title="prompt to unload a document">Prompt to unload</span> the <span>active
document</span> of the <var title="">specified browsing context</var>. If the user <span>refused
to allow the document to be unloaded</span>, then abort these steps.</p></li>

<li><p><span title="unload a document">Unload</span> the <span>active document</span> of the <var
title="">specified browsing context</var> with the <var title="">recycle</var> parameter set to
false.</p></li>

<li><p>Remove the <var title="">specified browsing context</var> from the user interface (e.g.
close or hide its tab in a tabbed browser).</p></li>

<li><p><span title="a browsing context is discarded">Discard</span> the <var title="">specified
browsing context</var>.</p></li>

</ol>

<p>User agents should offer users the ability to arbitrarily <span title="close a browsing
context">close</span> any <span>top-level browsing context</span>.</p>



<h4>Browser interface elements</h4>

0 comments on commit 98cd5df

Please sign in to comment.
You can’t perform that action at this time.