blob: 2935927fd325f1de6624136e79e311138ad5dce9 [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>
Rakina Zata Amni56e2df82017-11-10 07:33:3612[Constructor(), Exposed=(Window,Worker)]
Keith Yeung4b9f9ac2017-01-30 20:09:2213interface EventTarget {
14 void addEventListener(DOMString type, EventListener? listener, optional (AddEventListenerOptions or boolean) options);
15 void removeEventListener(DOMString type, EventListener? listener, optional (EventListenerOptions or boolean) options);
16 boolean dispatchEvent(Event event);
17};
18callback interface EventListener {
19 void handleEvent(Event event);
20};
21dictionary EventListenerOptions {
22 boolean capture = false;
23};
24dictionary AddEventListenerOptions : EventListenerOptions {
25 boolean passive = false;
26 boolean once = false;
27};
Michael[tm] Smith1f66bf62014-05-26 07:50:1928[Constructor(DOMString url, optional EventSourceInit eventSourceInitDict)]
29interface EventSource : EventTarget {
30 readonly attribute DOMString url;
31 readonly attribute boolean withCredentials;
32
33 // ready state
34 const unsigned short CONNECTING = 0;
35 const unsigned short OPEN = 1;
36 const unsigned short CLOSED = 2;
37 readonly attribute unsigned short readyState;
38
39 // networking
40 attribute EventHandler onopen;
41 attribute EventHandler onmessage;
42 attribute EventHandler onerror;
43 void close();
44};
45
46dictionary EventSourceInit {
47 boolean withCredentials = false;
48};
49
50[TreatNonCallableAsNull]
51callback EventHandlerNonNull = any (Event event);
52typedef EventHandlerNonNull? EventHandler;
53</script>
54<script>
55"use strict";
56var idlArray;
57setup(function() {
Ms2ger53321dc2015-05-18 08:31:4458 idlArray = new IdlArray();
59 [].forEach.call(document.querySelectorAll("script[type=text\\/plain]"), function(node) {
60 if (node.className == "untested") {
61 idlArray.add_untested_idls(node.textContent);
62 } else {
63 idlArray.add_idls(node.textContent);
64 }
65 });
Michael[tm] Smith1f66bf62014-05-26 07:50:1966}, {explicit_done:true});
67window.onload = function() {
Ms2ger53321dc2015-05-18 08:31:4468 idlArray.add_objects({
69 EventSource: ['new EventSource("http://foo")'],
70 });
71 idlArray.test();
72 done();
Michael[tm] Smith1f66bf62014-05-26 07:50:1973};
74</script>