Commit dfe9397c authored by Wez's avatar Wez Committed by Commit Bot

[blink] Fix MessageReceiver::OnMessage() to default to failing.

WebMessagePort::MessageReceiver::OnMessage() is documented as returning
false if passed a message that it cannot handle (e.g. because it is
malformed or unrecognised).  The default OnMessage() implementation was
instead returning true.

Also tidy up the comment for OnMessage() to document only the return-
false-on-failure path, since the converse (true-on-success) is implicit.

Change-Id: If5f72913465aff40360d3dcc9a88fb8c10fbe237
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2300386
Auto-Submit: Wez <wez@chromium.org>
Reviewed-by: default avatarChris Hamilton <chrisha@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Wez <wez@chromium.org>
Commit-Queue: Kentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#789527}
parent fb56fbc5
......@@ -40,8 +40,9 @@ WebMessagePort::Message::Message(const base::string16& data,
WebMessagePort::MessageReceiver::MessageReceiver() = default;
WebMessagePort::MessageReceiver::~MessageReceiver() = default;
bool WebMessagePort::MessageReceiver::OnMessage(Message) {
return true;
return false;
}
WebMessagePort::WebMessagePort() = default;
......
......@@ -217,9 +217,9 @@ class BLINK_COMMON_EXPORT WebMessagePort::MessageReceiver {
MessageReceiver& operator=(MessageReceiver&&) = delete;
virtual ~MessageReceiver();
// Invoked by incoming messages. This should return true if the message was
// successfully handled, false otherwise. If this returns false the pipe
// will be torn down and a call to OnPipeError will be made.
// Called for each incoming |message|. Returns false if the message could not
// be successfully handled, in which case the pipe should be torn-down and
// OnPipeError() invoked.
virtual bool OnMessage(Message message);
// Invoked when the underlying pipe has experienced an error.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment