https://github.com/web-platform-tests/wpt
Revision 6abf7227e4de6116d16df1c1be1447cb5f4881d0 authored by moz-wptsync-bot on 14 March 2018, 18:16:20 UTC, committed by moz-wptsync-bot on 14 March 2018, 19:24:59 UTC
bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1445509
gecko-commit: 870ccf04f6aab961a02549c9dbe144c5c1d7d072
gecko-integration-branch: central
gecko-reviewers: bz
1 parent e4b9ecc
Raw File
Tip revision: 6abf7227e4de6116d16df1c1be1447cb5f4881d0 authored by moz-wptsync-bot on 14 March 2018, 18:16:20 UTC
Correctly compare height in open-features-non-integer-height.html test.
Tip revision: 6abf722
data-uri.htm
<!doctype html>
<meta charset=utf-8>
<title>XMLHttpRequest: data URLs</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>

<script>
  function do_test(method, url, mimeType, testNamePostfix) {
    if (typeof mimeType === 'undefined' || mimeType === null) mimeType = 'text/plain';
    var test = async_test("XHR method " + method + " with MIME type " + mimeType + (testNamePostfix||''));
    test.step(function() {
      var client = new XMLHttpRequest(),
          body = method === "HEAD" ? "" : "Hello, World!";
      client.onreadystatechange = test.step_func(function () {
        if (client.readyState !== 4) {
          return;
        }
        assert_equals(client.responseText, body);
        assert_equals(client.status, 200);
        assert_equals(client.getResponseHeader('Content-Type'), mimeType);
        var allHeaders = client.getAllResponseHeaders();
        assert_regexp_match(allHeaders, /content\-type\:/i, 'getAllResponseHeaders() includes Content-Type');
        assert_false(/content\-length\:/i.test(allHeaders), 'getAllResponseHeaders() must not include Content-Length');
        test.done();
      });
      client.open(method, url);
      client.send(null);
    });
  }
  do_test('GET', "data:text/plain,Hello, World!");
  do_test('GET', "data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==", undefined, " (base64)");
  do_test('GET', "data:text/html,Hello, World!", 'text/html');
  do_test('GET', "data:text/html;charset=UTF-8,Hello, World!", 'text/html;charset=UTF-8');
  do_test('GET', "data:image/png,Hello, World!", 'image/png');
  do_test('POST', "data:text/plain,Hello, World!");
  do_test('PUT', "data:text/plain,Hello, World!");
  do_test('DELETE', "data:text/plain,Hello, World!");
  do_test('HEAD', "data:text/plain,Hello, World!");
  do_test('UNICORN', "data:text/plain,Hello, World!");
</script>
back to top