Rubber-stamped by Brady Eidson.
[webbrowser.git] / LayoutTests / security / block-test.html
blob66a7952f787dac141c2ce4dcda36f129ce6215b6
1 <html>
2 <script>
3 // Note that port "1" is tested by the initial load.
4 var blockedPorts = new Array(7, 9, 11, 13, 15, 17, 19, 20,
5 21, 22, 23, 25, 37, 42, 43, 53, 77, 79, 87, 95, 101, 102,
6 103, 104, 109, 110, 111, 113, 115, 117, 119, 123, 135, 139,
7 143, 179, 389, 465, 512, 513, 514, 515, 526, 530, 531, 532,
8 540, 556, 563, 587, 601, 636, 993, 995, 2049, 3659, 4045, 6000, 0);
10 var baseURL = "255.255.255.255";
11 var currentPort = 0;
13 if (window.layoutTestController) {
14 layoutTestController.waitUntilDone();
15 layoutTestController.dumpResourceLoadCallbacks();
18 function nextTest() {
19 if (!blockedPorts[currentPort]) {
20 ftpTest();
21 return;
23 var newURL = "http://" + baseURL + ":" + blockedPorts[currentPort] + "/test.jpg";
24 currentPort++;
25 testIMG.src = newURL;
28 function ftpTest() {
29 testIMG.setAttribute("onError", "ftp21Test();");
30 var newURL = "ftp://" + baseURL + "/test.jpg";
31 testIMG.src = newURL;
34 function ftp21Test() {
35 testIMG.setAttribute("onError", "ftp22Test();");
36 var newURL = "ftp://" + baseURL + ":21/test.jpg";
37 testIMG.src = newURL;
40 function ftp22Test() {
41 testIMG.setAttribute("onError", "finishTesting();");
42 var newURL = "ftp://" + baseURL + ":22/test.jpg";
43 testIMG.src = newURL;
46 function finishTesting() {
47 if (window.layoutTestController) {
48 layoutTestController.dumpAsText();
49 setTimeout("layoutTestController.notifyDone()", 0);
52 </script>
53 <body>
54 <p>This test attempts to change the src of an IMG tag to all black listed ports to confirm that WebKit returns the
55 correct error for them - blocked instead of cannot find. It also tries the FTP ports for exemptions. Due to the
56 nature of this test, the results can only be processed automatically via DumpRenderTree
57 </p>
58 <img id="testIMG" src="http://255.255.255.255:1/test.jpg" onError="nextTest();"></img>
59 </body>
60 </html>