request-cache-control.any.js (1212B)
1 // META: title=EventSource: Cache-Control 2 var crossdomain = location.href 3 .replace('://', '://www2.') 4 .replace(/\/[^\/]*$/, '/') 5 6 // running it twice to check whether it stays consistent 7 function cacheTest(url) { 8 var test = async_test(url + "1") 9 // Recursive test. This avoids test that timeout 10 var test2 = async_test(url + "2") 11 test.step(function() { 12 var source = new EventSource(url) 13 source.onmessage = function(e) { 14 test.step(function() { 15 assert_equals(e.data, "no-cache") 16 this.close() 17 test2.step(function() { 18 var source2 = new EventSource(url) 19 source2.onmessage = function(e) { 20 test2.step(function() { 21 assert_equals(e.data, "no-cache") 22 this.close() 23 }, this) 24 test2.done() 25 } 26 }) 27 }, this) 28 test.done() 29 } 30 }) 31 } 32 33 cacheTest("resources/cache-control.event_stream?pipe=sub") 34 cacheTest(crossdomain + "resources/cors.py?run=cache-control")