[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.17-1283-gcf603cf
ukai at chromium.org
ukai at chromium.org
Tue Jan 5 23:43:12 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit a96a04c06e1aa2fcc454bd63f4e5790986d8e508
Author: ukai at chromium.org <ukai at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Dec 7 02:19:56 2009 +0000
2009-12-06 Fumitoshi Ukai <ukai at chromium.org>
Reviewed by Alexey Proskuryakov.
Add tests for cross-origin WebSocket usage
https://bugs.webkit.org/show_bug.cgi?id=32055
* websocket/tests/cross-origin-expected.txt: Added.
* websocket/tests/cross-origin.html: Added.
* websocket/tests/fixed-origin_wsh.py: Added.
* websocket/tests/handshake-fail-by-cross-origin-expected.txt: Added.
* websocket/tests/handshake-fail-by-cross-origin.html: Added.
* websocket/tests/origin-test_wsh.py: Added.
* websocket/tests/script-tests/cross-origin.js: Added.
* websocket/tests/script-tests/frame-length-longer-than-buffer.js:
* websocket/tests/script-tests/frame-length-skip.js:
* websocket/tests/script-tests/handshake-error.js:
* websocket/tests/script-tests/handshake-fail-by-cross-origin.js: Added.
* websocket/tests/script-tests/simple.js:
* websocket/tests/simple-expected.txt:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51743 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index ebb2ec0..3c518d5 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,24 @@
+2009-12-06 Fumitoshi Ukai <ukai at chromium.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Add tests for cross-origin WebSocket usage
+ https://bugs.webkit.org/show_bug.cgi?id=32055
+
+ * websocket/tests/cross-origin-expected.txt: Added.
+ * websocket/tests/cross-origin.html: Added.
+ * websocket/tests/fixed-origin_wsh.py: Added.
+ * websocket/tests/handshake-fail-by-cross-origin-expected.txt: Added.
+ * websocket/tests/handshake-fail-by-cross-origin.html: Added.
+ * websocket/tests/origin-test_wsh.py: Added.
+ * websocket/tests/script-tests/cross-origin.js: Added.
+ * websocket/tests/script-tests/frame-length-longer-than-buffer.js:
+ * websocket/tests/script-tests/frame-length-skip.js:
+ * websocket/tests/script-tests/handshake-error.js:
+ * websocket/tests/script-tests/handshake-fail-by-cross-origin.js: Added.
+ * websocket/tests/script-tests/simple.js:
+ * websocket/tests/simple-expected.txt:
+
2009-12-05 Maciej Stachowiak <mjs at apple.com>
Reviewed by Oliver Hunt.
diff --git a/LayoutTests/websocket/tests/cross-origin-expected.txt b/LayoutTests/websocket/tests/cross-origin-expected.txt
new file mode 100644
index 0000000..b072bdd
--- /dev/null
+++ b/LayoutTests/websocket/tests/cross-origin-expected.txt
@@ -0,0 +1,12 @@
+Web Socket Cross Origin test
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+document.domain=127.0.0.1
+ws.url=ws://localhost:8880/websocket/tests/origin-test
+Connected
+PASS origin is "http://127.0.0.1:8880"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/websocket/tests/cross-origin.html b/LayoutTests/websocket/tests/cross-origin.html
new file mode 100644
index 0000000..dab2228
--- /dev/null
+++ b/LayoutTests/websocket/tests/cross-origin.html
@@ -0,0 +1,13 @@
+<!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 src="script-tests/cross-origin.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/websocket/tests/fixed-origin_wsh.py b/LayoutTests/websocket/tests/fixed-origin_wsh.py
new file mode 100644
index 0000000..938fb83
--- /dev/null
+++ b/LayoutTests/websocket/tests/fixed-origin_wsh.py
@@ -0,0 +1,38 @@
+# Copyright (C) 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
+
+
+def web_socket_do_extra_handshake(request):
+ request.ws_origin = 'http://example.com'
+
+
+def web_socket_transfer_data(request):
+ msgutil.send_message(request, request.ws_origin)
diff --git a/LayoutTests/websocket/tests/handshake-fail-by-cross-origin-expected.txt b/LayoutTests/websocket/tests/handshake-fail-by-cross-origin-expected.txt
new file mode 100644
index 0000000..721e655
--- /dev/null
+++ b/LayoutTests/websocket/tests/handshake-fail-by-cross-origin-expected.txt
@@ -0,0 +1,12 @@
+Make sure Web Socket connection failed if origin mismatches.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+document.domain=127.0.0.1
+ws.url=ws://localhost:8880/websocket/tests/fixed-origin
+PASS connected is false
+PASS origin is undefined.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/websocket/tests/handshake-fail-by-cross-origin.html b/LayoutTests/websocket/tests/handshake-fail-by-cross-origin.html
new file mode 100644
index 0000000..26aff94
--- /dev/null
+++ b/LayoutTests/websocket/tests/handshake-fail-by-cross-origin.html
@@ -0,0 +1,13 @@
+<!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 src="script-tests/handshake-fail-by-cross-origin.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/websocket/tests/origin-test_wsh.py b/LayoutTests/websocket/tests/origin-test_wsh.py
new file mode 100644
index 0000000..988d6af
--- /dev/null
+++ b/LayoutTests/websocket/tests/origin-test_wsh.py
@@ -0,0 +1,38 @@
+# Copyright (C) 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
+
+
+def web_socket_do_extra_handshake(request):
+ pass # Always accept.
+
+
+def web_socket_transfer_data(request):
+ msgutil.send_message(request, request.ws_origin)
diff --git a/LayoutTests/websocket/tests/script-tests/cross-origin.js b/LayoutTests/websocket/tests/script-tests/cross-origin.js
new file mode 100644
index 0000000..10b5f10
--- /dev/null
+++ b/LayoutTests/websocket/tests/script-tests/cross-origin.js
@@ -0,0 +1,46 @@
+description("Web Socket Cross Origin test");
+
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+var origin;
+
+function endTest()
+{
+ shouldBe("origin", '"http://127.0.0.1:8880"');
+ clearTimeout(timeoutID);
+ isSuccessfullyParsed();
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+var url = "ws://localhost:8880/websocket/tests/origin-test";
+debug("document.domain=" + document.domain);
+debug("ws.url=" + url);
+var ws = new WebSocket(url);
+
+ws.onopen = function()
+{
+ debug("Connected");
+};
+
+ws.onmessage = function (messageEvent)
+{
+ origin = messageEvent.data;
+ ws.close();
+};
+
+ws.onclose = function()
+{
+ endTest();
+};
+
+function timeOutCallback()
+{
+ debug("Timed out in state: " + ws.readyState);
+ endTest();
+}
+
+var timeoutID = setTimeout(timeOutCallback, 3000);
+
+var successfullyParsed = true;
diff --git a/LayoutTests/websocket/tests/script-tests/frame-length-longer-than-buffer.js b/LayoutTests/websocket/tests/script-tests/frame-length-longer-than-buffer.js
index de88c89..2d7185a 100644
--- a/LayoutTests/websocket/tests/script-tests/frame-length-longer-than-buffer.js
+++ b/LayoutTests/websocket/tests/script-tests/frame-length-longer-than-buffer.js
@@ -18,7 +18,7 @@ function finish() {
layoutTestController.notifyDone();
}
-var ws = new WebSocket("ws://localhost:8880/websocket/tests/frame-length-longer-than-buffer");
+var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/frame-length-longer-than-buffer");
ws.onopen = function () {
debug("WebSocket is open");
};
diff --git a/LayoutTests/websocket/tests/script-tests/frame-length-skip.js b/LayoutTests/websocket/tests/script-tests/frame-length-skip.js
index a682d24..97beead 100644
--- a/LayoutTests/websocket/tests/script-tests/frame-length-skip.js
+++ b/LayoutTests/websocket/tests/script-tests/frame-length-skip.js
@@ -18,7 +18,7 @@ function finish() {
layoutTestController.notifyDone();
}
-var ws = new WebSocket("ws://localhost:8880/websocket/tests/frame-length-skip");
+var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/frame-length-skip");
ws.onopen = function () {
debug("WebSocket is open");
};
diff --git a/LayoutTests/websocket/tests/script-tests/handshake-error.js b/LayoutTests/websocket/tests/script-tests/handshake-error.js
index 905ea3d..d9686a3 100644
--- a/LayoutTests/websocket/tests/script-tests/handshake-error.js
+++ b/LayoutTests/websocket/tests/script-tests/handshake-error.js
@@ -13,7 +13,7 @@ function endTest()
}
}
-var ws = new WebSocket("ws://localhost:8880/websocket/tests/handshake-error");
+var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/handshake-error");
ws.onopen = function()
{
diff --git a/LayoutTests/websocket/tests/script-tests/handshake-fail-by-cross-origin.js b/LayoutTests/websocket/tests/script-tests/handshake-fail-by-cross-origin.js
new file mode 100644
index 0000000..d6cc703
--- /dev/null
+++ b/LayoutTests/websocket/tests/script-tests/handshake-fail-by-cross-origin.js
@@ -0,0 +1,50 @@
+description("Make sure Web Socket connection failed if origin mismatches.");
+
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+var connected = false;
+var origin;
+
+function endTest()
+{
+ shouldBeFalse("connected");
+ shouldBeUndefined("origin");
+ clearTimeout(timeoutID);
+ isSuccessfullyParsed();
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+
+var url = "ws://localhost:8880/websocket/tests/fixed-origin";
+debug("document.domain=" + document.domain);
+debug("ws.url=" + url);
+var ws = new WebSocket(url);
+
+ws.onopen = function()
+{
+ debug("Connected");
+ connected = true;
+};
+
+ws.onmessage = function (messageEvent)
+{
+ origin = messageEvent.data;
+ debug("origin=" + origin);
+ ws.close();
+};
+
+ws.onclose = function()
+{
+ endTest();
+};
+
+function timeOutCallback()
+{
+ debug("Timed out in state: " + ws.readyState);
+ endTest();
+}
+
+var timeoutID = setTimeout(timeOutCallback, 3000);
+
+var successfullyParsed = true;
diff --git a/LayoutTests/websocket/tests/script-tests/simple.js b/LayoutTests/websocket/tests/script-tests/simple.js
index 6964fad..39acf9c 100644
--- a/LayoutTests/websocket/tests/script-tests/simple.js
+++ b/LayoutTests/websocket/tests/script-tests/simple.js
@@ -13,7 +13,7 @@ function endTest()
}
}
-var ws = new WebSocket("ws://localhost:8880/websocket/tests/simple");
+var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/simple");
debug("Created a socket to '" + ws.URL + "'; readyState " + ws.readyState + ".");
ws.onopen = function()
diff --git a/LayoutTests/websocket/tests/simple-expected.txt b/LayoutTests/websocket/tests/simple-expected.txt
index 169fd60..cc4d0d1 100644
--- a/LayoutTests/websocket/tests/simple-expected.txt
+++ b/LayoutTests/websocket/tests/simple-expected.txt
@@ -2,7 +2,7 @@ Simple Web Socket test
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-Created a socket to 'ws://localhost:8880/websocket/tests/simple'; readyState 0.
+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.
Closed; readyState 2.
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list