[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.17-1283-gcf603cf
ap at apple.com
ap at apple.com
Tue Jan 5 23:46:23 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 90e80bbab3c5aba9150b22721c937226a799db66
Author: ap at apple.com <ap at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Dec 10 03:32:55 2009 +0000
Reviewed by Darin Adler.
https://bugs.webkit.org/show_bug.cgi?id=32332
WebSocket events should be dispatched synchronously
Updated websocket/tests/simple to test for the new behavior.
When Web Sockets API says that events should be queued for async dispatch, it means something
different. We should keep this in mind when dealing with other HTML5-related specs.
The model for HTML5 is that code running in response to network events (e.g. WebSocket or
XMLHttpRequest algorithms) runs in a separate thread of execution, and thus needs to post
async events as its only way to communicate with client code. As long as network events are
queued themselves (as they are in WebKit), there is no need to queue JS events for async
dispatch.
* websockets/WebSocket.cpp:
(WebCore::WebSocket::didConnect):
(WebCore::WebSocket::didReceiveMessage):
(WebCore::WebSocket::didClose):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51935 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 0fcf70d..206bf7d 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,14 @@
+2009-12-09 Alexey Proskuryakov <ap at apple.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=32332
+ WebSocket events should be dispatched synchronously
+
+ * websocket/tests/script-tests/simple.js:
+ * websocket/tests/simple-expected.txt:
+ It's after all guaranteed that readyState is 1 in open and message event handlers.
+
2009-12-09 Gavin Barraclough <barraclough at apple.com>
Reviewed by Oliver Hunt.
diff --git a/LayoutTests/websocket/tests/script-tests/simple.js b/LayoutTests/websocket/tests/script-tests/simple.js
index 39acf9c..e4f6c8f 100644
--- a/LayoutTests/websocket/tests/script-tests/simple.js
+++ b/LayoutTests/websocket/tests/script-tests/simple.js
@@ -18,12 +18,12 @@ debug("Created a socket to '" + ws.URL + "'; readyState " + ws.readyState + ".")
ws.onopen = function()
{
- debug("Connected; readyState " + ((ws.readyState >= 0) ? ">= 0." : ws.readyState));
+ debug("Connected; readyState " + ws.readyState);
};
ws.onmessage = function(messageEvent)
{
- debug("Received: '" + messageEvent.data + "'; readyState " + ((ws.readyState >= 1) ? ">= 1." : ws.readyState));
+ debug("Received: '" + messageEvent.data + "'; readyState " + ws.readyState);
};
ws.onclose = function()
diff --git a/LayoutTests/websocket/tests/simple-expected.txt b/LayoutTests/websocket/tests/simple-expected.txt
index cc4d0d1..8a020b7 100644
--- a/LayoutTests/websocket/tests/simple-expected.txt
+++ b/LayoutTests/websocket/tests/simple-expected.txt
@@ -3,8 +3,8 @@ Simple Web Socket test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Created a socket to 'ws://127.0.0.1:8880/websocket/tests/simple'; readyState 0.
-Connected; readyState >= 0.
-Received: 'Hello from Simple WSH.'; readyState >= 1.
+Connected; readyState 1
+Received: 'Hello from Simple WSH.'; readyState 1
Closed; readyState 2.
PASS successfullyParsed is true
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index c128053..d7260db 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,5 +1,28 @@
2009-12-09 Alexey Proskuryakov <ap at apple.com>
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=32332
+ WebSocket events should be dispatched synchronously
+
+ Updated websocket/tests/simple to test for the new behavior.
+
+ When Web Sockets API says that events should be queued for async dispatch, it means something
+ different. We should keep this in mind when dealing with other HTML5-related specs.
+
+ The model for HTML5 is that code running in response to network events (e.g. WebSocket or
+ XMLHttpRequest algorithms) runs in a separate thread of execution, and thus needs to post
+ async events as its only way to communicate with client code. As long as network events are
+ queued themselves (as they are in WebKit), there is no need to queue JS events for async
+ dispatch.
+
+ * websockets/WebSocket.cpp:
+ (WebCore::WebSocket::didConnect):
+ (WebCore::WebSocket::didReceiveMessage):
+ (WebCore::WebSocket::didClose):
+
+2009-12-09 Alexey Proskuryakov <ap at apple.com>
+
Reviewed by Oliver Hunt.
https://bugs.webkit.org/show_bug.cgi?id=32355
diff --git a/WebCore/websockets/WebSocket.cpp b/WebCore/websockets/WebSocket.cpp
index 2b54091..ee78174 100644
--- a/WebCore/websockets/WebSocket.cpp
+++ b/WebCore/websockets/WebSocket.cpp
@@ -48,29 +48,6 @@
namespace WebCore {
-class ProcessWebSocketEventTask : public ScriptExecutionContext::Task {
-public:
- typedef void (WebSocket::*Method)(Event*);
- static PassOwnPtr<ProcessWebSocketEventTask> create(PassRefPtr<WebSocket> webSocket, PassRefPtr<Event> event)
- {
- return new ProcessWebSocketEventTask(webSocket, event);
- }
- virtual void performTask(ScriptExecutionContext*)
- {
- ExceptionCode ec = 0;
- m_webSocket->dispatchEvent(m_event.get(), ec);
- ASSERT(!ec);
- }
-
- private:
- ProcessWebSocketEventTask(PassRefPtr<WebSocket> webSocket, PassRefPtr<Event> event)
- : m_webSocket(webSocket)
- , m_event(event) { }
-
- RefPtr<WebSocket> m_webSocket;
- RefPtr<Event> m_event;
-};
-
static bool isValidProtocolString(const WebCore::String& protocol)
{
if (protocol.isNull())
@@ -206,7 +183,7 @@ void WebSocket::didConnect()
return;
}
m_state = OPEN;
- scriptExecutionContext()->postTask(ProcessWebSocketEventTask::create(this, Event::create(eventNames().openEvent, false, false)));
+ dispatchEvent(Event::create(eventNames().openEvent, false, false));
}
void WebSocket::didReceiveMessage(const String& msg)
@@ -217,15 +194,14 @@ void WebSocket::didReceiveMessage(const String& msg)
RefPtr<MessageEvent> evt = MessageEvent::create();
// FIXME: origin, lastEventId, source, messagePort.
evt->initMessageEvent(eventNames().messageEvent, false, false, SerializedScriptValue::create(msg), "", "", 0, 0);
- scriptExecutionContext()->postTask(ProcessWebSocketEventTask::create(this, evt));
+ dispatchEvent(evt);
}
void WebSocket::didClose()
{
LOG(Network, "WebSocket %p didClose", this);
m_state = CLOSED;
- if (scriptExecutionContext())
- scriptExecutionContext()->postTask(ProcessWebSocketEventTask::create(this, Event::create(eventNames().closeEvent, false, false)));
+ dispatchEvent(Event::create(eventNames().closeEvent, false, false));
}
EventTargetData* WebSocket::eventTargetData()
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list