WebKitTools:
[WebKit-https.git] / LayoutTests / fast / loader / local-JavaScript-from-local.html
1 <html>
2 <head>
3 <script>
4     var secretness = 0;
5
6     function test() {
7         if (window.layoutTestController)
8             layoutTestController.dumpAsText();
9
10         var localScriptLocation = "file:///tmp/LayoutTests/http/tests/security/resources/localScript.js";
11         if (window.layoutTestController)
12             localScriptLocation = layoutTestController.pathToLocalResource(localScriptLocation);
13
14         var localScriptElement = document.createElement("script");
15         localScriptElement.setAttribute("src", localScriptLocation);
16         localScriptElement.addEventListener("load", function() {
17             var tag = document.getElementById("result");
18             if (secretness == 13)
19                 tag.innerHTML = "Test Passed. Local script loaded and run.";
20             else
21                 tag.innerHTML = "Test Failed. Local script loaded, but not successfully run.";
22         });
23         localScriptElement.addEventListener("error", function() {
24             var tag = document.getElementById("result");
25             tag.innerHTML = "Test Failed: Local script not loaded.";
26         });
27
28         document.body.appendChild(localScriptElement)
29     }
30 </script>
31 </head>
32 <body onload="test()">
33     <div id="div0">
34         This test is to see if a local file can run a local script.
35         <br/>
36         Currently this test cannot be run manually on Windows because we do not have
37         a function like pathToLocalResource() outside of DRT.
38         <br/>
39     </div>
40     </br>
41     <div id="result">
42         Test not run correctly.
43     </div>
44 </body>
45 </html>