ec3427045e7b5e7d3a6a80f38f63c1634412a161
[WebKit.git] / LayoutTests / fast / replaced / object-with-embed-url-param.html
1 <html>
2     <head>
3         <script>
4             if (window.layoutTestController) {
5                 layoutTestController.dumpAsText();
6                 layoutTestController.waitUntilDone();
7             }
8
9             var object1Result = "";
10             var object2Result = "";
11             var embed3Result = "";
12
13             document.addEventListener("beforeload", function(event) {
14
15                 if (event.url == "")
16                     return;
17  
18                 if (event.target.id == "object1") {
19                     object1Result = (event.url == "object-attr" ? "does" : "does not");
20                 } else if (event.target.id == "object2") {
21                     object2Result = (event.url == "object-param" ? "does" : "does not");
22                 } else if (event.target.id == "embed3") {
23                     embed3Result = (event.url == "embed-attr" ? "does" : "does not");
24                 }
25
26                 if (object1Result != "" && object2Result != "" && embed3Result != "") {
27                     debug("An &lt;object&gt; with a 'data' @attr and a 'src' &lt;param&gt; should load the URL from the 'data' @attr and " + object1Result + ".");
28                     debug("An &lt;object&gt; with a 'src' &lt;param&gt; should load the URL from the 'src' &lt;param&gt; and " + object2Result + ".");
29                     debug("An &lt;object&gt; with no URL specified and a nested &lt;embed&gt; should load the URL from the 'src' @attr of the &lt;embed&gt; and " + embed3Result + ".");
30                     if (window.layoutTestController)
31                         layoutTestController.notifyDone();
32                 }
33             }, true);
34
35             function debug(str) {
36                 document.getElementById('console').innerHTML += str + "<br>";
37             }
38         </script>
39     </head>
40     <body>
41         <object id="object1" type="application/x-webkit-test-netscape" data="object-attr">
42             <param id="param1" name="src" value="object-param"></param>
43             <embed id="embed1" type="application/x-webkit-test-netscape" src="embed-attr">
44         </object>
45         <object id="object2" type="application/x-webkit-test-netscape">
46             <param id="param2" name="movie" value="object-param"></param>
47             <embed id="embed2" type="application/x-webkit-test-netscape" src="embed-attr">
48         </object>
49         <object id="object3">
50             <embed id="embed3" type="application/x-webkit-test-netscape" src="embed-attr">
51         </object>
52         <p>This test verifies that the right URL is loaded when there is an &lt;object&gt; with a 'src' &lt;param&gt; and a fallback &lt;embed&gt;.</p>
53         <div id="console"></div>
54     </body>
55 </html>