https://github.com/web-platform-tests/wpt
Raw File
Tip revision: dfc6293bd278f46fb6963950157a4f19b281dca4 authored by Ms2ger on 14 March 2018, 16:45:25 UTC
Fix a link to the README in the documentation.
Tip revision: dfc6293
interfaces.html
<!doctype html>
<title>EventSource IDL tests</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/resources/WebIDLParser.js></script>
<script src=/resources/idlharness.js></script>

<h1>EventSource IDL tests</h1>
<div id=log></div>

<script type=text/plain>
[Constructor(), Exposed=(Window,Worker)]
interface EventTarget {
  void addEventListener(DOMString type, EventListener? listener, optional (AddEventListenerOptions or boolean) options);
  void removeEventListener(DOMString type, EventListener? listener, optional (EventListenerOptions or boolean) options);
  boolean dispatchEvent(Event event);
};
callback interface EventListener {
  void handleEvent(Event event);
};
dictionary EventListenerOptions {
  boolean capture = false;
};
dictionary AddEventListenerOptions : EventListenerOptions {
  boolean passive = false;
  boolean once = false;
};
[Constructor(DOMString url, optional EventSourceInit eventSourceInitDict)]
interface EventSource : EventTarget {
  readonly attribute DOMString url;
  readonly attribute boolean withCredentials;

  // ready state
  const unsigned short CONNECTING = 0;
  const unsigned short OPEN = 1;
  const unsigned short CLOSED = 2;
  readonly attribute unsigned short readyState;

  // networking
           attribute EventHandler onopen;
           attribute EventHandler onmessage;
           attribute EventHandler onerror;
  void close();
};

dictionary EventSourceInit {
  boolean withCredentials = false;
};

[TreatNonCallableAsNull]
callback EventHandlerNonNull = any (Event event);
typedef EventHandlerNonNull? EventHandler;
</script>
<script>
"use strict";
var idlArray;
setup(function() {
  idlArray = new IdlArray();
  [].forEach.call(document.querySelectorAll("script[type=text\\/plain]"), function(node) {
    if (node.className == "untested") {
      idlArray.add_untested_idls(node.textContent);
    } else {
      idlArray.add_idls(node.textContent);
    }
  });
}, {explicit_done:true});
window.onload = function() {
  idlArray.add_objects({
    EventSource: ['new EventSource("http://foo")'],
  });
  idlArray.test();
  done();
};
</script>
back to top