RESOLVED FIXED204338
[WinCairo] Refine initialization and error handling in RemoteInspectorSocket
https://bugs.webkit.org/show_bug.cgi?id=204338
Summary [WinCairo] Refine initialization and error handling in RemoteInspectorSocket
Yousuke Kimoto
Reported 2019-11-18 18:38:27 PST
RemoteInspectorSocket should handle some error cases to avoid ambiguous conditions.
Attachments
patch (8.49 KB, patch)
2019-11-19 00:08 PST, Yousuke Kimoto
no flags
patch (12.50 KB, patch)
2019-12-06 02:36 PST, Yousuke Kimoto
no flags
Yousuke Kimoto
Comment 1 2019-11-19 00:08:03 PST
Fujii Hironori
Comment 2 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.
Yousuke Kimoto
Comment 3 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.)
Yousuke Kimoto
Comment 4 2019-12-06 02:36:27 PST
Yousuke Kimoto
Comment 5 2019-12-08 17:05:02 PST
Thank you for your review.
WebKit Commit Bot
Comment 6 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>
WebKit Commit Bot
Comment 7 2019-12-08 17:52:27 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 8 2019-12-08 17:53:25 PST
Note You need to log in before you can comment on or make changes to this bug.