<?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>26568</bug_id>
          
          <creation_ts>2014-08-13 10:55:28 +0000</creation_ts>
          <short_desc>Nothing stopping mis-nested fullscreen in iframes?</short_desc>
          <delta_ts>2014-08-15 11:40:15 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>Fullscreen</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</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="Philip Jägenstedt">philipj</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>mike</cc>
    
    <cc>public-webapps</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>110126</commentid>
    <comment_count>0</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-08-13 10:55:28 +0000</bug_when>
    <thetext>Let&apos;s say we have two sibling iframes, iframe1 and iframe2, and that they&apos;re same-origin. First enter fullscreen with an element inside iframe1. Then request fullscreen for an element inside iframe2. Since iframe2&apos;s document&apos;s fullscreen element stack is empty, it seems like nothing&apos;s stopping it from going fullscreen.

You will end up with a cross-document set of fullscreen elements that isn&apos;t a simple chain, but a tree, which seems weird. Some check on ancestor browsing contexts is probably needed in the fullscreen element ready check.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>110128</commentid>
    <comment_count>1</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-08-13 11:34:31 +0000</bug_when>
    <thetext>Additional bullet point:

&lt;li&gt;&lt;p&gt;If /element/ has a browser context container and /element/&apos;s browser context container&apos;s node document&apos;s fullscreen element stack is non-empty, /element/&apos;s browser context container&apos;s node document&apos;s fullscreen element stack top element is /element/&apos;s browser context container.
&lt;!-- cross-process --&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>110130</commentid>
    <comment_count>2</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-08-13 11:54:10 +0000</bug_when>
    <thetext>It also has do deal with nested iframes, so you&apos;d have consider all ancestor browsing contexts. Also, if the element in question isn&apos;t an iframe itself, does it make sense to say &quot;If /element/ has a browser context container&quot; or does it have to be something like &quot;If /element/&apos;s node documents&apos;s something or another&quot;?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>110136</commentid>
    <comment_count>3</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-08-13 13:26:32 +0000</bug_when>
    <thetext>For any /element/&apos;s ancestor browsing context&apos;s document with a non-empty fullscreen element stack the top element of that fullscreen element stack is the ancestor browsing context&apos;s nested browsing context&apos;s browsing context container.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>110141</commentid>
    <comment_count>4</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-08-13 15:40:52 +0000</bug_when>
    <thetext>I just meant that you may need to traverse up several nested document before getting to a document with a non-empty fullscreen element stack. When you get there, basically the fullscreen element ready check should hold true for the iframe that&apos;s going to be push to the stack later.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>110143</commentid>
    <comment_count>5</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-08-13 15:59:26 +0000</bug_when>
    <thetext>I&apos;ll just keep trying. Sorry :-(

&lt;li&gt;&lt;p&gt;If /element/&apos;s browsing context has a browser context container, the fullscreen element ready check returns true for /element/&apos;s browsing context&apos;s browser context container.
&lt;!-- cross-process, recursive --&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>110157</commentid>
    <comment_count>6</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-08-13 19:51:07 +0000</bug_when>
    <thetext>Yeah, that looks promising. A case I forgot about is when the relevant iframe element is already fullscreen, in which case the element ready check would fail, but that iframe&apos;s document&apos;s fullscreen element stack isn&apos;t supposed to change.

So I guess one should walk the ancestor iframes, doing the ready check for them, and stop at the first one (if any) that&apos;s at the top of its document&apos;s fullscreen element stack?

This stuff is complicated :(</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>110172</commentid>
    <comment_count>7</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-08-14 09:14:52 +0000</bug_when>
    <thetext>So how about I make step 9.3, step 9.2 (seems to be required anyway). And then I change ancestor in &quot;element&apos;s node document&apos;s fullscreen element stack is either empty or its top element is an ancestor of element&quot; to inclusive ancestor. In addition to adding the point from comment 5.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>110173</commentid>
    <comment_count>8</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-08-14 09:52:24 +0000</bug_when>
    <thetext>What does &quot;make step 9.3, step 9.2&quot; mean? It might be easier if you just make a spec change and I can review that :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>110174</commentid>
    <comment_count>9</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-08-14 10:00:37 +0000</bug_when>
    <thetext>https://github.com/whatwg/fullscreen/commit/742c24c03407688bd2de60d012409d6c8b7f6051</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>110176</commentid>
    <comment_count>10</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-08-14 11:51:53 +0000</bug_when>
    <thetext>I&apos;ve tried implementing the change and it looks good.

A test regression caused by this is when requesting fullscreen twice on the same element. Previously it would fire a fullscreenerror event, now it does nothing, so anyone waiting for an event will wait forever. I&apos;m not sure if it&apos;s a real-world problem, but it would be nice if a call to requestFullscreen() always resulted in an event.

Nit: Can an element have a browsing context? Everywhere else in the spec it&apos;s documents which have them, and that&apos;s also where I have to get it from in Blink.

Nit 2: Rephrase the last point to something that always evaluates to true or false, as opposed to an if with no else branch?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>110186</commentid>
    <comment_count>11</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-08-14 15:05:01 +0000</bug_when>
    <thetext>I think this might actually be nicer. This way only state changes or failure to make state changes trigger events. But if you wanted fullscreen and you already are, there&apos;s no need to do anything.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>110187</commentid>
    <comment_count>12</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-08-14 15:12:47 +0000</bug_when>
    <thetext>https://github.com/whatwg/fullscreen/commit/d1b6a381a37354b65f63d81692dd7a15ba512732</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>110198</commentid>
    <comment_count>13</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-08-14 21:18:04 +0000</bug_when>
    <thetext>(In reply to Anne from comment #11)
&gt; I think this might actually be nicer. This way only state changes or failure
&gt; to make state changes trigger events. But if you wanted fullscreen and you
&gt; already are, there&apos;s no need to do anything.

OK, let&apos;s try doing it this way, it&apos;s likely this edge case doesn&apos;t matter for site compat.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>110199</commentid>
    <comment_count>14</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-08-14 21:27:43 +0000</bug_when>
    <thetext>(In reply to Anne from comment #12)
&gt; https://github.com/whatwg/fullscreen/commit/
&gt; d1b6a381a37354b65f63d81692dd7a15ba512732

The oldNode rewrite has a problem: In &quot;Otherwise, remove element from its node document&apos;s fullscreen element stack&quot; the element may not be in the fullscreen element stack at all, need to make it conditional.

The fullscreen element ready check fix looks pedantically correct :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>110200</commentid>
    <comment_count>15</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-08-14 21:40:17 +0000</bug_when>
    <thetext>(In reply to Philip Jägenstedt from comment #14)
&gt; (In reply to Anne from comment #12)
&gt; &gt; https://github.com/whatwg/fullscreen/commit/
&gt; &gt; d1b6a381a37354b65f63d81692dd7a15ba512732
&gt; 
&gt; The oldNode rewrite has a problem: In &quot;Otherwise, remove element from its
&gt; node document&apos;s fullscreen element stack&quot; the element may not be in the
&gt; fullscreen element stack at all, need to make it conditional.

That step also still says /element/ instead of /oldNode/.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>110209</commentid>
    <comment_count>16</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-08-15 09:41:10 +0000</bug_when>
    <thetext>https://github.com/whatwg/fullscreen/commit/1fe479e54d3fb162127f6d86dce51fa6e5caf8cc

Thanks!

New issue, new bug?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>110211</commentid>
    <comment_count>17</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-08-15 11:40:15 +0000</bug_when>
    <thetext>Great, I have nothing further, will try to implement and report any issues.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>