access-control-basic-allow-async.any.js (661B)
1 // META: title=Testing a basic asynchronous CORS XHR request. 2 // META: script=/common/get-host-info.sub.js 3 4 async_test(function(test) { 5 const xhr = new XMLHttpRequest; 6 7 xhr.onreadystatechange = test.step_func(function() { 8 if (xhr.readyState == xhr.DONE) { 9 assert_equals(xhr.responseText, "PASS: Cross-domain access allowed."); 10 test.done(); 11 } 12 }); 13 14 xhr.onerror = test.unreached_func("FAIL: Network error."); 15 16 xhr.open("GET", get_host_info().HTTP_REMOTE_ORIGIN + 17 "/xhr/resources/access-control-basic-allow.py", true); 18 xhr.send(); 19 }, "Basic async cross-origin XHR request");