| <html> | |
| <script> | |
| // Note that port "1" is tested by the initial load. | |
| var blockedPorts = [7, 9, 11, 13, 15, 17, 19, 20, | |
| 21, 22, 23, 25, 37, 42, 43, 53, 77, 79, 87, 95, 101, 102, | |
| 103, 104, 109, 110, 111, 113, 115, 117, 119, 123, 135, 139, | |
| 143, 179, 389, 465, 512, 513, 514, 515, 526, 530, 531, 532, | |
| 540, 556, 563, 587, 601, 636, 993, 995, 2049, 3659, 4045, | |
| 6000, 6665, 6666, 6667, 6668, 6669, | |
| // Port numbers that we consider to be invalid due to being out of range. | |
| Math.pow(2, 16) - 1, Math.pow(2, 16), Math.pow(2, 32) - 1, Math.pow(2, 32)]; | |
| var allowedPorts = [0, 80, ""]; | |
| var baseURL = "255.255.255.255"; | |
| var currentPort = 0; | |
| if (window.testRunner) { | |
| testRunner.waitUntilDone(); | |
| testRunner.dumpResourceLoadCallbacks(); | |
| } | |
| function nextBlockedPortTest() { | |
| if (!(currentPort in blockedPorts)) { | |
| currentPort = 0; | |
| nextAllowedPortTest(); | |
| return; | |
| } | |
| var newURL = "http://" + baseURL + ":" + blockedPorts[currentPort] + "/test.jpg"; | |
| currentPort++; | |
| testIMG.src = newURL; | |
| } | |
| function nextAllowedPortTest() { | |
| if (!(currentPort in allowedPorts)) { | |
| ftpTest(); | |
| return; | |
| } | |
| var newURL = "http://" + baseURL + ":" + allowedPorts[currentPort] + "/test.jpg"; | |
| currentPort++; | |
| testIMG.setAttribute("onError", "nextAllowedPortTest();"); | |
| testIMG.src = newURL; | |
| } | |
| function ftpTest() { | |
| testIMG.setAttribute("onError", "ftp21Test();"); | |
| var newURL = "ftp://" + baseURL + "/test.jpg"; | |
| testIMG.src = newURL; | |
| } | |
| function ftp21Test() { | |
| testIMG.setAttribute("onError", "ftp22Test();"); | |
| var newURL = "ftp://" + baseURL + ":21/test.jpg"; | |
| testIMG.src = newURL; | |
| } | |
| function ftp22Test() { | |
| testIMG.setAttribute("onError", "finishTesting();"); | |
| var newURL = "ftp://" + baseURL + ":22/test.jpg"; | |
| testIMG.src = newURL; | |
| } | |
| function finishTesting() { | |
| if (window.testRunner) { | |
| testRunner.dumpAsText(); | |
| setTimeout("testRunner.notifyDone()", 0); | |
| } | |
| } | |
| </script> | |
| <body> | |
| <p>This test attempts to change the src of an IMG tag to all black listed ports to confirm that WebKit returns the | |
| correct error for them - blocked instead of cannot find. It also tries the FTP ports for exemptions. Due to the | |
| nature of this test, the results can only be processed automatically via DumpRenderTree | |
| </p> | |
| <img id="testIMG" src="http://255.255.255.255:1/test.jpg" onError="nextBlockedPortTest();"></img> | |
| </body> | |
| </html> |