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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <head>
michael@0 4 <title>Media test: document-element-inserted</title>
michael@0 5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 6 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
michael@0 7 </head>
michael@0 8 <body>
michael@0 9 <iframe id = 'media'>
michael@0 10 </iframe>
michael@0 11 <pre id="test">
michael@0 12 <script class="testbody" type="text/javascript">
michael@0 13
michael@0 14 if (navigator.platform.startsWith("Win")) {
michael@0 15 SimpleTest.expectAssertions(0, 4);
michael@0 16 }
michael@0 17
michael@0 18 SimpleTest.waitForExplicitFinish();
michael@0 19 var loc;
michael@0 20
michael@0 21 var observe = function(doc){
michael@0 22 if (doc == media.contentDocument) {
michael@0 23 ok(media.contentDocument.location.toString().indexOf(loc) != -1,
michael@0 24 "The loaded media should be " + loc);
michael@0 25 next();
michael@0 26 }
michael@0 27 }
michael@0 28
michael@0 29 var media = document.getElementById('media');
michael@0 30 var tests = [
michael@0 31 "../../../media/test/short-video.ogv",
michael@0 32 "../../../media/test/sound.ogg",
michael@0 33 "../../content/test/image.png"
michael@0 34 ]
michael@0 35
michael@0 36 function next() {
michael@0 37 if (tests.length > 0) {
michael@0 38 var t = tests.shift();
michael@0 39 loc = t.substring(t.indexOf("test"));
michael@0 40 media.setAttribute("src",t);
michael@0 41 }
michael@0 42 else {
michael@0 43 SpecialPowers.removeObserver(observe, "document-element-inserted");
michael@0 44 SimpleTest.finish();
michael@0 45 }
michael@0 46 }
michael@0 47
michael@0 48 SpecialPowers.addObserver(observe, "document-element-inserted", false)
michael@0 49 next();
michael@0 50
michael@0 51 </script>
michael@0 52 </pre>
michael@0 53 </body>
michael@0 54 </html>

mercurial