eventsource-constructor-non-same-origin.window.js (801B)
1 // META: title=EventSource: constructor (act as if there is a network error) 2 3 function fetchFail(url) { 4 var test = async_test(document.title + " (" + url + ")") 5 test.step(function() { 6 var source = new EventSource(url) 7 source.onerror = function(e) { 8 test.step(function() { 9 assert_equals(source.readyState, source.CLOSED) 10 assert_false(e.hasOwnProperty('data')) 11 }) 12 test.done() 13 } 14 }) 15 } 16 fetchFail("ftp://example.not/") 17 fetchFail("about:blank") 18 fetchFail("mailto:whatwg@awesome.example") 19 fetchFail("javascript:alert('FAIL')") 20 // This tests "fails the connection" as well as making sure a simple 21 // event is dispatched and not a MessageEvent