<?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>64781</bug_id>
          
          <creation_ts>2011-07-18 21:20:17 -0700</creation_ts>
          <short_desc>SVG &lt;use&gt; referring to a later element causes problems</short_desc>
          <delta_ts>2012-02-25 02:46:44 -0800</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>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>78902</dup_id>
          
          <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>64419</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="James Simonsen">simonjam</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>zimmermann</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>438959</commentid>
    <comment_count>0</comment_count>
    <who name="James Simonsen">simonjam</who>
    <bug_when>2011-07-18 21:20:17 -0700</bug_when>
    <thetext>Fuzzers have found a bunch of bugs related to &lt;use&gt; and &lt;script&gt; in SVG. I think the main problem is that &lt;use&gt; tags are allowed to refer to IDs that occur later in the file. For example:

&lt;svg&gt;
&lt;g&gt;
&lt;use xlink:href=&quot;#test&quot;/&gt;
&lt;rect id=&quot;test&quot;&gt;
&lt;script&gt;
document.body.innerHTML = &quot;PASS&quot;;
&lt;/script&gt;

The &lt;use&gt; tag constructs its shadow DOM the first time recalcStyle() is called. In this example, that will be when the parser yields, which occurs after reaching &lt;/script&gt;, but before executing the script. By this point, the &lt;script&gt; has been constructed and inserted in the tree, but not executed. This leads to a situation where the script block will execute twice: once in the clone and once in the original. This seems wrong. Also, there may be other tags after the &lt;/script&gt; that haven&apos;t yet been parsed, but ought to have been deep cloned.

It seems that the shadow DOM should be created when the &lt;use&gt; tag is constructed and you shouldn&apos;t be allowed to refer to something later in the document. Briefly reading the spec, it always talks about &lt;use&gt;&apos;ing IDs that have been already declared and doesn&apos;t seem to cover the above case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>564928</commentid>
    <comment_count>1</comment_count>
    <who name="Nikolas Zimmermann">zimmermann</who>
    <bug_when>2012-02-25 02:46:44 -0800</bug_when>
    <thetext>Shadow tree creation time changed, marking as duplicate of bug 78902.

*** This bug has been marked as a duplicate of bug 78902 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>