| <body> |
| <pre id=preOnerror>FAIL: onerror was not called.</pre> |
| <pre id=console></pre> |
| <script> |
| if (window.testRunner) |
| testRunner.dumpAsText(); |
| |
| function log(message) |
| { |
| document.getElementById('console').appendChild(document.createTextNode(message + '\n')); |
| } |
| |
| var hadError = false; |
| function error(message) |
| { |
| hadError = true; |
| log("FAIL: " + message); |
| } |
| |
| function checkResponse() |
| { |
| try { |
| document.body.removeChild(document.getElementById('preOnerror')); |
| |
| if (req.responseText.length) |
| error("responseText is not empty"); |
| if (req.responseXML) |
| error("responseXML is not null"); |
| try { |
| if (req.status) |
| error("status is not zero: " + req.status); |
| } catch (ex) { |
| } |
| try { |
| if (req.statusText) |
| error("statusText is not empty: " + req.statusText); |
| } catch (ex) { |
| } |
| try { |
| if (req.getAllResponseHeaders().length) |
| error("getAllResponseHeaders() result is not empty: " + req.getAllResponseHeaders()); |
| } catch (ex) { |
| } |
| |
| if (!hadError) |
| log("PASS"); |
| } catch (ex) { |
| log(ex); |
| } |
| } |
| |
| var req = new XMLHttpRequest; |
| req.open("GET", "http://localhost:8000/xmlhttprequest/resources/reply.xml", false); |
| try { |
| req.send(null); |
| error("send did not raise an exception"); |
| } catch (ex) { |
| checkResponse(); |
| } |
| </script> |
| </body> |