Skip to content

Commit

Permalink
WebSocket: also test event origin
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk committed May 18, 2017
1 parent e74f3b5 commit 3f89f64
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion websockets/opening-handshake/003.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<!doctype html>
<meta charset=utf-8>
<title>WebSockets: origin</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
Expand All @@ -8,8 +9,10 @@
<div id=log></div>
<script>
async_test(function(t) {
var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/origin');
const url = SCHEME_DOMAIN_PORT+'/origin',
ws = new WebSocket(url.replace("://", "://天気の良い日."));
ws.onmessage = t.step_func(function(e) {
assert_equals(e.origin, new URL(url).origin.replace("://", "://xn--n8j6ds53lwwkrqhv28a."))
assert_equals(e.data, location.protocol+'//'+location.host);
ws.onclose = t.step_func(function(e) {
assert_equals(e.wasClean, true);
Expand Down

0 comments on commit 3f89f64

Please sign in to comment.