blob: 4513537502ba486e0dd87adea09653499444d930 [file] [log] [blame]
<script src="../../resources/testharness.js"></script>
<script src="test-helpers.js"></script>
<script>
function xhr_send(method, data) {
return new Promise(function(resolve, reject) {
var xhr = new XMLHttpRequest();
xhr.onload = function() {
reject('XHR must fail.');
};
xhr.onerror = function() {
resolve();
};
xhr.responseType = 'text';
xhr.open(method, './dummy?test', true);
xhr.send(data);
});
}
window.addEventListener('message', function(evt) {
var port = evt.ports[0];
xhr_send('POST', 'test string')
.then(function() { port.postMessage({results: 'finish'}); })
.catch(function(e) { port.postMessage({results: 'failure:' + e}); });
});
</script>