• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 *    notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 *    notice, this list of conditions and the following disclaimer in the
11 *    documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *
25 */
26
27module threads {
28
29    interface [
30        Conditional=WORKERS,
31        CustomMarkFunction,
32        DelegatingGetOwnPropertySlot,
33        EventTarget,
34        ExtendsDOMGlobalObject,
35        IsWorkerContext,
36        LegacyParent=JSWorkerContextBase,
37        NoStaticTables,
38        OmitConstructor
39    ] WorkerContext {
40
41        // WorkerGlobalScope
42#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
43                 attribute [Replaceable] WorkerContext self;
44#endif
45                 attribute [Replaceable] WorkerLocation location;
46        void close();
47                 attribute EventListener onerror;
48
49        // WorkerUtils
50        [Custom] void importScripts(/*[Variadic] in DOMString urls */);
51                 attribute [Replaceable] WorkerNavigator navigator;
52        // Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize);
53        // DatabaseSync openDatabaseSync(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize);
54
55        // Timers
56        [Custom] long setTimeout(in TimeoutHandler handler, in long timeout);
57        // [Custom] long setTimeout(in DOMString code, in long timeout);
58        void clearTimeout(in long handle);
59        [Custom] long setInterval(in TimeoutHandler handler, in long timeout);
60        // [Custom] long setInterval(in DOMString code, in long timeout);
61        void clearInterval(in long handle);
62
63
64        // EventTarget interface
65        [Custom] void addEventListener(in DOMString type,
66                                       in EventListener listener,
67                                       in boolean useCapture);
68        [Custom] void removeEventListener(in DOMString type,
69                                          in EventListener listener,
70                                          in boolean useCapture);
71        boolean dispatchEvent(in Event evt)
72            raises(EventException);
73
74#if defined(ENABLE_NOTIFICATIONS) && ENABLE_NOTIFICATIONS
75        // Notification interface
76        readonly attribute [EnabledAtRuntime] NotificationCenter webkitNotifications;
77#endif
78
79        // Constructors
80        attribute MessageEventConstructor MessageEvent;
81        attribute WorkerLocationConstructor WorkerLocation;
82
83#if ENABLE_CHANNEL_MESSAGING
84        attribute [JSCCustomGetter] MessageChannelConstructor MessageChannel;
85#endif
86#if ENABLE_EVENTSOURCE
87        attribute [JSCCustomGetter] EventSourceConstructor EventSource;
88#endif
89        attribute [JSCCustomGetter] XMLHttpRequestConstructor XMLHttpRequest;
90#if defined(ENABLE_WEB_SOCKETS) && ENABLE_WEB_SOCKETS
91        attribute [JSCCustomGetter,EnabledAtRuntime] WebSocketConstructor WebSocket; // Usable with the new operator
92#endif
93    };
94
95}
96