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 27 module 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 #if defined(ENABLE_DATABASE) && ENABLE_DATABASE 53 [EnabledAtRuntime, RequiresAllArguments=Raise] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in [Callback, Optional] DatabaseCallback creationCallback) 54 raises(DOMException); 55 [EnabledAtRuntime, RequiresAllArguments=Raise] DatabaseSync openDatabaseSync(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in [Callback, Optional] DatabaseCallback creationCallback) 56 raises(DOMException); 57 #endif 58 59 // Timers 60 [Custom] long setTimeout(in TimeoutHandler handler, in long timeout); 61 // [Custom] long setTimeout(in DOMString code, in long timeout); 62 void clearTimeout(in long handle); 63 [Custom] long setInterval(in TimeoutHandler handler, in long timeout); 64 // [Custom] long setInterval(in DOMString code, in long timeout); 65 void clearInterval(in long handle); 66 67 68 // EventTarget interface 69 void addEventListener(in DOMString type, 70 in EventListener listener, 71 in boolean useCapture); 72 void removeEventListener(in DOMString type, 73 in EventListener listener, 74 in boolean useCapture); 75 boolean dispatchEvent(in Event evt) 76 raises(EventException); 77 78 #if defined(ENABLE_NOTIFICATIONS) && ENABLE_NOTIFICATIONS 79 // Notification interface 80 readonly attribute [EnabledAtRuntime] NotificationCenter webkitNotifications; 81 #endif 82 83 #if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP 84 // Constructors 85 attribute MessageEventConstructor MessageEvent; 86 attribute WorkerLocationConstructor WorkerLocation; 87 88 #if ENABLE_CHANNEL_MESSAGING 89 attribute [JSCCustomGetter] MessageChannelConstructor MessageChannel; 90 #endif 91 #if ENABLE_EVENTSOURCE 92 attribute [JSCCustomGetter] EventSourceConstructor EventSource; 93 #endif 94 attribute [JSCCustomGetter] XMLHttpRequestConstructor XMLHttpRequest; 95 #if defined(ENABLE_WEB_SOCKETS) && ENABLE_WEB_SOCKETS 96 attribute [JSCCustomGetter,EnabledAtRuntime] WebSocketConstructor WebSocket; // Usable with the new operator 97 #endif 98 #endif 99 100 #if defined(ENABLE_BLOB) && ENABLE_BLOB 101 attribute WebKitBlobBuilderConstructor WebKitBlobBuilder; 102 attribute FileReaderConstructor FileReader; 103 attribute FileReaderSyncConstructor FileReaderSync; 104 #endif 105 106 readonly attribute [Conditional=BLOB] DOMURL webkitURL; 107 108 #if defined(ENABLE_FILE_SYSTEM) && ENABLE_FILE_SYSTEM 109 const unsigned short TEMPORARY = 0; 110 const unsigned short PERSISTENT = 1; 111 [EnabledAtRuntime=FileSystem] void webkitRequestFileSystem(in unsigned short type, in long long size, in [Callback, Optional] FileSystemCallback successCallback, in [Callback, Optional] ErrorCallback errorCallback); 112 [EnabledAtRuntime=FileSystem] DOMFileSystemSync webkitRequestFileSystemSync(in unsigned short type, in long long size) raises (FileException); 113 [EnabledAtRuntime=FileSystem] void webkitResolveLocalFileSystemURL(in DOMString url, in [Callback, Optional] EntryCallback successCallback, in [Callback, Optional] ErrorCallback errorCallback); 114 [EnabledAtRuntime=FileSystem] EntrySync webkitResolveLocalFileSystemSyncURL(in DOMString url) raises (FileException); 115 116 attribute [EnabledAtRuntime=FileSystem] WebKitFlagsConstructor WebKitFlags; 117 attribute [EnabledAtRuntime=FileSystem] FileErrorConstructor FileError; 118 attribute [EnabledAtRuntime=FileSystem] FileExceptionConstructor FileException; 119 #endif 120 121 attribute ArrayBufferConstructor ArrayBuffer; // Usable with new operator 122 attribute Int8ArrayConstructor Int8Array; // Usable with new operator 123 attribute Uint8ArrayConstructor Uint8Array; // Usable with new operator 124 attribute Int16ArrayConstructor Int16Array; // Usable with new operator 125 attribute Uint16ArrayConstructor Uint16Array; // Usable with new operator 126 attribute Int32ArrayConstructor Int32Array; // Usable with new operator 127 attribute Uint32ArrayConstructor Uint32Array; // Usable with new operator 128 attribute Float32ArrayConstructor Float32Array; // Usable with new operator 129 attribute Float64ArrayConstructor Float64Array; // Usable with new operator 130 }; 131 132 } 133