<?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>24613</bug_id>
          
          <creation_ts>2014-02-10 21:04:42 +0000</creation_ts>
          <short_desc>Why wouldn&apos;t referrer for about:blank be based on the origin it inherits?</short_desc>
          <delta_ts>2015-09-17 08:21:57 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>HTML</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://www.w3.org/Bugs/Public/show_bug.cgi?id=26830</see_also>
          <bug_file_loc>http://www.whatwg.org/specs/web-apps/current-work/#processing-model</bug_file_loc>
          <status_whiteboard>blocked on dependencies</status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          <dependson>24080</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter>contributor</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>adrianba</cc>
    
    <cc>annevk</cc>
    
    <cc>bzbarsky</cc>
    
    <cc>descartavel1</cc>
    
    <cc>eisinger</cc>
    
    <cc>ian</cc>
    
    <cc>james</cc>
    
    <cc>jonas</cc>
    
    <cc>mike</cc>
    
    <cc>mkwst</cc>
    
    <cc>travil</cc>
    
    <cc>w3c</cc>
    
    <cc>zcorpan</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>100201</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2014-02-10 21:04:42 +0000</bug_when>
    <thetext>Specification: http://www.whatwg.org/specs/web-apps/current-work/
Multipage: http://www.whatwg.org/C#processing-model
Complete: http://www.whatwg.org/c#processing-model
Referrer: 

Comment:
Why wouldn&apos;t referrer for about:blank be based on the origin it inherits?

Posted from: 98.110.194.132
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:30.0) Gecko/20100101 Firefox/30.0</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100202</commentid>
    <comment_count>1</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-02-10 21:05:57 +0000</bug_when>
    <thetext>The spec basically requires that referrer not be sent from about:blank or data: documents.  What Gecko does instead is basically aliases the original document URI of the document whose origin we&apos;re aliasing... but maybe we should just directly alias the referrer or something?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100212</commentid>
    <comment_count>2</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-02-10 21:37:44 +0000</bug_when>
    <thetext>Who would you be sending the referrer to, exactly? I&apos;m confused. Do you just mean the document.referrer API? Can you give a concrete example of what you mean?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100215</commentid>
    <comment_count>3</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-02-10 21:48:08 +0000</bug_when>
    <thetext>Say I have a document loaded from http://something.com that has:

  &lt;iframe&gt;&lt;/iframe&gt;
  &lt;script&gt;
    onload = function() {
      var doc = frames[0].document;
      var kid = doc.createElement(&quot;iframe&quot;);
      kid.src = &quot;http://example.com&quot;;
      doc.body.appendChild(kid);
    }
  &lt;/script&gt;

Per spec as written right now the &quot;http://example.com&quot; load will not get a referrer sent with it, as far as I can tell.  Arguably it should get &quot;http://something.com&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101000</commentid>
    <comment_count>4</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-02-20 20:29:04 +0000</bug_when>
    <thetext>Ah, yeah. I think you&apos;re reading it right.

