[Webkit-unassigned] [Bug 187800] New: testharness can not report results in HTML or SVG documents without document.body

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jul 19 07:56:59 PDT 2018


https://bugs.webkit.org/show_bug.cgi?id=187800

            Bug ID: 187800
           Summary: testharness can not report results in HTML or SVG
                    documents without document.body
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Tools / Tests
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: fred.wang at free.fr
                CC: dkadu at igalia.com, lforschler at apple.com,
                    rwlbuis at gmail.com, youennf at gmail.com

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 && "SVGSVGElement" in output_window) {
                    is_svg = output_document.documentElement instanceof output_window.SVGSVGElement;
                } else if (output_window) {
                    is_html = (output_document.namespaceURI == "http://www.w3.org/1999/xhtml" &&
                               output_document.localName == "html");
                }
                if (is_svg) {
                    var foreignObject = output_document.createElementNS("http://www.w3.org/2000/svg", "foreignObject");
                    foreignObject.setAttribute("width", "100%");
                    foreignObject.setAttribute("height", "100%");
                    output_document.documentElement.appendChild(foreignObject);
                    foreignObject.appendChild(node);
                } else if (is_html) {
                    var body = output_document.createElementNS("http://www.w3.org/1999/xhtml", "body");
                    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 'results_element'
    // is inserted at a location that results in a valid document.
    var parent = document.body
        ? document.body                 // <body> is required in XHTML documents
        : document.documentElement;     // fallback for optional <body> in HTML5, SVG, etc.

    parent.appendChild(results_element);

The custom versions we have in WebKit don'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 "document.body is null".

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20180719/02a85aff/attachment.html>


More information about the webkit-unassigned mailing list