chromium/third_party/blink/web_tests/svg/dom/SVGScriptElement/script-set-href.svg

<?xml version="1.0"?>
<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xhtml="http://www.w3.org/1999/xhtml" onload="test()">
<defs>
<script type="text/javascript">
var p5result = "FAIL";

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

    document.getElementById("p5").innerHTML = p5result;
    
    document.getElementById("s1").href.baseVal = "resources/script-set-href-p1fail.js";
    document.getElementById("s2").href.baseVal = "resources/script-set-href-p2fail.js";
    document.getElementById("s5").href.baseVal = "resources/script-set-href-p5fail.js";
    document.getElementById("s3").href.baseVal = "resources/script-set-href-p3pass.js";
    document.getElementById("s4").href.baseVal = "resources/script-set-href-p4pass.js";
    document.getElementById("s6").setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", "resources/script-set-href-p6pass.js");

    var e1 = document.createElementNS("http://www.w3.org/2000/svg", "svg:script");
    e1.type.baseVal = "text/javascript";
    e1.href.baseVal = "resources/script-set-href-p7pass.js";
    document.getElementsByTagName("defs")[0].appendChild(e1);
    
    var e2 = document.createElementNS("http://www.w3.org/2000/svg", "svg:script");
    e2.type.baseVal = "text/javascript";
    document.getElementsByTagName("defs")[0].appendChild(e2);
    e2.href.baseVal = "resources/script-set-href-p8pass.js";
    
    var e3 = document.createElementNS("http://www.w3.org/2000/svg", "svg:script");
    e3.type.baseVal = "text/javascript";
    e3.setAttribute("onload", "if (window.testRunner) setTimeout('testRunner.notifyDone()', 100)"); 
    e3.href.baseVal = "resources/script-set-href-p9failBefore.js";
    e3.href.baseVal = "resources/script-set-href-p9pass.js";
    document.getElementsByTagName("defs")[0].appendChild(e3);
    e3.href.baseVal = "resources/script-set-href-p9failAfter.js";
}
</script>
<script type="text/javascript" id="s1">
// Parser-created. Has text so it should not load upon setting href.
</script>
<script type="text/javascript" id="s2" xlink:href="resources/thisShouldNotExist.null"></script>
<script type="text/javascript" id="s5" xlink:href="resources/script-set-href-p5pass.js"></script>
<script type="text/javascript" id="s3"></script>
<script type="text/javascript" id="s4"/>
<script type="text/javascript" id="s6"></script>
</defs>
<foreignObject>
<xhtml:p>Parser-created script elements:</xhtml:p>
<xhtml:p>Already containing text: <xhtml:span id="p1">PASS</xhtml:span></xhtml:p>
<xhtml:p>Already specifying missing source: <xhtml:span id="p2">PASS</xhtml:span></xhtml:p>
<xhtml:p>Already specifying valid source: <xhtml:span id="p5">FAIL</xhtml:span></xhtml:p>
<xhtml:p>No text and no source: <xhtml:span id="p3">FAIL</xhtml:span></xhtml:p>
<xhtml:p>Self-closing &lt;script&gt; tag: <xhtml:span id="p4">FAIL</xhtml:span></xhtml:p>
<xhtml:p>Using setAttribute: <xhtml:span id="p6">FAIL</xhtml:span></xhtml:p>
<xhtml:hr/>
<xhtml:p>Dynamically-inserted script elements:</xhtml:p>
<xhtml:p>Set before insertion: <xhtml:span id="p7">FAIL</xhtml:span></xhtml:p>
<xhtml:p>Set after insertion: <xhtml:span id="p8">FAIL</xhtml:span></xhtml:p>
<xhtml:p>Set twice before and once after insertion: <xhtml:span id="p9">FAIL</xhtml:span></xhtml:p>
</foreignObject>
</svg>