<?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>187800</bug_id>
          
          <creation_ts>2018-07-19 07:56:59 -0700</creation_ts>
          <short_desc>testharness can not report results in HTML or SVG documents without document.body</short_desc>
          <delta_ts>2024-06-21 16:46:50 -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>Tools / Tests</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>203503</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>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Frédéric Wang Nélar">fred.wang</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>dkadu</cc>
    
    <cc>gsnedders</cc>
    
    <cc>lforschler</cc>
    
    <cc>rwlbuis</cc>
    
    <cc>youennf</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1443351</commentid>
    <comment_count>0</comment_count>
    <who name="Frédéric Wang Nélar">fred.wang</who>
    <bug_when>2018-07-19 07:56:59 -0700</bug_when>
    <thetext>Upstream testharness.js has the following logic in Output.prototype.resolve_log:

            if (output_document.body) {
                output_document.body.appendChild(node);
            } else {
                var is_html = false;
                var is_svg = false;
                var output_window = output_document.defaultView;
                if (output_window &amp;&amp; &quot;SVGSVGElement&quot; in output_window) {
                    is_svg = output_document.documentElement instanceof output_window.SVGSVGElement;
                } else if (output_window) {
                    is_html = (output_document.namespaceURI == &quot;http://www.w3.org/1999/xhtml&quot; &amp;&amp;
                               output_document.localName == &quot;html&quot;);
                }
                if (is_svg) {
                    var foreignObject = output_document.createElementNS(&quot;http://www.w3.org/2000/svg&quot;, &quot;foreignObject&quot;);
                    foreignObject.setAttribute(&quot;width&quot;, &quot;100%&quot;);
                    foreignObject.setAttribute(&quot;height&quot;, &quot;100%&quot;);
                    output_document.documentElement.appendChild(foreignObject);
                    foreignObject.appendChild(node);
                } else if (is_html) {
                    var body = output_document.createElementNS(&quot;http://www.w3.org/1999/xhtml&quot;, &quot;body&quot;);
                    output_document.documentElement.appendChild(body);
                    body.appendChild(node);
                } else {
                    output_document.documentElement.appendChild(node);
                }
            }
        }

while the function passed to add_completion_callback in testharnessreport.js does this:

    // To avoid a HierarchyRequestError with XML documents, ensure that &apos;results_element&apos;
    // is inserted at a location that results in a valid document.
    var parent = document.body
        ? document.body                 // &lt;body&gt; is required in XHTML documents
        : document.documentElement;     // fallback for optional &lt;body&gt; in HTML5, SVG, etc.

    parent.appendChild(results_element);

The custom versions we have in WebKit don&apos;t seem to do this, so for example custom-elements/Document-createElement-svg.svg is not rendered correctly in MiniBrowser when with run-webkit-httpd while we get a timeout in run-webkit-test because &quot;document.body is null&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2042538</commentid>
    <comment_count>1</comment_count>
    <who name="Sam Sneddon [:gsnedders]">gsnedders</who>
    <bug_when>2024-06-21 16:46:50 -0700</bug_when>
    <thetext>

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

    </bug>

</bugzilla>