content/html/document/test/test_document-element-inserted.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/html/document/test/test_document-element-inserted.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,54 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<head>
     1.7 +  <title>Media test: document-element-inserted</title>
     1.8 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     1.9 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.10 +</head>
    1.11 +<body>
    1.12 +<iframe id = 'media'>
    1.13 +</iframe>
    1.14 +<pre id="test">
    1.15 +<script class="testbody" type="text/javascript">
    1.16 +
    1.17 +if (navigator.platform.startsWith("Win")) {
    1.18 +  SimpleTest.expectAssertions(0, 4);
    1.19 +}
    1.20 +
    1.21 +SimpleTest.waitForExplicitFinish();
    1.22 +var loc;
    1.23 +
    1.24 +var observe = function(doc){
    1.25 +    if (doc == media.contentDocument) {
    1.26 +        ok(media.contentDocument.location.toString().indexOf(loc) != -1,
    1.27 +          "The loaded media should be " + loc);
    1.28 +        next();
    1.29 +    }
    1.30 +}
    1.31 +
    1.32 +var media = document.getElementById('media');
    1.33 +var tests = [
    1.34 +    "../../../media/test/short-video.ogv",
    1.35 +    "../../../media/test/sound.ogg",
    1.36 +    "../../content/test/image.png"
    1.37 +]
    1.38 +
    1.39 +function next() {
    1.40 +    if (tests.length > 0) {
    1.41 +        var t = tests.shift();
    1.42 +        loc = t.substring(t.indexOf("test"));
    1.43 +        media.setAttribute("src",t);
    1.44 +    }
    1.45 +    else {
    1.46 +        SpecialPowers.removeObserver(observe, "document-element-inserted");
    1.47 +        SimpleTest.finish();
    1.48 +    }
    1.49 +}
    1.50 +
    1.51 +SpecialPowers.addObserver(observe, "document-element-inserted", false)
    1.52 +next();
    1.53 +
    1.54 +</script>
    1.55 +</pre>
    1.56 +</body>
    1.57 +</html>

mercurial