https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 899931dc1b89f5fd468548cd7dd25303ba0bcda3 authored by Bon-Yong Lee on 12 April 2014, 06:47:42 UTC
Test that the attached callback is only called in a browsing context.
Tip revision: 899931d
request-accept.htm
<!DOCTYPE html>
<html>
  <head>
    <title>EventSource: Accept header</title>
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
  </head>
  <body>
    <div id="log"></div>
    <script>
      var test = async_test()
      test.step(function() {
        var source = new EventSource("resources/accept.event_stream?pipe=sub")
        source.onmessage = function(e) {
          test.step(function() {
            assert_equals(e.data, "text/event-stream")
            this.close()
          }, this)
          test.done()
        }
      })
    </script>
  </body>
</html>

back to top