Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(326)

Side by Side Diff: net/data/websocket/connect.html

Issue 390773002: [WebSocket] Send a close frame when the renderer process is gone. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 <!DOCTYPE html> 1 <!doctype html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>test ws connection</title> 4 <title>Connect to a WebSocket server</title>
5 <script type="text/javascript"> 5 <script type="text/javascript">
6
7 var href = window.location.href; 6 var href = window.location.href;
Adam Rice 2014/07/14 10:17:20 See https://code.google.com/p/chromium/codesearch#
yhirano 2014/07/14 11:24:35 Done.
8 var hostBegin = href.indexOf('/') + 2; 7 var hostBegin = href.indexOf('/') + 2;
9 var hostEnd = href.lastIndexOf(':'); 8 var hostEnd = href.lastIndexOf(':');
10 var host = href.slice(hostBegin, hostEnd); 9 var host = href.slice(hostBegin, hostEnd);
11 var portBegin = hostEnd + 1; 10 var portBegin = hostEnd + 1;
12 var portEnd = href.lastIndexOf('/'); 11 var portEnd = href.lastIndexOf('/');
13 var port = href.slice(portBegin, portEnd); 12 var port = href.slice(portBegin, portEnd);
14 var scheme = href.indexOf('https') >= 0 ? 'wss' : 'ws'; 13 var scheme = href.indexOf('https') >= 0 ? 'wss' : 'ws';
15 var url = scheme + '://' + host + ':' + port + '/echo-with-no-extension'; 14 var url = scheme + '://' + host + ':' + port + '/count-connection';
16 15
17 // Do connection test.
18 var ws = new WebSocket(url); 16 var ws = new WebSocket(url);
19 17
20 ws.onopen = function() 18 ws.onopen = function() {
21 { 19 document.title = 'CONNECTED';
22 // Set document title to 'PASS'. The test observer catches this title changes 20 };
23 // to know the result.
24 document.title = 'PASS';
25 }
26 21
27 ws.onclose = function() 22 ws.onclose = function() {
28 { 23 document.title = 'CLOSED';
29 // Set document title to 'FAIL'. 24 };
30 document.title = 'FAIL';
31 }
32
33 </script> 25 </script>
34 </head> 26 </head>
35 </html> 27 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698