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
send-conditional-cors.htm
<!doctype html>
<title>XMLHttpRequest: send() - conditional cross-origin requests</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/cors/support.js?pipe=sub></script>
<div id=log></div>
<script>
function request(withCORS, desc) {
  async_test(t => {
    const client = new XMLHttpRequest,
          identifier = Math.random(),
          cors = withCORS ? "&cors=yes" : "",
          url = CROSSDOMAIN + "resources/conditional.py?tag=" + identifier + cors
    client.onload = t.step_func(() => {
      assert_equals(client.status, 200)
      assert_equals(client.statusText, "OK")
      assert_equals(client.responseText, "MAYBE NOT")

      if(withCORS) {
        client.onload = t.step_func_done(() => {
          assert_equals(client.status, 304)
          assert_equals(client.statusText, "SUPERCOOL")
          assert_equals(client.responseText, "")
        })
      } else {
        client.onload = null
        client.onerror = t.step_func_done(() => {
          assert_equals(client.status, 0)
          assert_equals(client.statusText, "")
        })
      }
      client.open("GET", url)
      client.setRequestHeader("If-None-Match", identifier)
      client.send()
    })
    client.open("GET", url)
    client.send()
  }, desc)
}
request(false, "304 without appropriate CORS header")
request(true, "304 with appropriate CORS header")
</script>
back to top