testing/web-platform/mozilla/tests/service-workers/service-worker/resources/invalid-blobtype-iframe.https.html
author James Graham <james@hoppipolla.co.uk>
Thu, 25 Jun 2015 16:10:50 -0700
changeset 250330 a03152790896f9304cf6b79e48de91cc0388cc64
child 268115 01dd15e9d65895469dd87a4b7c4699a34384e20e
permissions -rw-r--r--
Bug 1120505 - Add Blink service-worker tests to local wpt tests, rs=Ms2ger

<script src="/resources/testharness.js"></script>
<script src="test-helpers.sub.js?pipe=sub"></script>
<script>

function xhr_send(method, data) {
  return new Promise(function(resolve, reject) {
      var xhr = new XMLHttpRequest();
      xhr.onload = function() {
        if (xhr.getResponseHeader('Content-Type') !== null) {
          reject('Content-Type must be null.');
        }
        resolve();
      };
      xhr.onerror = function() {
        reject('XHR must succeed.');
      };
      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>