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

Unified Diff: third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.cpp

Issue 2127673003: Fix worker WebSocket crash caused by dereferencing weak pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.cpp
diff --git a/third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.cpp b/third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.cpp
index 51a29d694bc4371ad5fc9af6a6733199a548225e..940045d1c95f9a7c570f276ac47a9b5a94ba18d0 100644
--- a/third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.cpp
+++ b/third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.cpp
@@ -270,7 +270,7 @@ void Peer::disconnect()
static void workerGlobalScopeDidConnect(Bridge* bridge, const String& subprotocol, const String& extensions, ExecutionContext* context)
{
ASSERT_UNUSED(context, context->isWorkerGlobalScope());
- if (bridge->client())
+ if (bridge && bridge->client())
bridge->client()->didConnect(subprotocol, extensions);
}
@@ -283,7 +283,7 @@ void Peer::didConnect(const String& subprotocol, const String& extensions)
static void workerGlobalScopeDidReceiveTextMessage(Bridge* bridge, const String& payload, ExecutionContext* context)
{
ASSERT_UNUSED(context, context->isWorkerGlobalScope());
- if (bridge->client())
+ if (bridge && bridge->client())
bridge->client()->didReceiveTextMessage(payload);
}
@@ -296,7 +296,7 @@ void Peer::didReceiveTextMessage(const String& payload)
static void workerGlobalScopeDidReceiveBinaryMessage(Bridge* bridge, std::unique_ptr<Vector<char>> payload, ExecutionContext* context)
{
ASSERT_UNUSED(context, context->isWorkerGlobalScope());
- if (bridge->client())
+ if (bridge && bridge->client())
bridge->client()->didReceiveBinaryMessage(std::move(payload));
}
@@ -309,7 +309,7 @@ void Peer::didReceiveBinaryMessage(std::unique_ptr<Vector<char>> payload)
static void workerGlobalScopeDidConsumeBufferedAmount(Bridge* bridge, uint64_t consumed, ExecutionContext* context)
{
ASSERT_UNUSED(context, context->isWorkerGlobalScope());
- if (bridge->client())
+ if (bridge && bridge->client())
bridge->client()->didConsumeBufferedAmount(consumed);
}
@@ -322,7 +322,7 @@ void Peer::didConsumeBufferedAmount(uint64_t consumed)
static void workerGlobalScopeDidStartClosingHandshake(Bridge* bridge, ExecutionContext* context)
{
ASSERT_UNUSED(context, context->isWorkerGlobalScope());
- if (bridge->client())
+ if (bridge && bridge->client())
bridge->client()->didStartClosingHandshake();
}
@@ -335,7 +335,7 @@ void Peer::didStartClosingHandshake()
static void workerGlobalScopeDidClose(Bridge* bridge, WebSocketChannelClient::ClosingHandshakeCompletionStatus closingHandshakeCompletion, unsigned short code, const String& reason, ExecutionContext* context)
{
ASSERT_UNUSED(context, context->isWorkerGlobalScope());
- if (bridge->client())
+ if (bridge && bridge->client())
bridge->client()->didClose(closingHandshakeCompletion, code, reason);
}
@@ -352,7 +352,7 @@ void Peer::didClose(ClosingHandshakeCompletionStatus closingHandshakeCompletion,
static void workerGlobalScopeDidError(Bridge* bridge, ExecutionContext* context)
{
ASSERT_UNUSED(context, context->isWorkerGlobalScope());
- if (bridge->client())
+ if (bridge && bridge->client())
bridge->client()->didError();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698