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

Unified Diff: webkit/plugins/ppapi/ppb_websocket_impl.cc

Issue 8764022: WebSocket Pepper API: use net::IsPortAllowedByDefault() to validate port (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/tests/test_websocket.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/ppapi/ppb_websocket_impl.cc
diff --git a/webkit/plugins/ppapi/ppb_websocket_impl.cc b/webkit/plugins/ppapi/ppb_websocket_impl.cc
index 3fd708b11abab79a2937189ef59609dd835a8c45..ea3634b876beddfc24aa48ef1007ddf3c784ea3c 100644
--- a/webkit/plugins/ppapi/ppb_websocket_impl.cc
+++ b/webkit/plugins/ppapi/ppb_websocket_impl.cc
@@ -38,14 +38,14 @@ using WebKit::WebSocket;
using WebKit::WebSocketClient;
using WebKit::WebURL;
-namespace {
-
const uint32_t kMaxReasonSizeInBytes = 123;
const size_t kHybiBaseFramingOverhead = 2;
const size_t kHybiMaskingKeyLength = 4;
const size_t kMinimumPayloadSizeWithTwoByteExtendedPayloadLength = 126;
const size_t kMinimumPayloadSizeWithEightByteExtendedPayloadLength = 0x10000;
+namespace {
+
uint64_t SaturateAdd(uint64_t a, uint64_t b) {
if (kuint64max - a < b)
return kuint64max;
@@ -139,9 +139,8 @@ int32_t PPB_WebSocket_Impl::Connect(PP_Var url,
return PP_ERROR_BADARGUMENT;
if (gurl.has_ref())
return PP_ERROR_BADARGUMENT;
- // TODO(toyoshim): Must check if the port is allowed by default.
- // We could not just use net::IsPortAllowedByDefault() because it doesn't
- // be exported over the shared library.
+ if (!net::IsPortAllowedByDefault(gurl.IntPort()))
+ return PP_ERROR_BADARGUMENT;
WebURL web_url(gurl);
// Validate protocols and convert it to WebString.
@@ -236,8 +235,6 @@ int32_t PPB_WebSocket_Impl::Close(uint16_t code,
return PP_OK_COMPLETIONPENDING;
}
- // TODO(toyoshim): Handle bufferedAmount here.
-
state_ = PP_WEBSOCKETREADYSTATE_CLOSING_DEV;
WebString web_reason = WebString::fromUTF8(reason_string->value());
websocket_->close(code, web_reason);
« no previous file with comments | « ppapi/tests/test_websocket.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698