blob: 8c3cc90b6514d688eb43c9cf08e4d40ad3d1983e [file] [log] [blame]
Michael[tm] Smith1f66bf62014-05-26 07:50:191<!doctype html>
2<title>EventSource IDL tests</title>
3<script src=/resources/testharness.js></script>
4<script src=/resources/testharnessreport.js></script>
5<script src=/resources/WebIDLParser.js></script>
6<script src=/resources/idlharness.js></script>
7
8<h1>EventSource IDL tests</h1>
9<div id=log></div>
10
11<script type=text/plain>
12[Constructor(DOMString url, optional EventSourceInit eventSourceInitDict)]
13interface EventSource : EventTarget {
14 readonly attribute DOMString url;
15 readonly attribute boolean withCredentials;
16
17 // ready state
18 const unsigned short CONNECTING = 0;
19 const unsigned short OPEN = 1;
20 const unsigned short CLOSED = 2;
21 readonly attribute unsigned short readyState;
22
23 // networking
24 attribute EventHandler onopen;
25 attribute EventHandler onmessage;
26 attribute EventHandler onerror;
27 void close();
28};
29
30dictionary EventSourceInit {
31 boolean withCredentials = false;
32};
33
34[TreatNonCallableAsNull]
35callback EventHandlerNonNull = any (Event event);
36typedef EventHandlerNonNull? EventHandler;
37</script>
38<script>
39"use strict";
40var idlArray;
41setup(function() {
Ms2ger53321dc2015-05-18 08:31:4442 idlArray = new IdlArray();
43 [].forEach.call(document.querySelectorAll("script[type=text\\/plain]"), function(node) {
44 if (node.className == "untested") {
45 idlArray.add_untested_idls(node.textContent);
46 } else {
47 idlArray.add_idls(node.textContent);
48 }
49 });
Michael[tm] Smith1f66bf62014-05-26 07:50:1950}, {explicit_done:true});
51window.onload = function() {
Ms2ger53321dc2015-05-18 08:31:4452 idlArray.add_objects({
53 EventSource: ['new EventSource("http://foo")'],
54 });
55 idlArray.test();
56 done();
Michael[tm] Smith1f66bf62014-05-26 07:50:1957};
58</script>