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

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>17352</bug_id>
          
          <creation_ts>2008-02-13 15:13:30 -0800</creation_ts>
          <short_desc>Origin of a Document from a data: URI should match HTML5</short_desc>
          <delta_ts>2022-08-11 04:54:56 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>DOM</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>CONFIGURATION CHANGED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=168022</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>17331</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Adam Roben (:aroben)">aroben</reporter>
          <assigned_to name="Adam Barth">abarth</assigned_to>
          <cc>abarth</cc>
    
    <cc>ahmad.saleem792</cc>
    
    <cc>a.m.dussaq</cc>
    
    <cc>ap</cc>
    
    <cc>arthur</cc>
    
    <cc>bfulgham</cc>
    
    <cc>cdumez</cc>
    
    <cc>dbates</cc>
    
    <cc>fred.wang</cc>
    
    <cc>mail</cc>
    
    <cc>mcatanzaro</cc>
    
    <cc>mcdonald.ben</cc>
    
    <cc>mchouinard26</cc>
    
    <cc>nicholas</cc>
    
    <cc>paulirish</cc>
    
    <cc>pbakaus</cc>
    
    <cc>rniwa</cc>
    
    <cc>robertc</cc>
    
    <cc>sam</cc>
    
    <cc>warner.andy</cc>
    
    <cc>wgh</cc>
    
    <cc>youennf</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>70576</commentid>
    <comment_count>0</comment_count>
    <who name="Adam Roben (:aroben)">aroben</who>
    <bug_when>2008-02-13 15:13:30 -0800</bug_when>
    <thetext>According to HTML5 &lt;http://www.whatwg.org/specs/web-apps/current-work/#origin0&gt;:

&gt; The origin of a Document or image that was generated from a data: URI
&gt; from another source is a globally unique identifier assigned when the
&gt; document is created.

Where &quot;from another source&quot; means &quot;not from another Document or script&quot;.

Currently we always assign a scheme/host/port tuple as the origin of a Document (though I&apos;m not sure what the parts of this tuple end up being for a data: URI).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>70580</commentid>
    <comment_count>1</comment_count>
    <who name="Sam Weinig">sam</who>
    <bug_when>2008-02-13 15:30:01 -0800</bug_when>
    <thetext>We currently mark data: URIs as having no access to any other origins including other data: URIs.  Our current policy is more restrictive than what HTML5 proposes.  We should consider relaxing it. </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>399519</commentid>
    <comment_count>2</comment_count>
    <who name="Nicholas Wilson">nicholas</who>
    <bug_when>2011-05-06 08:08:12 -0700</bug_when>
    <thetext>Please do relax it at some point to comply with HTML5. There is a small number of odd tasks designers use iframes with data URIs for. Having to faff with messages just for WebKit to let them communicate with the parent is a nuisance.

