Bug 204338 - [WinCairo] Refine initialization and error handling in RemoteInspectorSocket
Summary: [WinCairo] Refine initialization and error handling in RemoteInspectorSocket
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-11-18 18:38 PST by Yousuke Kimoto
Modified: 2019-12-08 17:53 PST (History)
12 users (show)

See Also:


Attachments
patch (8.49 KB, patch)
2019-11-19 00:08 PST, Yousuke Kimoto
no flags Details | Formatted Diff | Diff
patch (12.50 KB, patch)
2019-12-06 02:36 PST, Yousuke Kimoto
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yousuke Kimoto 2019-11-18 18:38:27 PST
RemoteInspectorSocket should handle some error cases to avoid ambiguous conditions.
Comment 1 Yousuke Kimoto 2019-11-19 00:08:03 PST
Created attachment 383849 [details]
patch
Comment 2 Fujii Hironori 2019-12-05 00:26:55 PST
Comment on attachment 383849 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=383849&action=review

> Source/JavaScriptCore/inspector/remote/socket/win/RemoteInspectorSocketWin.cpp:221
> +        LOG_ERROR("createPair() error at getting server port (errno = %d)", WSAGetLastError());

You don't need to include the function name "createPair()" in LOG_ERROR message because it contains.

#define LOG_ERROR(...) WTFReportError(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, __VA_ARGS__)

I think this LOG_ERROR is unnecessary because getPort prints log if it'd fail.

> Source/JavaScriptCore/inspector/remote/socket/win/RemoteInspectorSocketWin.cpp:224
> +    address.sin_port = htons((u_short)*serverPort);

Why did you add this cast (u_short)? I think it's unnecessary. And, WebKit is merely using C style cast. Use static_cast<u_short>() if needed.
Comment 3 Yousuke Kimoto 2019-12-06 02:35:35 PST
(In reply to Fujii Hironori from comment #2)
> > Source/JavaScriptCore/inspector/remote/socket/win/RemoteInspectorSocketWin.cpp:221
> > +        LOG_ERROR("createPair() error at getting server port (errno = %d)", WSAGetLastError());
> 
> You don't need to include the function name "createPair()" in LOG_ERROR
> message because it contains.
I understand, and delete the redundant error message.

> #define LOG_ERROR(...) WTFReportError(__FILE__, __LINE__,
> WTF_PRETTY_FUNCTION, __VA_ARGS__)
> 
> I think this LOG_ERROR is unnecessary because getPort prints log if it'd
> fail.
Actually getPort() in RemoteInspectorSocketWin.cpp doesn't print an error message though (getPort() in RemoteInspectorSocketPOSIX.cpp has it), it is a good style that the function prints the message.
  
> > Source/JavaScriptCore/inspector/remote/socket/win/RemoteInspectorSocketWin.cpp:224
> > +    address.sin_port = htons((u_short)*serverPort);
> 
> Why did you add this cast (u_short)? I think it's unnecessary. And, WebKit
> is merely using C style cast. Use static_cast<u_short>() if needed.
Right, it's unnecessary. (I saw a cast warning at the line, but it seemed I was confused.)
Comment 4 Yousuke Kimoto 2019-12-06 02:36:27 PST
Created attachment 384998 [details]
patch
Comment 5 Yousuke Kimoto 2019-12-08 17:05:02 PST
Thank you for your review.
Comment 6 WebKit Commit Bot 2019-12-08 17:52:25 PST
Comment on attachment 384998 [details]
patch

Clearing flags on attachment: 384998

Committed r253281: <https://trac.webkit.org/changeset/253281>
Comment 7 WebKit Commit Bot 2019-12-08 17:52:27 PST
All reviewed patches have been landed.  Closing bug.
Comment 8 Radar WebKit Bug Importer 2019-12-08 17:53:25 PST
<rdar://problem/57737371>