<?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>36297</bug_id>
          
          <creation_ts>2010-03-18 08:47:19 -0700</creation_ts>
          <short_desc>getSVGDocument method of an Object element returns undefined in unload</short_desc>
          <delta_ts>2016-10-12 05:40:24 -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>SVG</component>
          <version>528+ (Nightly build)</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>0</everconfirmed>
          <reporter>azerkoculu</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>bburg</cc>
    
    <cc>cdumez</cc>
    
    <cc>krit</cc>
    
    <cc>robertc</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>201322</commentid>
    <comment_count>0</comment_count>
    <who name="">azerkoculu</who>
    <bug_when>2010-03-18 08:47:19 -0700</bug_when>
    <thetext>As I&apos;ve written in the summary, getSVGDocument method of the Object element doesn&apos;t work. Please check the test page in the URL.

User Agent: AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.30 Safari/532.5</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>514516</commentid>
    <comment_count>1</comment_count>
      <attachid>117763</attachid>
    <who name="Rob Crowther">robertc</who>
    <bug_when>2011-12-03 10:10:25 -0800</bug_when>
    <thetext>Created attachment 117763
Example of issue</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>514517</commentid>
    <comment_count>2</comment_count>
      <attachid>117764</attachid>
    <who name="Rob Crowther">robertc</who>
    <bug_when>2011-12-03 10:11:07 -0800</bug_when>
    <thetext>Created attachment 117764
SVG for attachment 117763</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>514518</commentid>
    <comment_count>3</comment_count>
    <who name="Rob Crowther">robertc</who>
    <bug_when>2011-12-03 10:15:25 -0800</bug_when>
    <thetext>Problem still exists in Google Chrome 16.0.912.59 beta, Linux x64.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>514882</commentid>
    <comment_count>4</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2011-12-04 21:15:26 -0800</bug_when>
    <thetext>There is no such method in HTML5. Why is it important to support?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>514955</commentid>
    <comment_count>5</comment_count>
    <who name="Rob Crowther">robertc</who>
    <bug_when>2011-12-05 00:28:33 -0800</bug_when>
    <thetext>I don&apos;t care if you don&apos;t want to support it, but it&apos;s already implemented:

var svg = document.getElementById(&apos;myembed&apos;);
window.alert(typeof svg.getSVGDocument);