Any idea what browsers do here? (I&apos;ll test it if you don&apos;t happen to know.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101053</commentid>
    <comment_count>5</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-02-20 22:27:46 +0000</bug_when>
    <thetext>The way the base URL defers to the top frame is through step 2 here, FWIW:
   http://www.whatwg.org/specs/web-apps/current-work/#fallback-base-url

Looks like browsers aren&apos;t interoperable on the referrer (they are on base URL):
   http://software.hixie.ch/utilities/js/live-dom-viewer/saved/2831

* Gecko does as you suggest (defer to about:blank&apos;s creator browsing context).

* Chrome doesn&apos;t send it if it&apos;s about:blank, but does for document.written()
  and for the direct frame in the parent.

* Safari doesn&apos;t send it if it&apos;s about:blank or document.written(), but does
  for the direct frame in the parent.

Spec matches Chrome currently, if I&apos;m reading it right.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101093</commentid>
    <comment_count>6</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-02-21 04:56:52 +0000</bug_when>
    <thetext>Yes, I think spec as currently written matches Chrome.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101168</commentid>
    <comment_count>7</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-02-21 22:54:07 +0000</bug_when>
    <thetext>miketaylr tells me IE11 matches Chrome also.

Arguments for deferring up the chain if the URL is about:blank:
 - if you build your app from script, and part of it is in a new iframe and it has 
   images, your images would be lacking the right referrer.
 - consistency with origin and base URL
 - a browser does this (Firefox)

Arguments for dropping the referrer (spec status quo):
 - it gives you a way to drop the referrer
 - the referring document really is about:blank
 - the script injecting the content is the real culprit, not the parent document
 - two browsers do this (Chrome, IE)
 - three browsers do either this, or are even further away from sending
   referrers (Safari)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101387</commentid>
    <comment_count>8</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-02-25 19:37:08 +0000</bug_when>
    <thetext>Ok, anyone got an opinion as to which they prefer? Did I miss any arguments?

I think I&apos;m leaning towards not changing anything here, but I don&apos;t think the arguments in either direction are particularly compelling.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101397</commentid>
    <comment_count>9</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-02-25 20:06:09 +0000</bug_when>
    <thetext>I&apos;m a pretty firm believer in consistency of origin and referrer if possible, given how referrer is used in practice.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101428</commentid>
    <comment_count>10</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2014-02-26 09:16:32 +0000</bug_when>
    <thetext>I would expect that the referrer of the parent is sent, and if we want to provide a way to opt-out of the referrer it seems clearer to do so explicitly with a &lt;meta&gt; element or so.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101435</commentid>
    <comment_count>11</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-02-26 15:37:21 +0000</bug_when>
    <thetext>Ok, unless someone provides a counter-argument before I get to it (probably later today), I&apos;ll change the spec to defer up the chain for referrer, much like it does for the base URL.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101562</commentid>
    <comment_count>12</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-02-27 23:48:11 +0000</bug_when>
    <thetext>Ooh, actually, this impacts fetch. Anne, how do you want to handle this? Should I bring some of http://fetch.spec.whatwg.org/#determine-referrer back into HTML?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102480</commentid>
    <comment_count>13</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-03-17 18:23:58 +0000</bug_when>
    <thetext>Yeah, that bit in Fetch is only there temporarily. My idea is that eventually you make HTML use the main algorithm, which does not do much with Referer. The exact &quot;calling interface&quot; for the main algorithm could be improved though.

(I&apos;m with bz I think on matching referer/origin/base.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105435</commentid>
    <comment_count>14</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-05-08 14:25:23 +0000</bug_when>
    <thetext>Comment 13 is obsolete. Given CSP having a policy for Referer, it should be in Fetch I think.

I would like to see if the &quot;referrer source&quot; concept can be changed. Fetch requires a global to be changed in (request client), so it would be nice if we could somehow tie it to that. E.g. you either provide an explicit referrer, or just a pointer to a global (window or worker) where it can be retrieved from.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105438</commentid>
    <comment_count>15</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-05-08 14:48:58 +0000</bug_when>
    <thetext>I don&apos;t know if this is possible, but I think it would be nice that if Fetch is not passed an explicit Referer, it looks on request&apos;s source (which is a global object) and gets it from there. Using that for origin seems good too. This is just a thought, I have not done extensive analysis.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105440</commentid>
    <comment_count>16</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-05-08 14:57:35 +0000</bug_when>
    <thetext>The request source might not be a global object, unless I&apos;m missing something.  E.g. if I have a stylesheet that does @import, the request source and referrer should be the stylesheet.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105441</commentid>
    <comment_count>17</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-05-08 15:05:59 +0000</bug_when>
    <thetext>Sorry, I meant request client: http://fetch.spec.whatwg.org/#concept-request-client It&apos;s a relatively new concept needed for service workers.

Agreed that for stylesheets you need an override of sorts. For stylesheets the &quot;referrer source&quot; concept also could not be a Document. My idea would be that we either pass a referrer that&apos;s a URL, and fallback to the referrer of the request client if referrer is not passed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109530</commentid>
    <comment_count>18</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-07-29 21:04:46 +0000</bug_when>
    <thetext>Mike, this impacts your interests.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109563</commentid>
    <comment_count>19</comment_count>
    <who name="Mike West">mkwst</who>
    <bug_when>2014-07-30 12:02:47 +0000</bug_when>
    <thetext>Thanks for looping me in, Ian. As you&apos;re aware, WebAppSec is trying to hammer this out in http://w3c.github.io/webappsec/specs/referrer-policy/

I think we&apos;d be willing to change that spec (and therefore Chrome&apos;s behavior) here for &apos;about:blank&apos;. That would also have impact on framed `blob:` URLs. We&apos;d still probably end up with divergent behavior for `data:` URLs, as I think there&apos;s still disagreement(?) between browsers about what origin those URLs ought to be assigned.

That said, regarding comment #16, I&apos;d expect a stylesheet&apos;s `@import` or `url()` to be fetched through the Document that&apos;s loaded the stylesheet, and for the referrer to be based on that page&apos;s policy settings.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109568</commentid>
    <comment_count>20</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-07-30 13:27:58 +0000</bug_when>
    <thetext>Note that there&apos;s a distinction between the referrer policy settings and the referrer source.

You could use the document&apos;s referrer policy but still use the style sheet&apos;s URIas the referrer URI to apply that policy to.  I suggest testing what UAs do in practice for @import.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109571</commentid>
    <comment_count>21</comment_count>
    <who name="Mike West">mkwst</who>
    <bug_when>2014-07-30 13:35:37 +0000</bug_when>
    <thetext>(In reply to Boris Zbarsky from comment #20)
&gt; Note that there&apos;s a distinction between the referrer policy settings and the
&gt; referrer source.

Indeed.

&gt; You could use the document&apos;s referrer policy but still use the style sheet&apos;s
&gt; URIas the referrer URI to apply that policy to.  I suggest testing what UAs
&gt; do in practice for @import.

On http://stevesouders.com/tests/atimport/link-with-imports.php?t=1406727251, Chrome sends the document&apos;s URL as a referrer for `@import`-loaded CSS. Firefox sends the stylesheet&apos;s URL. That surprises me a bit.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109572</commentid>
    <comment_count>22</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-07-30 13:43:25 +0000</bug_when>
    <thetext>What do other UAs do?

Are you surprised by one behavior or the other, or by the difference?  

The Firefox behavior is quite purposeful; see &lt;https://bugzilla.mozilla.org/show_bug.cgi?id=249171&gt; (and for that matter &lt;https://bugzilla.mozilla.org/show_bug.cgi?id=249168&gt;, which was about using the sheet as the referrer for url() things).  The referrer really is the sheet in this case, not the document.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>111203</commentid>
    <comment_count>23</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-09-08 22:00:19 +0000</bug_when>
    <thetext>mike, see comment 22.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>111244</commentid>
    <comment_count>24</comment_count>
    <who name="Mike West">mkwst</who>
    <bug_when>2014-09-09 09:17:20 +0000</bug_when>
    <thetext>(In reply to Ian &apos;Hixie&apos; Hickson from comment #23)
&gt; mike, see comment 22.

I continue to be surprised by the Firefox behavior, but not so surprised that I&apos;d oppose changing Chrome&apos;s behavior to match. +Jochen, who might have an opinion.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>111246</commentid>
    <comment_count>25</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-09-09 09:27:31 +0000</bug_when>
    <thetext>This is not just CSS I think:

* HTML imports
* XSLT (e.g. the document() function)
* Manifest (both appcache and the new one)?

SVG would not be impacted by this, as it can only load external resources when it creates a document environment itself (at least by the policy we plan to align all user agents on).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>120757</commentid>
    <comment_count>26</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2015-06-05 20:56:38 +0000</bug_when>
    <thetext>(In reply to Mike West from comment #19)
&gt; I think we&apos;d be willing to change that spec (and therefore Chrome&apos;s
&gt; behavior) here for &apos;about:blank&apos;. That would also have impact on framed
&gt; `blob:` URLs. We&apos;d still probably end up with divergent behavior for `data:`
&gt; URLs, as I think there&apos;s still disagreement(?) between browsers about what
&gt; origin those URLs ought to be assigned.

For what it&apos;s worth, I would prefer Gecko&apos;s behavior when it comes to sticking data: URLs in an &lt;iframe&gt; or when using data: URLs when creating a Worker.

My preferred behavior is that by default, a &lt;iframe src=&quot;data:...&quot;&gt; runs with a &quot;null principal&quot;. I.e. it&apos;s not same-origin with anything. But that we add something like &lt;iframe allowinherit src=&quot;data:...&quot;&gt; which would cause the contained page to be same-origin with parent.


Likewise for workers, where I think new Worker(&quot;data:...&quot;) should throw as the URL would be considered cross-origin, but where |new worker({ url: &quot;data:...&quot;, allowInherit: true }) would cause the worker to be same-origin with the script creating the worker.


Others at mozilla might disagree, so I can&apos;t commit to if or when such a change would be acceptable. But I wanted to state my opinion.


Other than this I like mozilla&apos;s behavior of sending the URL of the stylesheet as the referrer for url() in stylesheets, and walking up the chain for things like about:blank and data:.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123236</commentid>
    <comment_count>27</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-09-17 08:21:57 +0000</bug_when>
    <thetext>This is fixed since HTML now uses Fetch which uses Referrer Policy which defines this behavior afaik.

https://github.com/whatwg/html/commit/7c5555a16f2920c02244c10756bb2f1a11e87a22</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>