Usually, the origin of a Document from a data: URI should be that of the parent (or preceding page, given that you can make clickable data URIs with arbitrarily nested documents...)
&gt; &quot;If a document or image was generated from a data: URL found in another 
&gt; Document or in a script: The origin is the origin of the Document or script 
&gt; that initiated the navigation to that URL.&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>701490</commentid>
    <comment_count>3</comment_count>
    <who name="">mcdonald.ben</who>
    <bug_when>2012-08-21 19:07:58 -0700</bug_when>
    <thetext>Would be great if this can be relaxed to comply with HTML5 as this bug prevents PNG downloads of SVG images in a handful of webapps.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>710196</commentid>
    <comment_count>4</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2012-09-01 01:11:41 -0700</bug_when>
    <thetext>It&apos;s not clear if we should change our behavior here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>710291</commentid>
    <comment_count>5</comment_count>
    <who name="Sam Weinig">sam</who>
    <bug_when>2012-09-01 15:26:08 -0700</bug_when>
    <thetext>(In reply to comment #4)
&gt; It&apos;s not clear if we should change our behavior here.

Agreed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>711067</commentid>
    <comment_count>6</comment_count>
    <who name="Paul Bakaus">pbakaus</who>
    <bug_when>2012-09-04 06:38:29 -0700</bug_when>
    <thetext>Definitely in favor of relaxing it. For a perfectly valid use case, see my new library Domvas at http://pbakaus.github.com/domvas/, using SVG&apos;s foreignObject to paint DOM content onto a canvas.

I have also opened a duplicate ticket on the Chromium bugtracker: http://code.google.com/p/chromium/issues/detail?id=145939</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>725613</commentid>
    <comment_count>7</comment_count>
      <attachid>165151</attachid>
    <who name="Christoph Burgmer">christoph.burgmer</who>
    <bug_when>2012-09-21 10:14:40 -0700</bug_when>
    <thetext>Created attachment 165151
Test case for bug in Webkit where writing a SVG to a canvas will make it impossible to read from

I am unclear what content we are talking about here, and whether this is the right report for the issue I have when drawing SVG through a data:uri to a canvas. 

I am attaching a test case to test whether a canvas can be read once a SVG has been drawn from a data:uri. You should see a green page when the test case passes.

Btw. the original link to the HTML5 document is broken, here is the current one: http://www.whatwg.org/specs/web-apps/current-work/#origin-0</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1171459</commentid>
    <comment_count>8</comment_count>
    <who name="">a.m.dussaq</who>
    <bug_when>2016-03-06 14:32:05 -0800</bug_when>
    <thetext>Is there an update on this? Both Chrome and Firefox have expected behavior in this regard. It seems odd that in the case of trying to convert svg to png on a file with the proper domain origin this will not work. Additionally it causes the functions used by rasterizeHTML to fail to be able to build a dataURL from the image created.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1174829</commentid>
    <comment_count>9</comment_count>
    <who name="">mchouinard26</who>
    <bug_when>2016-03-14 17:23:43 -0700</bug_when>
    <thetext>Would love to see this implemented to match the same functionality as Chrome and Firefox.

There doesn&apos;t seem to be a workaround to get this to work in Webkit otherwise.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1225323</commentid>
    <comment_count>10</comment_count>
    <who name="Andy Warner">warner.andy</who>
    <bug_when>2016-09-01 07:40:48 -0700</bug_when>
    <thetext>Any updates on this bug? Its been a few years and seems to still be an issue. We developers are running into this issue in the wild and only in webkit browsers. It would be nice to not have to fall back to something else because webkit cant keep up.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1225337</commentid>
    <comment_count>11</comment_count>
    <who name="youenn fablet">youennf</who>
    <bug_when>2016-09-01 09:24:07 -0700</bug_when>
    <thetext>(In reply to comment #10)
&gt; Any updates on this bug? Its been a few years and seems to still be an
&gt; issue. We developers are running into this issue in the wild and only in
&gt; webkit browsers. It would be nice to not have to fall back to something else
&gt; because webkit cant keep up.

There is some recent work being done to improve that part.
Plan is to match fetch algorithm, thus making data URL resources have the same origin as the requester.

If you know some problematic web sites (or better test cases), I&apos;ll be glad to look at them.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1225350</commentid>
    <comment_count>12</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2016-09-01 09:41:00 -0700</bug_when>
    <thetext>(In reply to comment #11)
&gt; (In reply to comment #10)
&gt; &gt; Any updates on this bug? Its been a few years and seems to still be an
&gt; &gt; issue. We developers are running into this issue in the wild and only in
&gt; &gt; webkit browsers. It would be nice to not have to fall back to something else
&gt; &gt; because webkit cant keep up.
&gt; 
&gt; There is some recent work being done to improve that part.
&gt; Plan is to match fetch algorithm, thus making data URL resources have the
&gt; same origin as the requester.
&gt; 
&gt; If you know some problematic web sites (or better test cases), I&apos;ll be glad
&gt; to look at them.

Youenn, if it helps, I know of web-platform-tests that are failing because of this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1225355</commentid>
    <comment_count>13</comment_count>
    <who name="youenn fablet">youennf</who>
    <bug_when>2016-09-01 09:49:11 -0700</bug_when>
    <thetext>Sure, can you list some of them here, particularly if related to images?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1227578</commentid>
    <comment_count>14</comment_count>
    <who name="youenn fablet">youennf</who>
    <bug_when>2016-09-08 02:53:55 -0700</bug_when>
    <thetext>See https://github.com/whatwg/html/issues/1753 for ongoing discussions about document origin. Plan is to align the spec here with Chromium/WebKit

As of images, the same-origin data-url flag is set for img elements.
This means they are considered CORS-SameOrigin.
I think WebKit is aligned with this behavior also.

I am not sure if there is any other point to consider here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1279847</commentid>
    <comment_count>15</comment_count>
    <who name="Arthur Jamain">arthur</who>
    <bug_when>2017-02-22 03:55:14 -0800</bug_when>
    <thetext>(In reply to comment #14)
&gt; See https://github.com/whatwg/html/issues/1753 for ongoing discussions about
&gt; document origin. Plan is to align the spec here with Chromium/WebKit
&gt; 
&gt; As of images, the same-origin data-url flag is set for img elements.
&gt; This means they are considered CORS-SameOrigin.
&gt; I think WebKit is aligned with this behavior also.
&gt; 
&gt; I am not sure if there is any other point to consider here.

Hey there !

I&apos;ve just run into the foreignObject -&gt; tainted canvas issue and have landed here. We&apos;re trying to build webGL UI components using HTML for VR browsing, and we have just realised that the resulting textures are actually tainted and hence unusable. I&apos;m now trying to plan for an efficient workaround.

Do you have any ideas as to whether this will be eventually supported ? With maybe some kind of wide-ranging timeframe ?

I&apos;m asking because as you&apos;ve said a couple posts up, there seems to be some movement again around this issue. I&apos;m trying to determine whether we can wait for a possible resolution with a temporary hack or if we need to find a hard workaround.

That being said, if our case is of any interest to you, I can provide a scoped test case. The rationale is : 

- interpolate a template with strings that are related to the user selecting stuff in webgl/VR scene ( strings are all dynamical / API provided )
- put resulting template in a svg / foreignObject
- generate an image based on this svg
- use this image as a texture for the webgl scene

Thanks for reading,</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1398336</commentid>
    <comment_count>16</comment_count>
    <who name="Aman Vishnani">aman62</who>
    <bug_when>2018-02-12 02:31:00 -0800</bug_when>
    <thetext>Hi there,

Any progress on this bug? I came across this bug while using dom-to-image library for converting an HTML element into a sharable png image. I was hoping that we could make this work without restrictions since Google Chrome and Firefox already allows it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1890554</commentid>
    <comment_count>17</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2022-08-11 04:54:45 -0700</bug_when>
    <thetext>I am unable to reproduce this bug using attached test case in Safari 15.6 on macOS 12.5 and it shows &quot;Green&quot; page, which is indication of &quot;PASS&quot; as per Comment 07 but if the test is wrong then please ignore my comment and reopen this bug.

While in case of other browser (Chrome Canary 106 and Firefox Nightly 105) also render the test in &quot;Green&quot;.It also show &quot;pass&quot; in console for all other browsers.

I am marking this as &quot;RESOLVED CONFIGURATION CHANGED&quot;. Thanks!</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>165151</attachid>
            <date>2012-09-21 10:14:40 -0700</date>
            <delta_ts>2012-09-21 10:14:40 -0700</delta_ts>
            <desc>Test case for bug in Webkit where writing a SVG to a canvas will make it impossible to read from</desc>
            <filename>webkitCanvasSameDomainBug.html</filename>
            <type>text/html</type>
            <size>1992</size>
            <attacher name="Christoph Burgmer">christoph.burgmer</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxodG1sPgo8aGVhZD4KICAgIDxtZXRhIGNoYXJzZXQ9InV0Zi04IiAv
PgogICAgPHRpdGxlPlRlc3QgY2FzZSBmb3IgYnVnIGluIFdlYmtpdCB3aGVyZSB3cml0aW5nIGEg
U1ZHIHRvIGEgY2FudmFzIHdpbGwgbWFrZSBpdCBpbXBvc3NpYmxlIHRvIHJlYWQgZnJvbTwvdGl0
bGU+CjwvaGVhZD4KPGJvZHk+CiAgICA8c2NyaXB0IHR5cGU9InRleHQvamF2YXNjcmlwdCI+CiAg
ICAgICAgZnVuY3Rpb24gbG9hZEltYWdlKHVybCwgY2FsbGJhY2spIHsKICAgICAgICAgICAgdmFy
IGltYWdlID0gbmV3IHdpbmRvdy5JbWFnZSgpOwogICAgICAgICAgICBpbWFnZS5vbmxvYWQgPSBm
dW5jdGlvbigpIHsKICAgICAgICAgICAgICAgIGNhbGxiYWNrKGltYWdlKTsKICAgICAgICAgICAg
fTsKICAgICAgICAgICAgaW1hZ2Uuc3JjID0gdXJsOwogICAgICAgIH0KCiAgICAgICAgZnVuY3Rp
b24gZHJhd1VybFRvQ2FudmFzKHVybCwgY2FudmFzLCBjYWxsYmFjaykgewogICAgICAgICAgICB2
YXIgY29udGV4dCA9IGNhbnZhcy5nZXRDb250ZXh0KCIyZCIpOwoKICAgICAgICAgICAgbG9hZElt
YWdlKHVybCwgZnVuY3Rpb24gKGltYWdlKSB7CiAgICAgICAgICAgICAgICBjb250ZXh0LmNsZWFy
UmVjdCgwLCAwLCBjYW52YXMud2lkdGgsIGNhbnZhcy5oZWlnaHQpOwogICAgICAgICAgICAgICAg
Y29udGV4dC5kcmF3SW1hZ2UoaW1hZ2UsIDAsIDApOwoKICAgICAgICAgICAgICAgIGNhbGxiYWNr
KCk7CiAgICAgICAgICAgIH0pOwogICAgICAgIH0KCiAgICAgICAgZnVuY3Rpb24gcmVhZEZyb21D
YW52YXMoY2FudmFzKSB7CiAgICAgICAgICAgIHJldHVybiBjYW52YXMuZ2V0Q29udGV4dCgiMmQi
KS5nZXRJbWFnZURhdGEoMCwgMCwgY2FudmFzLndpZHRoLCBjYW52YXMuaGVpZ2h0KTsKICAgICAg
ICB9CgogICAgICAgIHdpbmRvdy5vbmxvYWQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgICAgIHZh
ciBhU3ZnSW1hZ2VVcmwgPSAnZGF0YTppbWFnZS9zdmcreG1sO2NoYXJzZXQ9dXRmLTgsPHN2ZyB4
bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAw
Ij48L3N2Zz4nOwoKICAgICAgICAgICAgbG9hZEltYWdlKGFTdmdJbWFnZVVybCwgZnVuY3Rpb24g
KGltZykgewogICAgICAgICAgICAgICAgdmFyIGNhbnZhcyA9IGRvY3VtZW50LmNyZWF0ZUVsZW1l
bnQoImNhbnZhcyIpOwoKICAgICAgICAgICAgICAgIGNhbnZhcy53aWR0aCA9IGltZy53aWR0aDsK
ICAgICAgICAgICAgICAgIGNhbnZhcy5oZWlnaHQgPSBpbWcuaGVpZ2h0OwoKICAgICAgICAgICAg
ICAgIGRyYXdVcmxUb0NhbnZhcygKICAgICAgICAgICAgICAgICAgICBhU3ZnSW1hZ2VVcmwsCiAg
ICAgICAgICAgICAgICAgICAgY2FudmFzLAogICAgICAgICAgICAgICAgICAgIGZ1bmN0aW9uICgp
IHsKICAgICAgICAgICAgICAgICAgICAgICAgdHJ5IHsKICAgICAgICAgICAgICAgICAgICAgICAg
ICAgIHJlYWRGcm9tQ2FudmFzKGNhbnZhcyk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBj
b25zb2xlLmxvZygicGFzcyIpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZG9jdW1lbnQu
Z2V0RWxlbWVudHNCeVRhZ05hbWUoImJvZHkiKVswXS5zdHlsZS5iYWNrZ3JvdW5kQ29sb3IgPSAi
Z3JlZW4iOwogICAgICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7CiAgICAgICAgICAg
ICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZygiZmFpbCIpOwogICAgICAgICAgICAgICAgICAg
ICAgICAgICAgZG9jdW1lbnQuZ2V0RWxlbWVudHNCeVRhZ05hbWUoImJvZHkiKVswXS5zdHlsZS5i
YWNrZ3JvdW5kQ29sb3IgPSAicmVkIjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRocm93
IGU7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9KTsKICAg
ICAgICAgICAgfSk7CiAgICAgICAgfTsKICAgIDwvc2NyaXB0Pgo8L2JvZHk+CjwvaHRtbD4K
</data>

          </attachment>
      

    </bug>

</bugzilla>