chromium/third_party/blink/web_tests/fast/dom/cloneNode.html

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
    <script>
    function log(s)
    {
        var logDiv = document.getElementById("log");
        logDiv.appendChild(document.createTextNode(s));
        logDiv.appendChild(document.createElement('br'));
    }

    function matches(node, clonedNode, passedMessage)
    {
        if (node.localName === clonedNode.localName && node.prefix === clonedNode.prefix && node.namespaceURI === clonedNode.namespaceURI && node.nodeName === clonedNode.nodeName)
            log("PASSED: " + passedMessage);
        else
            log("FAILED");
    }

    function test()
    {
        if (window.testRunner)
            testRunner.dumpAsText();

        var xmlDoc = document.implementation.createDocument("http://www.example.com", "foo:bar", null);

        var xmlNode = xmlDoc.createElement("foo:bar");
        var clonedXMLNode = xmlNode.cloneNode(false);  // WebKit crashes.
        var htmlNode = document.getElementById('log');
        var clonedHTMLNode = htmlNode.cloneNode(false);

        matches(xmlNode, clonedXMLNode, "Cloned XML node matches the original");
        matches(htmlNode, clonedHTMLNode, "Cloned HTML node matches the original");
    }
    </script>
</head>
<body onload="test()">
<p> Test for bug Bug <a href="https://bugs.webkit.org/show_bug.cgi?id=23956">23956</a>: Safari crashes when cloneNode fails (cloning a XML element with an invalid nodeName)</p>
<p> For this test to pass, it should not crash and you should see PASSED twice.</p>
<div id='log'/>
</body>
</html>