[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.20-204-g221d8e8
ukai at chromium.org
ukai at chromium.org
Wed Feb 10 22:11:50 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit c2070ace98c70910e14566d380fbc467f11fde0a
Author: ukai at chromium.org <ukai at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Feb 4 02:24:07 2010 +0000
2010-02-03 Fumitoshi Ukai <ukai at chromium.org>
Reviewed by Alexey Proskuryakov.
WebSocket should close the connection when unloading the document
https://bugs.webkit.org/show_bug.cgi?id=33248
* websocket/tests/close-on-unload-expected.txt: Added.
* websocket/tests/close-on-unload.html: Added.
* websocket/tests/close-on-unload_wsh.py: Added.
* websocket/tests/resources/close-on-unload-iframe.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54319 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 44b3184..7eaf353 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2010-02-03 Fumitoshi Ukai <ukai at chromium.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ WebSocket should close the connection when unloading the document
+ https://bugs.webkit.org/show_bug.cgi?id=33248
+
+ * websocket/tests/close-on-unload-expected.txt: Added.
+ * websocket/tests/close-on-unload.html: Added.
+ * websocket/tests/close-on-unload_wsh.py: Added.
+ * websocket/tests/resources/close-on-unload-iframe.html: Added.
+
2010-02-03 Adele Peterson <adele at apple.com>
Reviewed by Simon Fraser.
diff --git a/LayoutTests/websocket/tests/close-on-unload-expected.txt b/LayoutTests/websocket/tests/close-on-unload-expected.txt
new file mode 100644
index 0000000..cf45278
--- /dev/null
+++ b/LayoutTests/websocket/tests/close-on-unload-expected.txt
@@ -0,0 +1,12 @@
+Test if Web Socket is closed on unload
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+PASS ws on master document is ready.
+PASS insert a iframe, where open ws called 'socket1'
+PASS 'socket1' is sent to the server. unload the iframe. expect receiving 'socket1' on ws...
+PASS closedSocket is "socket1"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/websocket/tests/close-on-unload.html b/LayoutTests/websocket/tests/close-on-unload.html
new file mode 100644
index 0000000..6a3681a
--- /dev/null
+++ b/LayoutTests/websocket/tests/close-on-unload.html
@@ -0,0 +1,57 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../fast/js/resources/js-test-post-function.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script type="text/javascript">
+description("Test if Web Socket is closed on unload");
+
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+var frameDiv;
+var closedSocket;
+
+function endTest()
+{
+ shouldBe("closedSocket", '"socket1"');
+ isSuccessfullyParsed();
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+};
+
+var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/close-on-unload");
+ws.onopen = function()
+{
+ debug("PASS ws on master document is ready.");
+ frameDiv = document.createElement("iframe");
+ frameDiv.src = "resources/close-on-unload-iframe.html";
+ document.body.appendChild(frameDiv);
+ debug("PASS insert a iframe, where open ws called 'socket1'");
+};
+ws.onmessage = function(evt)
+{
+ closedSocket = evt.data;
+ ws.close();
+};
+ws.onclose = function()
+{
+ endTest();
+};
+
+document.iframeReady = function()
+{
+ debug("PASS 'socket1' is sent to the server. unload the iframe. expect receiving 'socket1' on ws...");
+ document.body.removeChild(frameDiv);
+};
+
+var successfullyParsed = true;
+</script>
+
+</body>
+</html>
diff --git a/LayoutTests/websocket/tests/close-on-unload_wsh.py b/LayoutTests/websocket/tests/close-on-unload_wsh.py
new file mode 100644
index 0000000..e8939fc
--- /dev/null
+++ b/LayoutTests/websocket/tests/close-on-unload_wsh.py
@@ -0,0 +1,54 @@
+# Copyright 2009, Google Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+from mod_pywebsocket import msgutil
+
+connections = set()
+
+def web_socket_do_extra_handshake(request):
+ pass # Always accept.
+
+
+def web_socket_transfer_data(request):
+ global connections
+ connections.add(request)
+ socketName = None
+ try:
+ socketName = msgutil.receive_message(request)
+ # notify to client that socketName is received by server.
+ msgutil.send_message(request, socketName)
+ msgutil.receive_message(request) # wait, and exception by close.
+ socketName = socketName + ': receive next message'
+ finally:
+ # request is closed. notify this socketName to other web sockets.
+ connections.remove(request)
+ for ws in connections:
+ msgutil.send_message(ws, socketName)
+
diff --git a/LayoutTests/websocket/tests/resources/close-on-unload-iframe.html b/LayoutTests/websocket/tests/resources/close-on-unload-iframe.html
new file mode 100644
index 0000000..46703c7
--- /dev/null
+++ b/LayoutTests/websocket/tests/resources/close-on-unload-iframe.html
@@ -0,0 +1,23 @@
+<html>
+<head>
+<script src="../../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../../fast/js/resources/js-test-post-function.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script type="text/javascript">
+var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/close-on-unload");
+ws.onopen = function()
+{
+ // send "socket1" to server, so that "socket1" will be broadcasted to web sockets connected to close-on-unload when this web socket is closed.
+ ws.send("socket1");
+};
+ws.onmessage = function(evt)
+{
+ // "socket1" is received by server, so ready to unload this document.
+ parent.document.iframeReady(evt.data);
+}
+</script>
+</body>
+</html>
diff --git a/LayoutTests/websocket/tests/resources/close-on-unload-iframe.html~ b/LayoutTests/websocket/tests/resources/close-on-unload-iframe.html~
new file mode 100644
index 0000000..472caf4
--- /dev/null
+++ b/LayoutTests/websocket/tests/resources/close-on-unload-iframe.html~
@@ -0,0 +1,23 @@
+<html>
+<head>
+<script src="../../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../../fast/js/resources/js-test-post-function.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<script type="text/javascript">
+var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/close-on-unload");
+ws.onopen = function()
+{
+ debug("ws in iframe opened");
+ ws.send("socket1");
+};
+ws.onmessage = function(evt)
+{
+ debug("ws in iframe got message:" + evt.data);
+ parent.document.iframeReady(evt.data);
+}
+</script>
+</body>
+</html>
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list