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

Side by Side Diff: content/common/websocket_messages.h

Issue 34753008: Notify WebSocket connection failure, chromium side (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « content/child/websocket_dispatcher.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Multiply-included message file, hence no include guard. 5 // Multiply-included message file, hence no include guard.
6 6
7 // This file defines the IPCs for the browser-side implementation of 7 // This file defines the IPCs for the browser-side implementation of
8 // WebSockets. For the legacy renderer-side implementation, see 8 // WebSockets. For the legacy renderer-side implementation, see
9 // socket_stream_messages.h. 9 // socket_stream_messages.h.
10 // TODO(ricea): Fix this comment when the legacy implementation has been 10 // TODO(ricea): Fix this comment when the legacy implementation has been
(...skipping 25 matching lines...) Expand all
36 // "Subprotocols Using the WebSocket Protocol". 36 // "Subprotocols Using the WebSocket Protocol".
37 // 37 //
38 // The browser process will not send |channel_id| as-is to the remote server; it 38 // The browser process will not send |channel_id| as-is to the remote server; it
39 // will try to use a short id on the wire. This saves the renderer from 39 // will try to use a short id on the wire. This saves the renderer from
40 // having to try to choose the ids cleverly. 40 // having to try to choose the ids cleverly.
41 IPC_MESSAGE_ROUTED3(WebSocketHostMsg_AddChannelRequest, 41 IPC_MESSAGE_ROUTED3(WebSocketHostMsg_AddChannelRequest,
42 GURL /* socket_url */, 42 GURL /* socket_url */,
43 std::vector<std::string> /* requested_protocols */, 43 std::vector<std::string> /* requested_protocols */,
44 GURL /* origin */) 44 GURL /* origin */)
45 45
46 // Web Socket messages sent from the browser to the renderer. 46 // WebSocket messages sent from the browser to the renderer.
47 47
48 // Respond to an AddChannelRequest for channel |channel_id|. |channel_id| is 48 // Respond to an AddChannelRequest for channel |channel_id|. |channel_id| is
49 // scoped to the renderer process; while it is unique per-renderer, the browser 49 // scoped to the renderer process; while it is unique per-renderer, the browser
50 // may have multiple renderers using the same id. If |fail| is true, the channel 50 // may have multiple renderers using the same id. If |fail| is true, the channel
51 // could not be established (the cause of the failure is not provided to the 51 // could not be established (the cause of the failure is not provided to the
52 // renderer in order to limit its ability to abuse WebSockets to perform network 52 // renderer in order to limit its ability to abuse WebSockets to perform network
53 // probing, etc.). If |fail| is set then the |channel_id| is available for 53 // probing, etc.). If |fail| is set then the |channel_id| is available for
54 // re-use. |selected_protocol| is the sub-protocol the server selected, 54 // re-use. |selected_protocol| is the sub-protocol the server selected,
55 // or empty if no sub-protocol was selected. |extensions| is the list of 55 // or empty if no sub-protocol was selected. |extensions| is the list of
56 // extensions negotiated for the connection. 56 // extensions negotiated for the connection.
57 IPC_MESSAGE_ROUTED3(WebSocketMsg_AddChannelResponse, 57 IPC_MESSAGE_ROUTED3(WebSocketMsg_AddChannelResponse,
58 bool /* fail */, 58 bool /* fail */,
59 std::string /* selected_protocol */, 59 std::string /* selected_protocol */,
60 std::string /* extensions */) 60 std::string /* extensions */)
61 61
62 // Notify the renderer that the browser is required to fail the connection
63 // (see RFC6455 7.1.7 for details).
64 // When the renderer process receives this messages it does the following:
65 // 1. Fire an error event.
66 // 2. Show |message| to the inspector.
67 // 3. Close the channel immediately uncleanly, as if it received
68 // DropChannel(was_clean = false, code = 1006, reason = "").
69 // |message| will be shown in the inspector and won't be passed to the script.
70 // TODO(yhirano): Find the way to pass |message| directly to the inspector
71 // process.
72 IPC_MESSAGE_ROUTED1(WebSocketMsg_NotifyFailure,
73 std::string /* message */)
74
62 // WebSocket messages that can be sent in either direction. 75 // WebSocket messages that can be sent in either direction.
63 76
64 IPC_ENUM_TRAITS(content::WebSocketMessageType) 77 IPC_ENUM_TRAITS(content::WebSocketMessageType)
65 78
66 // Send a non-control frame on |channel_id|. If the sender is the renderer, it 79 // Send a non-control frame on |channel_id|. If the sender is the renderer, it
67 // will be sent to the remote server. If the sender is the browser, it comes 80 // will be sent to the remote server. If the sender is the browser, it comes
68 // from the remote server. |fin| indicates that this frame is the last in the 81 // from the remote server. |fin| indicates that this frame is the last in the
69 // current message. |type| is the type of the message. On the first frame of a 82 // current message. |type| is the type of the message. On the first frame of a
70 // message, it must be set to either WEB_SOCKET_MESSAGE_TYPE_TEXT or 83 // message, it must be set to either WEB_SOCKET_MESSAGE_TYPE_TEXT or
71 // WEB_SOCKET_MESSAGE_TYPE_BINARY. On subsequent frames, it must be set to 84 // WEB_SOCKET_MESSAGE_TYPE_BINARY. On subsequent frames, it must be set to
(...skipping 21 matching lines...) Expand all
93 // and the TCP/IP connection will be closed. 106 // and the TCP/IP connection will be closed.
94 // When sent by the browser, this indicates that a Close or DropChannel has been 107 // When sent by the browser, this indicates that a Close or DropChannel has been
95 // received, the connection was closed, or a network or protocol error 108 // received, the connection was closed, or a network or protocol error
96 // occurred. On receiving DropChannel, the renderer process may consider the 109 // occurred. On receiving DropChannel, the renderer process may consider the
97 // |channel_id| available for reuse by a new AddChannelRequest. 110 // |channel_id| available for reuse by a new AddChannelRequest.
98 // |code| is one of the reason codes specified in RFC6455 or 111 // |code| is one of the reason codes specified in RFC6455 or
99 // draft-ietf-hybi-websocket-multiplexing-09. |reason|, if non-empty, is a 112 // draft-ietf-hybi-websocket-multiplexing-09. |reason|, if non-empty, is a
100 // UTF-8 encoded string which may be useful for debugging but is not necessarily 113 // UTF-8 encoded string which may be useful for debugging but is not necessarily
101 // human-readable, as supplied by the server in the Close or DropChannel 114 // human-readable, as supplied by the server in the Close or DropChannel
102 // message. 115 // message.
103 IPC_MESSAGE_ROUTED2(WebSocketMsg_DropChannel, 116 // If |was_clean| is false on a message from the browser, then the WebSocket
117 // connection was not closed cleanly. If |was_clean| is false on a message from
118 // the renderer, then the connection should be closed immediately without a
119 // closing handshake and the renderer cannot accept any new messages on this
120 // connection.
121 IPC_MESSAGE_ROUTED3(WebSocketMsg_DropChannel,
122 bool /* was_clean */,
104 unsigned short /* code */, 123 unsigned short /* code */,
105 std::string /* reason */) 124 std::string /* reason */)
OLDNEW
« no previous file with comments | « content/child/websocket_dispatcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698