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

Unified Diff: Source/modules/websockets/MainThreadWebSocketChannel.h

Issue 14657008: Make websocket error messages look better at the devtools console. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 8 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
Index: Source/modules/websockets/MainThreadWebSocketChannel.h
diff --git a/Source/modules/websockets/MainThreadWebSocketChannel.h b/Source/modules/websockets/MainThreadWebSocketChannel.h
index 4f5a49917142e54611ae8f2af3aec7e043770e05..d87f3901c7884c52871680cb622d1b2cc6116892 100644
--- a/Source/modules/websockets/MainThreadWebSocketChannel.h
+++ b/Source/modules/websockets/MainThreadWebSocketChannel.h
@@ -33,6 +33,7 @@
#include "core/fileapi/FileReaderLoaderClient.h"
#include "core/inspector/ScriptCallFrame.h"
+#include "core/page/ConsoleTypes.h"
#include "core/platform/Timer.h"
#include "core/platform/network/SocketStreamHandleClient.h"
#include "modules/websockets/WebSocketChannel.h"
@@ -41,6 +42,7 @@
#include "modules/websockets/WebSocketHandshake.h"
#include "wtf/Deque.h"
#include "wtf/Forward.h"
+#include "wtf/PassOwnPtr.h"
#include "wtf/RefCounted.h"
#include "wtf/Vector.h"
#include "wtf/text/CString.h"
@@ -59,6 +61,9 @@ class MainThreadWebSocketChannel : public RefCounted<MainThreadWebSocketChannel>
WTF_MAKE_FAST_ALLOCATED;
public:
static PassRefPtr<MainThreadWebSocketChannel> create(Document* document, WebSocketChannelClient* client) { return adoptRef(new MainThreadWebSocketChannel(document, client)); }
+ // You can use this create function if you want to specify the source file and the line number information
+ // at the connection initiation manually.
+ static PassRefPtr<MainThreadWebSocketChannel> create(Document* document, WebSocketChannelClient* client, const ScriptCallFrame& frame) { return adoptRef(new MainThreadWebSocketChannel(document, client, frame)); }
virtual ~MainThreadWebSocketChannel();
bool send(const char* data, int length);
@@ -74,7 +79,8 @@ public:
// Start closing handshake. Use the CloseEventCodeNotSpecified for the code
// argument to omit payload.
virtual void close(int code, const String& reason) OVERRIDE;
- virtual void fail(const String& reason) OVERRIDE;
+ virtual void fail(const String& reason, MessageLevel) OVERRIDE;
+ virtual void fail(const String& reason, MessageLevel, PassOwnPtr<CallStackWrapper>) OVERRIDE;
virtual void disconnect() OVERRIDE;
virtual void suspend() OVERRIDE;
@@ -104,6 +110,7 @@ protected:
private:
MainThreadWebSocketChannel(Document*, WebSocketChannelClient*);
+ MainThreadWebSocketChannel(Document*, WebSocketChannelClient*, const ScriptCallFrame&);
bool appendToBuffer(const char* data, size_t len);
void skipBuffer(size_t len);
@@ -111,6 +118,7 @@ private:
void resumeTimerFired(Timer<MainThreadWebSocketChannel>*);
void startClosingHandshake(int code, const String& reason);
void closingTimerFired(Timer<MainThreadWebSocketChannel>*);
+ void failInternal();
bool processFrame();
@@ -139,6 +147,7 @@ private:
void enqueueRawFrame(WebSocketFrame::OpCode, const char* data, size_t dataLength);
void enqueueBlobFrame(WebSocketFrame::OpCode, const Blob&);
+ void failAsError(const String& reason) { fail(reason, ErrorMessageLevel); }
void processOutgoingFrameQueue();
void abortOutgoingFrameQueue();

Powered by Google App Engine
This is Rietveld 408576698