Changeset 48137 in webkit
- Timestamp:
- Sep 7, 2009 3:23:46 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 5 deleted
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r48131 r48137 1 2009-09-07 Drew Wilson <atwilson@google.com> 2 3 Reverting r48121 to fix Windows build errors. 4 5 * JavaScriptCore.exp: 6 1 7 2009-09-07 Drew Wilson <atwilson@google.com> 2 8 -
trunk/JavaScriptCore/JavaScriptCore.exp
r48121 r48137 295 295 __ZN3WTF12randomNumberEv 296 296 __ZN3WTF13currentThreadEv 297 __ZN3WTF13tryFastMallocEm298 297 __ZN3WTF13tryFastCallocEmm 299 298 __ZN3WTF13tryFastMallocEm -
trunk/LayoutTests/ChangeLog
r48131 r48137 1 2009-09-07 Drew Wilson <atwilson@google.com> 2 3 Unreviewed build fix. 4 5 Reverting r48121 to fix Windows build errors. 6 7 * fast/dom/Window/window-properties-expected.txt: 8 * fast/dom/prototype-inheritance-2-expected.txt: 9 * fast/dom/prototype-inheritance-expected.txt: 10 * fast/js/global-constructors-expected.txt: 11 1 12 2009-09-07 Drew Wilson <atwilson@google.com> 2 13 … … 64 75 2009-09-07 Andras Becsi <becsi.andras@stud.u-szeged.hu> 65 76 66 Reviewed by Tor Arne Vestb ø77 Reviewed by Tor Arne Vestbø 67 78 68 79 [Qt] Disable a few tests that require missing controller features … … 222 233 * fast/dom/DOMImplementation/detached-doctype.html: Added. 223 234 224 2009-09-04 Tor Arne Vestb ø<tor.arne.vestbo@nokia.com>235 2009-09-04 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> 225 236 226 237 Rubber-stamped by Simon Hausmann. … … 230 241 * platform/qt/Skipped: 231 242 232 2009-09-04 Tor Arne Vestb ø<tor.arne.vestbo@nokia.com>243 2009-09-04 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> 233 244 234 245 Rubber-stamped by Simon Hausmann. … … 494 505 * platform/qt/css2.1/t1202-counters-18-f-expected.txt: 495 506 496 2009-09-03 Tor Arne Vestb ø<tor.arne.vestbo@nokia.com>507 2009-09-03 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> 497 508 498 509 Rubber-stamped by Ariya Hidayat. … … 506 517 * platform/qt/Skipped: 507 518 508 2009-09-03 Tor Arne Vestb ø<tor.arne.vestbo@nokia.com>519 2009-09-03 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> 509 520 510 521 Reviewed by Ariya Hidayat. … … 514 525 * platform/qt/Skipped: 515 526 516 2009-09-03 Tor Arne Vestb ø<tor.arne.vestbo@nokia.com>527 2009-09-03 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> 517 528 518 529 Rubber-stamped by Simon Hausmann. … … 620 631 * storage/execute-sql-args.html: 621 632 622 2009-09-01 Tor Arne Vestb ø<tor.arne.vestbo@nokia.com>633 2009-09-01 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> 623 634 624 635 Rubber-stamped by Simon Hausmann. … … 3596 3607 2009-08-14 Ariya Hidayat <ariya.hidayat@nokia.com> 3597 3608 3598 Rubber-stamped by Tor Arne Vestb ø.3609 Rubber-stamped by Tor Arne Vestbø. 3599 3610 3600 3611 [Qt] Add test result after r47255. … … 3605 3616 2009-08-14 Ariya Hidayat <ariya.hidayat@nokia.com> 3606 3617 3607 Reviewed by Tor Arne Vestb ø.3618 Reviewed by Tor Arne Vestbø. 3608 3619 3609 3620 [Qt] Update test result after r47255. … … 5410 5421 2009-08-04 Ariya Hidayat <ariya.hidayat@nokia.com> 5411 5422 5412 Reviewed by Tor Arne Vestb ø.5423 Reviewed by Tor Arne Vestbø. 5413 5424 5414 5425 [Qt] Add pixel tests result. … … 6985 6996 2009-07-23 Simon Hausmann <simon.hausmann@nokia.com> 6986 6997 6987 Reviewed by Tor Arne Vestb ø.6998 Reviewed by Tor Arne Vestbø. 6988 6999 6989 7000 Rebaseline the Qt results for computed-style.html and … … 7217 7228 2009-07-21 Simon Hausmann <simon.hausmann@nokia.com> 7218 7229 7219 Reviewed by Tor Arne Vestb ø.7230 Reviewed by Tor Arne Vestbø. 7220 7231 7221 7232 Skip fast/loader/non-html-load-event.html for the Qt DRT as it requires … … 7860 7871 * fast/js/resources/instanceof-operator.js: Added. 7861 7872 7862 2009-07-15 Kai Br ning <kai@granus.net>7873 2009-07-15 Kai BrÂning <kai@granus.net> 7863 7874 7864 7875 Reviewed by Dave Hyatt. … … 8952 8963 * storage/resources/database-lock-after-reload-2.html: Added. 8953 8964 8954 2009-07-08 Tor Arne Vestbà ¸ <tor.arne.vestbo@nokia.com>8965 2009-07-08 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> 8955 8966 8956 8967 Rubber-stamped by Simon Hausmann. -
trunk/LayoutTests/fast/dom/Window/window-properties-expected.txt
r48131 r48137 1515 1515 window.WebKitTransitionEvent [object WebKitTransitionEventConstructor] 1516 1516 window.WebKitTransitionEvent.prototype [printed above as window.Event.prototype] 1517 window.WebSocket [object WebSocketConstructor]1518 window.WebSocket.prototype [object WebSocketPrototype]1519 window.WebSocket.prototype.CLOSED [number]1520 window.WebSocket.prototype.CONNECTING [number]1521 window.WebSocket.prototype.OPEN [number]1522 window.WebSocket.prototype.close [function]1523 window.WebSocket.prototype.send [function]1524 1517 window.WheelEvent [object WheelEventConstructor] 1525 1518 window.WheelEvent.prototype [printed above as window.Event.prototype] -
trunk/LayoutTests/fast/dom/prototype-inheritance-2-expected.txt
r48131 r48137 364 364 Never found WebKitCSSTransformValue 365 365 Never found WebKitPoint 366 Never found WebSocket367 366 Never found Worker 368 367 Never found XMLHttpRequest -
trunk/LayoutTests/fast/dom/prototype-inheritance-expected.txt
r48131 r48137 338 338 PASS inner.WebKitTransitionEvent.isInner is true 339 339 PASS inner.WebKitTransitionEvent.constructor.isInner is true 340 PASS inner.WebSocket.isInner is true341 PASS inner.WebSocket.constructor.isInner is true342 340 PASS inner.WheelEvent.isInner is true 343 341 PASS inner.WheelEvent.constructor.isInner is true -
trunk/LayoutTests/fast/js/global-constructors-expected.txt
r48131 r48137 164 164 PASS WebKitPoint.toString() is '[object WebKitPointConstructor]' 165 165 PASS WebKitTransitionEvent.toString() is '[object WebKitTransitionEventConstructor]' 166 PASS WebSocket.toString() is '[object WebSocketConstructor]'167 166 PASS WheelEvent.toString() is '[object WheelEventConstructor]' 168 167 PASS Worker.toString() is '[object WorkerConstructor]' -
trunk/WebCore/ChangeLog
r48136 r48137 1 2009-09-07 Drew Wilson <atwilson@google.com> 2 3 Unreviewed build fix. 4 5 Reverting r48121 to fix Windows build errors. 6 7 * DerivedSources.cpp: 8 * GNUmakefile.am: 9 * WebCore.xcodeproj/project.pbxproj: 10 * bindings/js/JSDOMWindowCustom.cpp: 11 * bindings/js/JSEventTarget.cpp: 12 (WebCore::toJS): 13 (WebCore::toEventTarget): 14 * dom/EventTarget.cpp: 15 * dom/EventTarget.h: 16 * page/DOMWindow.idl: 17 * websockets/WebSocket.cpp: 18 (WebCore::WebSocket::connect): 19 (WebCore::WebSocket::send): 20 (WebCore::WebSocket::close): 21 (WebCore::WebSocket::bufferedAmount): 22 (WebCore::WebSocket::addEventListener): 23 (WebCore::WebSocket::removeEventListener): 24 (WebCore::WebSocket::dispatchEvent): 25 (WebCore::WebSocket::didConnect): 26 (WebCore::WebSocket::didReceiveMessage): 27 (WebCore::WebSocket::didClose): 28 (WebCore::WebSocket::dispatchOpenEvent): 29 (WebCore::WebSocket::dispatchMessageEvent): 30 (WebCore::WebSocket::dispatchCloseEvent): 31 * websockets/WebSocket.h: 32 (WebCore::WebSocket::create): 33 (WebCore::WebSocket::): 34 (WebCore::WebSocket::setOnopen): 35 (WebCore::WebSocket::onopen): 36 (WebCore::WebSocket::setOnmessage): 37 (WebCore::WebSocket::onmessage): 38 (WebCore::WebSocket::setOnclose): 39 (WebCore::WebSocket::onclose): 40 (WebCore::WebSocket::toWebSocket): 41 (WebCore::WebSocket::refEventTarget): 42 (WebCore::WebSocket::derefEventTarget): 43 * websockets/WebSocketChannel.cpp: Removed. 44 * websockets/WebSocketChannel.h: Removed. 45 * websockets/WebSocketChannelClient.h: Removed. 46 * websockets/WebSocketHandshake.cpp: Removed. 47 * websockets/WebSocketHandshake.h: Removed. 48 1 49 2009-09-07 Drew Wilson <atwilson@google.com> 2 50 -
trunk/WebCore/DerivedSources.cpp
r48121 r48137 342 342 #include "JSWebKitPoint.cpp" 343 343 #include "JSWebKitTransitionEvent.cpp" 344 #include "JSWebSocket.cpp"345 344 #include "JSWheelEvent.cpp" 346 345 #include "JSWorker.cpp" -
trunk/WebCore/GNUmakefile.am
r48126 r48137 3236 3236 WebCore/platform/network/SocketStreamHandleClient.h \ 3237 3237 WebCore/websockets/WebSocket.cpp \ 3238 WebCore/websockets/WebSocket.h \ 3239 WebCore/websockets/WebSocketChannel.cpp \ 3240 WebCore/websockets/WebSocketChannel.h \ 3241 WebCore/websockets/WebSocketChannelClient.h \ 3242 WebCore/websockets/WebSocketHandshake.cpp \ 3243 WebCore/websockets/WebSocketHandshake.h 3238 WebCore/websockets/WebSocket.h 3244 3239 3245 3240 webcoregtk_sources += \ -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r48121 r48137 889 889 510D4A37103165EE0049EA54 /* SocketStreamHandleBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 510D4A31103165EE0049EA54 /* SocketStreamHandleBase.h */; }; 890 890 510D4A38103165EE0049EA54 /* SocketStreamHandleClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 510D4A32103165EE0049EA54 /* SocketStreamHandleClient.h */; }; 891 510D4A4E103177A20049EA54 /* WebSocketChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510D4A47103177A20049EA54 /* WebSocketChannel.cpp */; };892 510D4A4F103177A20049EA54 /* WebSocketChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = 510D4A48103177A20049EA54 /* WebSocketChannel.h */; };893 510D4A50103177A20049EA54 /* WebSocketChannelClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 510D4A49103177A20049EA54 /* WebSocketChannelClient.h */; };894 891 5116D9770CF177BD00C2B84D /* DatabaseDetails.h in Headers */ = {isa = PBXBuildFile; fileRef = 5116D9750CF177BD00C2B84D /* DatabaseDetails.h */; settings = {ATTRIBUTES = (Private, ); }; }; 895 892 511F23170DC160DA004F0032 /* LocalStorageTask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 511F23130DC160DA004F0032 /* LocalStorageTask.cpp */; }; … … 978 975 51ABAE1E103C1913008C5260 /* SocketStreamHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = 51ABAE1C103C1913008C5260 /* SocketStreamHandle.h */; }; 979 976 51ABAE1F103C1913008C5260 /* SocketStreamHandleCFNet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51ABAE1D103C1913008C5260 /* SocketStreamHandleCFNet.cpp */; }; 980 51ABAE2E103D4F75008C5260 /* WebSocketHandshaker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51ABAE2C103D4F75008C5260 /* WebSocketHandshaker.cpp */; };981 51ABAE2F103D4F75008C5260 /* WebSocketHandshaker.h in Headers */ = {isa = PBXBuildFile; fileRef = 51ABAE2D103D4F75008C5260 /* WebSocketHandshaker.h */; };982 51ABAE441043AB4A008C5260 /* WebSocketHandshake.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51ABAE421043AB4A008C5260 /* WebSocketHandshake.cpp */; };983 51ABAE451043AB4A008C5260 /* WebSocketHandshake.h in Headers */ = {isa = PBXBuildFile; fileRef = 51ABAE431043AB4A008C5260 /* WebSocketHandshake.h */; };984 977 51B2417B0D931F3F00E83F5C /* LegacyWebArchiveMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51B2417A0D931F3F00E83F5C /* LegacyWebArchiveMac.mm */; }; 985 978 51BE37E00DAEE00E001085FC /* StorageArea.h in Headers */ = {isa = PBXBuildFile; fileRef = 51BE37DE0DAEE00E001085FC /* StorageArea.h */; }; … … 6033 6026 510D4A31103165EE0049EA54 /* SocketStreamHandleBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocketStreamHandleBase.h; sourceTree = "<group>"; }; 6034 6027 510D4A32103165EE0049EA54 /* SocketStreamHandleClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocketStreamHandleClient.h; sourceTree = "<group>"; }; 6035 510D4A47103177A20049EA54 /* WebSocketChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSocketChannel.cpp; sourceTree = "<group>"; };6036 510D4A48103177A20049EA54 /* WebSocketChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSocketChannel.h; sourceTree = "<group>"; };6037 510D4A49103177A20049EA54 /* WebSocketChannelClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSocketChannelClient.h; sourceTree = "<group>"; };6038 6028 5116D9750CF177BD00C2B84D /* DatabaseDetails.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DatabaseDetails.h; sourceTree = "<group>"; }; 6039 6029 511F23130DC160DA004F0032 /* LocalStorageTask.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LocalStorageTask.cpp; sourceTree = "<group>"; }; … … 6129 6119 51ABAE1C103C1913008C5260 /* SocketStreamHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SocketStreamHandle.h; path = cf/SocketStreamHandle.h; sourceTree = "<group>"; }; 6130 6120 51ABAE1D103C1913008C5260 /* SocketStreamHandleCFNet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SocketStreamHandleCFNet.cpp; path = cf/SocketStreamHandleCFNet.cpp; sourceTree = "<group>"; }; 6131 51ABAE2C103D4F75008C5260 /* WebSocketHandshaker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSocketHandshaker.cpp; sourceTree = "<group>"; };6132 51ABAE2D103D4F75008C5260 /* WebSocketHandshaker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSocketHandshaker.h; sourceTree = "<group>"; };6133 51ABAE421043AB4A008C5260 /* WebSocketHandshake.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSocketHandshake.cpp; sourceTree = "<group>"; };6134 51ABAE431043AB4A008C5260 /* WebSocketHandshake.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSocketHandshake.h; sourceTree = "<group>"; };6135 6121 51B2417A0D931F3F00E83F5C /* LegacyWebArchiveMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LegacyWebArchiveMac.mm; sourceTree = "<group>"; }; 6136 6122 51BE37DE0DAEE00E001085FC /* StorageArea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageArea.h; sourceTree = "<group>"; }; … … 10584 10570 isa = PBXGroup; 10585 10571 children = ( 10586 51ABAE421043AB4A008C5260 /* WebSocketHandshake.cpp */,10587 51ABAE431043AB4A008C5260 /* WebSocketHandshake.h */,10588 510D4A47103177A20049EA54 /* WebSocketChannel.cpp */,10589 510D4A48103177A20049EA54 /* WebSocketChannel.h */,10590 510D4A49103177A20049EA54 /* WebSocketChannelClient.h */,10591 10572 518A34BE1026C831001B6896 /* WebSocket.cpp */, 10592 10573 518A34BF1026C831001B6896 /* WebSocket.h */, … … 17578 17559 51ABAE1B103C18FF008C5260 /* SocketStreamError.h in Headers */, 17579 17560 51ABAE1E103C1913008C5260 /* SocketStreamHandle.h in Headers */, 17580 510D4A4F103177A20049EA54 /* WebSocketChannel.h in Headers */,17581 510D4A50103177A20049EA54 /* WebSocketChannelClient.h in Headers */,17582 51ABAE451043AB4A008C5260 /* WebSocketHandshake.h in Headers */,17583 17561 ); 17584 17562 runOnlyForDeploymentPostprocessing = 0; … … 19676 19654 510D4A36103165EE0049EA54 /* SocketStreamHandleBase.cpp in Sources */, 19677 19655 51ABAE1F103C1913008C5260 /* SocketStreamHandleCFNet.cpp in Sources */, 19678 510D4A4E103177A20049EA54 /* WebSocketChannel.cpp in Sources */,19679 51ABAE441043AB4A008C5260 /* WebSocketHandshake.cpp in Sources */,19680 19656 ); 19681 19657 runOnlyForDeploymentPostprocessing = 0; -
trunk/WebCore/bindings/js/JSDOMWindowCustom.cpp
r48121 r48137 55 55 #include "JSWebKitCSSMatrixConstructor.h" 56 56 #include "JSWebKitPointConstructor.h" 57 #if ENABLE(WEB_SOCKETS)58 #include "JSWebSocketConstructor.h"59 #endif60 57 #include "JSWorkerConstructor.h" 61 58 #include "JSXMLHttpRequestConstructor.h" … … 650 647 #endif 651 648 652 #if ENABLE(WEB_SOCKETS)653 JSValue JSDOMWindow::webSocket(ExecState* exec) const654 {655 return getDOMConstructor<JSWebSocketConstructor>(exec, this);656 }657 #endif658 659 649 // Custom functions 660 650 -
trunk/WebCore/bindings/js/JSEventTarget.cpp
r48136 r48137 79 79 #endif 80 80 81 #if ENABLE(WEB_SOCKETS)82 #include "JSWebSocket.h"83 #include "WebSocket.h"84 #endif85 86 81 using namespace JSC; 87 82 … … 145 140 #endif 146 141 147 #if ENABLE(WEB_SOCKETS)148 if (WebSocket* webSocket = target->toWebSocket())149 return toJS(exec, webSocket);150 #endif151 152 142 ASSERT_NOT_REACHED(); 153 143 return jsNull(); … … 194 184 #endif 195 185 196 #if ENABLE(WEB_SOCKETS)197 CONVERT_TO_EVENT_TARGET(WebSocket)198 #endif199 200 186 return 0; 201 187 } -
trunk/WebCore/dom/EventTarget.cpp
r48121 r48137 84 84 #endif 85 85 86 #if ENABLE(WEB_SOCKETS)87 WebSocket* EventTarget::toWebSocket()88 {89 return 0;90 }91 #endif92 93 86 MessagePort* EventTarget::toMessagePort() 94 87 { -
trunk/WebCore/dom/EventTarget.h
r48121 r48137 52 52 class SharedWorker; 53 53 class SharedWorkerContext; 54 class WebSocket;55 54 class Worker; 56 55 class XMLHttpRequest; … … 77 76 virtual DedicatedWorkerContext* toDedicatedWorkerContext(); 78 77 #endif 78 79 79 #if ENABLE(SHARED_WORKERS) 80 80 virtual SharedWorker* toSharedWorker(); 81 81 virtual SharedWorkerContext* toSharedWorkerContext(); 82 #endif83 #if ENABLE(WEB_SOCKETS)84 virtual WebSocket* toWebSocket();85 82 #endif 86 83 -
trunk/WebCore/page/DOMWindow.idl
r48131 r48137 488 488 #endif 489 489 490 #if defined(ENABLE_WEB_SOCKETS) && ENABLE_WEB_SOCKETS491 attribute [JSCCustomGetter] WebSocketConstructor WebSocket; // Usable with the new operator492 #endif493 494 490 attribute PluginConstructor Plugin; 495 491 attribute PluginArrayConstructor PluginArray; -
trunk/WebCore/websockets/WebSocket.cpp
r48121 r48137 35 35 #include "WebSocket.h" 36 36 37 #include "CString.h"38 #include "DOMWindow.h"39 37 #include "Event.h" 40 38 #include "EventException.h" 41 39 #include "EventListener.h" 42 #include "EventNames.h"43 #include "Logging.h"44 #include "MessageEvent.h"45 #include "ScriptExecutionContext.h"46 #include "SecurityOrigin.h"47 #include "WebSocketChannel.h"48 40 #include <wtf/StdLibExtras.h> 49 41 50 42 namespace WebCore { 51 52 class ProcessWebSocketEventTask : public ScriptExecutionContext::Task {53 public:54 typedef void (WebSocket::*Method)(Event*);55 static PassRefPtr<ProcessWebSocketEventTask> create(PassRefPtr<WebSocket> webSocket, Method method, PassRefPtr<Event> event)56 {57 return adoptRef(new ProcessWebSocketEventTask(webSocket, method, event));58 }59 virtual void performTask(ScriptExecutionContext*)60 {61 (m_webSocket.get()->*m_method)(m_event.get());62 }63 64 private:65 ProcessWebSocketEventTask(PassRefPtr<WebSocket> webSocket, Method method, PassRefPtr<Event> event)66 : m_webSocket(webSocket)67 , m_method(method)68 , m_event(event) { }69 70 RefPtr<WebSocket> m_webSocket;71 Method m_method;72 RefPtr<Event> m_event;73 };74 75 static bool isValidProtocolString(const WebCore::String& protocol)76 {77 if (protocol.isNull())78 return true;79 if (protocol.isEmpty())80 return false;81 const UChar* characters = protocol.characters();82 for (size_t i = 0; i < protocol.length(); i++) {83 if (characters[i] < 0x21 || characters[i] > 0x7E)84 return false;85 }86 return true;87 }88 43 89 44 WebSocket::WebSocket(ScriptExecutionContext* context) … … 105 60 void WebSocket::connect(const KURL& url, const String& protocol, ExceptionCode& ec) 106 61 { 107 LOG(Network, "WebSocket %p connect to %s protocol=%s", this, url.string().utf8().data(), protocol.utf8().data());108 62 m_url = url; 109 63 m_protocol = protocol; 110 64 111 65 if (!m_url.protocolIs("ws") && !m_url.protocolIs("wss")) { 112 LOG_ERROR("Error: wrong url for WebSocket %s", url.string().utf8().data());113 66 m_state = CLOSED; 114 67 ec = SYNTAX_ERR; 115 68 return; 116 69 } 117 if (!isValidProtocolString(m_protocol)) { 118 LOG_ERROR("Error: wrong protocol for WebSocket %s", m_protocol.utf8().data()); 70 if (!m_protocol.isNull() && m_protocol.isEmpty()) { 119 71 m_state = CLOSED; 120 72 ec = SYNTAX_ERR; 121 73 return; 122 74 } 123 // FIXME: if m_url.port() is blocking port, raise SECURITY_ERR. 124 125 m_channel = WebSocketChannel::create(scriptExecutionContext(), this, m_url, m_protocol); 126 m_channel->connect(); 75 // FIXME: Check protocol is valid form. 76 // FIXME: Connect WebSocketChannel. 127 77 } 128 78 129 bool WebSocket::send(const String& message, ExceptionCode& ec)79 bool WebSocket::send(const String&, ExceptionCode& ec) 130 80 { 131 LOG(Network, "WebSocket %p send %s", this, message.utf8().data()); 132 if (m_state == CONNECTING) { 81 if (m_state != OPEN) { 133 82 ec = INVALID_STATE_ERR; 134 83 return false; 135 84 } 136 // No exception is raised if the connection was once established but has subsequently been closed. 137 if (m_state == CLOSED) 138 return false; 139 // FIXME: check message is valid utf8. 140 return m_channel->send(message); 85 // FIXME: send message on WebSocketChannel. 86 return false; 141 87 } 142 88 143 89 void WebSocket::close() 144 90 { 145 LOG(Network, "WebSocket %p close", this);146 91 if (m_state == CLOSED) 147 92 return; 148 93 m_state = CLOSED; 149 m_channel->close();94 // FIXME: close WebSocketChannel. 150 95 } 151 96 … … 162 107 unsigned long WebSocket::bufferedAmount() const 163 108 { 164 if (m_state == OPEN) 165 return m_channel->bufferedAmount(); 109 // FIXME: ask platform code to get buffered amount to be sent. 166 110 return 0; 167 111 } … … 172 116 } 173 117 174 void WebSocket::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> eventListener, bool)118 void WebSocket::addEventListener(const AtomicString&, PassRefPtr<EventListener>, bool) 175 119 { 176 EventListenersMap::iterator iter = m_eventListeners.find(eventType); 177 if (iter == m_eventListeners.end()) { 178 ListenerVector listeners; 179 listeners.append(eventListener); 180 m_eventListeners.add(eventType, listeners); 181 } else { 182 ListenerVector& listeners = iter->second; 183 for (ListenerVector::iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) 184 if (*listenerIter == eventListener) 185 return; 186 187 listeners.append(eventListener); 188 m_eventListeners.add(eventType, listeners); 189 } 120 // FIXME: implement this. 190 121 } 191 122 192 void WebSocket::removeEventListener(const AtomicString& eventType, EventListener* eventListener, bool)123 void WebSocket::removeEventListener(const AtomicString&, EventListener*, bool) 193 124 { 194 EventListenersMap::iterator iter = m_eventListeners.find(eventType); 195 if (iter == m_eventListeners.end()) 196 return; 197 198 ListenerVector& listeners = iter->second; 199 for (ListenerVector::const_iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) 200 if (*listenerIter == eventListener) { 201 listeners.remove(listenerIter - listeners.begin()); 202 return; 203 } 125 // FIXME: implement this. 204 126 } 205 127 206 bool WebSocket::dispatchEvent(PassRefPtr<Event> evt, ExceptionCode& ec)128 bool WebSocket::dispatchEvent(PassRefPtr<Event>, ExceptionCode&) 207 129 { 208 if (!evt || evt->type().isEmpty()) { 209 ec = EventException::UNSPECIFIED_EVENT_TYPE_ERR; 210 return true; 211 } 212 213 ListenerVector listenersCopy = m_eventListeners.get(evt->type()); 214 for (ListenerVector::const_iterator listenerIter = listenersCopy.begin(); listenerIter != listenersCopy.end(); ++listenerIter) { 215 evt->setTarget(this); 216 evt->setCurrentTarget(this); 217 listenerIter->get()->handleEvent(evt.get(), false); 218 } 219 return !evt->defaultPrevented(); 130 // FIXME: implement this. 131 return false; 220 132 } 221 133 222 134 void WebSocket::didConnect() 223 135 { 224 LOG(Network, "WebSocket %p didConnect", this);225 136 if (m_state != CONNECTING) { 226 137 didClose(); … … 228 139 } 229 140 m_state = OPEN; 230 scriptExecutionContext()->postTask(ProcessWebSocketEventTask::create(this, &WebSocket::dispatchOpenEvent, Event::create(eventNames().openEvent, false, false)));141 dispatchOpenEvent(); 231 142 } 232 143 233 144 void WebSocket::didReceiveMessage(const String& msg) 234 145 { 235 LOG(Network, "WebSocket %p didReceiveMessage %s", this, msg.utf8().data());236 146 if (m_state != OPEN) 237 147 return; 238 RefPtr<MessageEvent> evt = MessageEvent::create(); 239 // FIXME: origin, lastEventId, source, messagePort. 240 evt->initMessageEvent(eventNames().messageEvent, false, false, msg, "", "", 0, 0); 241 scriptExecutionContext()->postTask(ProcessWebSocketEventTask::create(this, &WebSocket::dispatchMessageEvent, evt)); 148 dispatchMessageEvent(msg); 242 149 } 243 150 244 151 void WebSocket::didClose() 245 152 { 246 LOG(Network, "WebSocket %p didClose", this);247 153 m_state = CLOSED; 248 scriptExecutionContext()->postTask(ProcessWebSocketEventTask::create(this, &WebSocket::dispatchCloseEvent, Event::create(eventNames().closeEvent, false, false)));154 dispatchCloseEvent(); 249 155 } 250 156 251 void WebSocket::dispatchOpenEvent( Event* evt)157 void WebSocket::dispatchOpenEvent() 252 158 { 253 if (m_onopen) { 254 evt->setTarget(this); 255 evt->setCurrentTarget(this); 256 m_onopen->handleEvent(evt, false); 257 } 258 259 ExceptionCode ec = 0; 260 dispatchEvent(evt, ec); 261 ASSERT(!ec); 159 // FIXME: implement this. 262 160 } 263 161 264 void WebSocket::dispatchMessageEvent( Event* evt)162 void WebSocket::dispatchMessageEvent(const String&) 265 163 { 266 if (m_onmessage) { 267 evt->setTarget(this); 268 evt->setCurrentTarget(this); 269 m_onmessage->handleEvent(evt, false); 270 } 271 272 ExceptionCode ec = 0; 273 dispatchEvent(evt, ec); 274 ASSERT(!ec); 164 // FIXME: implement this. 275 165 } 276 166 277 void WebSocket::dispatchCloseEvent( Event* evt)167 void WebSocket::dispatchCloseEvent() 278 168 { 279 if (m_onclose) { 280 evt->setTarget(this); 281 evt->setCurrentTarget(this); 282 m_onclose->handleEvent(evt, false); 283 } 284 285 ExceptionCode ec = 0; 286 dispatchEvent(evt, ec); 287 ASSERT(!ec); 169 // FIXME: implement this. 288 170 } 289 171 -
trunk/WebCore/websockets/WebSocket.h
r48121 r48137 32 32 #define WebSocket_h 33 33 34 #if ENABLE(WEB_SOCKETS)35 36 34 #include "ActiveDOMObject.h" 37 35 #include "AtomicStringHash.h" … … 39 37 #include "EventTarget.h" 40 38 #include "KURL.h" 41 #include "WebSocketChannelClient.h"42 39 #include <wtf/OwnPtr.h> 43 40 #include <wtf/RefCounted.h> … … 45 42 namespace WebCore { 46 43 47 class String; 48 class WebSocketChannel; 44 class String; 49 45 50 class WebSocket : public RefCounted<WebSocket>, public EventTarget, public ActiveDOMObject, public WebSocketChannelClient {51 52 53 46 class WebSocket : public RefCounted<WebSocket>, public EventTarget, public ActiveDOMObject { 47 public: 48 static PassRefPtr<WebSocket> create(ScriptExecutionContext* context) { return adoptRef(new WebSocket(context)); } 49 virtual ~WebSocket(); 54 50 55 56 57 58 59 51 enum State { 52 CONNECTING = 0, 53 OPEN = 1, 54 CLOSED = 2 55 }; 60 56 61 void connect(const KURL&, ExceptionCode&);62 void connect(const KURL&, const String& protocol, ExceptionCode&);57 void connect(const KURL& url, ExceptionCode&); 58 void connect(const KURL& url, const String& protocol, ExceptionCode&); 63 59 64 60 bool send(const String& message, ExceptionCode&); 65 61 66 62 void close(); 67 63 68 69 70 64 const KURL& url() const; 65 State readyState() const; 66 unsigned long bufferedAmount() const; 71 67 72 73 74 75 76 77 68 void setOnopen(PassRefPtr<EventListener> eventListener) { m_onopen = eventListener; } 69 EventListener* onopen() const { return m_onopen.get(); } 70 void setOnmessage(PassRefPtr<EventListener> eventListener) { m_onmessage = eventListener; } 71 EventListener* onmessage() const { return m_onmessage.get(); } 72 void setOnclose(PassRefPtr<EventListener> eventListener) { m_onclose = eventListener; } 73 EventListener* onclose() const { return m_onclose.get(); } 78 74 79 80 75 // EventTarget 76 virtual WebSocket* toWebSocket() { return this; } 81 77 82 78 virtual ScriptExecutionContext* scriptExecutionContext() const; 83 79 84 typedef Vector<RefPtr<EventListener> > ListenerVector; 85 typedef HashMap<AtomicString, ListenerVector> EventListenersMap; 80 virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture); 81 virtual void removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture); 82 virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&); 86 83 87 virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture); 88 virtual void removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture); 89 virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&); 90 EventListenersMap& eventListeners() { return m_eventListeners; } 84 // ActiveDOMObject 85 // virtual bool hasPendingActivity() const; 86 // virtual void contextDestroyed(); 87 // virtual bool canSuspend() const; 88 // virtual void suspend(); 89 // virtual void resume(); 90 // virtual void stop(); 91 91 92 // ActiveDOMObject 93 // virtual bool hasPendingActivity() const; 94 // virtual void contextDestroyed(); 95 // virtual bool canSuspend() const; 96 // virtual void suspend(); 97 // virtual void resume(); 98 // virtual void stop(); 92 using RefCounted<WebSocket>::ref; 93 using RefCounted<WebSocket>::deref; 99 94 100 using RefCounted<WebSocket>::ref; 101 using RefCounted<WebSocket>::deref;95 private: 96 WebSocket(ScriptExecutionContext*); 102 97 103 // WebSocketChannelClient 104 virtual void didConnect(); 105 virtual void didReceiveMessage(const String& msg); 106 virtual void didClose(); 98 virtual void refEventTarget() { ref(); } 99 virtual void derefEventTarget() { deref(); } 107 100 108 private: 109 WebSocket(ScriptExecutionContext*); 101 // WebSocketChannelClient 102 void didConnect(); 103 void didReceiveMessage(const String& msg); 104 void didClose(); 110 105 111 virtual void refEventTarget() { ref(); } 112 virtual void derefEventTarget() { deref(); } 106 void dispatchOpenEvent(); 107 void dispatchMessageEvent(const String& msg); 108 void dispatchCloseEvent(); 113 109 114 void dispatchOpenEvent(Event*); 115 void dispatchMessageEvent(Event*); 116 void dispatchCloseEvent(Event*); 110 // FIXME: add WebSocketChannel. 117 111 118 RefPtr<WebSocketChannel> m_channel; 112 RefPtr<EventListener> m_onopen; 113 RefPtr<EventListener> m_onmessage; 114 RefPtr<EventListener> m_onclose; 119 115 120 RefPtr<EventListener> m_onopen; 121 RefPtr<EventListener> m_onmessage; 122 RefPtr<EventListener> m_onclose; 123 EventListenersMap m_eventListeners; 124 125 State m_state; 126 KURL m_url; 127 String m_protocol; 128 }; 116 State m_state; 117 KURL m_url; 118 String m_protocol; 119 }; 129 120 130 121 } // namespace WebCore 131 122 132 #endif // ENABLE(WEB_SOCKETS)133 134 123 #endif // WebSocket_h
Note: See TracChangeset
for help on using the changeset viewer.