request-redirect.window.js (767B)
1 // META: title=EventSource: redirect 2 function redirectTest(status) { 3 var test = async_test(document.title + " (" + status +")") 4 test.step(function() { 5 var source = new EventSource("/common/redirect.py?location=/eventsource/resources/message.py&status=" + status) 6 source.onopen = function() { 7 test.step(function() { 8 assert_equals(this.readyState, this.OPEN) 9 this.close() 10 }, this) 11 test.done() 12 } 13 source.onerror = function() { 14 test.step(function() { assert_unreached() }) 15 test.done() 16 } 17 }) 18 } 19 20 redirectTest("301") 21 redirectTest("302") 22 redirectTest("303") 23 redirectTest("307")