This will alert &apos;function&apos; (http://jsfiddle.net/HkVY8/).  So either don&apos;t support it, or make it work.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>514967</commentid>
    <comment_count>6</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2011-12-05 01:14:04 -0800</bug_when>
    <thetext>You are right, it is supported in WebKit.

In your test case, undefined is returned simply because there is no document in &lt;embed&gt; yet at the time when load event is dispatched. It will be there after a timeout. Why do you think that this a is a bug?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>514978</commentid>
    <comment_count>7</comment_count>
    <who name="Rob Crowther">robertc</who>
    <bug_when>2011-12-05 01:45:02 -0800</bug_when>
    <thetext>I&apos;m already in window.onload in the testcase, why is there no document loaded yet?  If you attach to the load event on the embed (or object) element itself, you get the same result.  Is it really necessary to resort to setTimeout hacks?  Why are these events firing if the content isn&apos;t yet loaded?

If you try the testcase in Firefox or Opera there will be a document loaded when getSVGDocument is called.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>515129</commentid>
    <comment_count>8</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2011-12-05 09:14:33 -0800</bug_when>
    <thetext>Per HTML5, load event should be delayed until the resource specified by embed&apos;s src attribute is fetched. Nothing says that it should be delayed until it&apos;s parsed into a document. So, WebKit result on this test doesn&apos;t appear non-compliant.

That said, a look at Web Inspector timeline reveals that WebKit doesn&apos;t delay load event until after fetching the resource specified by the src attribute, which is wrong per HTML5.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>515217</commentid>
    <comment_count>9</comment_count>
    <who name="Rob Crowther">robertc</who>
    <bug_when>2011-12-05 11:09:06 -0800</bug_when>
    <thetext>I&apos;ve been able to confirm today that the test case also works in IE9.  Chrome is the only browser I have available that it doesn&apos;t work in.

If the load event doesn&apos;t require that the document be parsed when it&apos;s getting fired on a document object then it makes the load event kind of useless in that scenario.  Should I file a bug on the spec, or do you think this issue would be resolved if the load event was being delayed correctly?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>515249</commentid>
    <comment_count>10</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2011-12-05 11:48:17 -0800</bug_when>
    <thetext>This might be worth discussing with the standards community. Let me add some more background.

Object and embed element behavior is primarily tailored for plug-ins, and you don&apos;t get much insight into what happens inside a plug-in after fetching its top resource from the network. For many plug-ins, that top resource could be just a small handle to the real data. 

Plug-ins that do media playback are different yet, the load event definitely shouldn&apos;t be delayed until after the media file loads. Such plug-ins often don&apos;t even attempt to hold the whole media file locally. It&apos;s the same as &lt;video&gt; and &lt;audio&gt; elements in HTML5, which also don&apos;t delay the load event.

So, it seems that HTML5 is not quite right when it requires that loading plug-in resource must delay the load event. That cannot and shouldn&apos;t be done for media at least.

Providing different behavior for plug-ins and for types handled internally by the engine seems inconsistent, but could be considered.

Practically, I would suggest putting the SVG document in an iframe, not in an embed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>515437</commentid>
    <comment_count>11</comment_count>
    <who name="Rob Crowther">robertc</who>
    <bug_when>2011-12-05 15:13:11 -0800</bug_when>
    <thetext>&gt; This might be worth discussing with the standards community.

I&apos;ll file a bug and see what happens.  At the very least, if Firefox, Opera, IE and Chrome are all following the same spec then they should all behave the same way.  So if Chrome is arguably doing the right thing then the spec needs to be made more clear.

&gt; Practically, I would suggest putting the SVG document in an iframe, not
&gt; in an embed.

Doesn&apos;t really help if the primary reason for using object/embed was to provide fallback content or plugins for older browsers?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1137150</commentid>
    <comment_count>12</comment_count>
    <who name="Blaze Burg">bburg</who>
    <bug_when>2015-10-28 09:50:59 -0700</bug_when>
    <thetext>+cdumez for thoughts on spec conformance.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1239253</commentid>
    <comment_count>13</comment_count>
    <who name="Dirk Schulze">krit</who>
    <bug_when>2016-10-12 05:40:24 -0700</bug_when>
    <thetext>We did change the loading behavior in SVG a couple of years ago. At the moment the test case on jsfiddle does work as expected and the same across browsers. Closing.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>117763</attachid>
            <date>2011-12-03 10:10:25 -0800</date>
            <delta_ts>2011-12-03 10:10:25 -0800</delta_ts>
            <desc>Example of issue</desc>
            <filename>svg-embed-javascript.html</filename>
            <type>text/html</type>
            <size>624</size>
            <attacher name="Rob Crowther">robertc</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxodG1sPgo8aGVhZD4KICAgIDxtZXRhIGNoYXJzZXQ9InV0Zi04Ij4K
ICAgIDx0aXRsZT5TVkcgRW1iZWQ8L3RpdGxlPgogICAgPHNjcmlwdD4KICAgIHdpbmRvdy5vbmxv
YWQgPSBmdW5jdGlvbiAoKSB7CiAgICAgICAgdmFyIHN2Z2VsID0gZG9jdW1lbnQuZ2V0RWxlbWVu
dEJ5SWQoJ215ZW1iZWQnKTsKICAgICAgICB2YXIgc3ZnOwogICAgICAgIGlmICh0eXBlb2Ygc3Zn
ZWwuZ2V0U1ZHRG9jdW1lbnQgIT09ICd1bmRlZmluZWQnKSB7CiAgICAgICAgICAgIHN2ZyA9IHN2
Z2VsLmdldFNWR0RvY3VtZW50KCk7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgc3ZnID0g
c3ZnZWwuY29udGVudERvY3VtZW50OwogICAgICAgIH0KICAgICAgICB2YXIgcmVjdCA9IHN2Zy5n
ZXRFbGVtZW50QnlJZCgnbG90MWEnKTsKICAgICAgICB3aW5kb3cuYWxlcnQoJ3g6JyArIHJlY3Qu
Z2V0QXR0cmlidXRlKCd4JykgKyAnIHk6JyArIHJlY3QuZ2V0QXR0cmlidXRlKCd5JykpOwogICAg
fQogICAgPC9zY3JpcHQ+CjwvaGVhZD4KPGJvZHk+CiAgICA8ZW1iZWQgc3JjPSJteXN2Zy5zdmci
IHR5cGU9ImltYWdlL3N2Zyt4bWwiIGlkPSJteWVtYmVkIiAvPgo8L2JvZHk+CjwvaHRtbD4K
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>117764</attachid>
            <date>2011-12-03 10:11:07 -0800</date>
            <delta_ts>2011-12-03 10:11:07 -0800</delta_ts>
            <desc>SVG for attachment 117763</desc>
            <filename>mysvg.svg</filename>
            <type>image/svg+xml</type>
            <size>257</size>
            <attacher name="Rob Crowther">robertc</attacher>
            
              <data encoding="base64">PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+Cjxz
dmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2ZXJzaW9uPSIxLjEiIHZpZXdC
b3g9IjAgMCAzMDAgMzAwIj4KICA8cmVjdCB4PSI1MCIgeT0iNTAiIHdpZHRoPSI1MCIgaGVpZ2h0
PSI1MCIgc3R5bGU9ImZpbGw6IHJlZDsiIGlkPSJsb3QxYSIgLz4KICA8cGF0aCBkPSJNMTUwIDAg
TDc1IDIwMCBMMjI1IDIwMCBaIiAvPgo8L3N2Zz4=
</data>

          </attachment>
      

    </bug>

</bugzilla>