WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
202421
Socket RWI client should acquire backend commands from server
https://bugs.webkit.org/show_bug.cgi?id=202421
Summary
Socket RWI client should acquire backend commands from server
Ross Kirsling
Reported
2019-10-01 12:26:13 PDT
Socket RWI client should acquire backend commands from server
Attachments
Patch
(14.63 KB, patch)
2019-10-01 12:54 PDT
,
Ross Kirsling
no flags
Details
Formatted Diff
Diff
Patch
(81.91 KB, patch)
2019-10-01 16:30 PDT
,
Ross Kirsling
no flags
Details
Formatted Diff
Diff
Patch
(83.49 KB, patch)
2019-10-01 18:01 PDT
,
Ross Kirsling
no flags
Details
Formatted Diff
Diff
Patch
(87.88 KB, patch)
2019-10-01 18:47 PDT
,
Ross Kirsling
no flags
Details
Formatted Diff
Diff
Patch
(89.88 KB, patch)
2019-10-01 19:04 PDT
,
Ross Kirsling
no flags
Details
Formatted Diff
Diff
Patch
(9.82 KB, patch)
2019-10-02 13:53 PDT
,
Ross Kirsling
no flags
Details
Formatted Diff
Diff
Patch for landing
(9.79 KB, patch)
2019-10-03 13:54 PDT
,
Ross Kirsling
no flags
Details
Formatted Diff
Diff
Show Obsolete
(6)
View All
Add attachment
proposed patch, testcase, etc.
Ross Kirsling
Comment 1
2019-10-01 12:54:17 PDT
Created
attachment 379935
[details]
Patch
EWS Watchlist
Comment 2
2019-10-01 12:54:38 PDT
This patch modifies the inspector protocol generator. Please ensure that you have rebaselined any generator test results (i.e., by running `Tools/Scripts/run-inspector-generator-tests --reset-results`)
Basuke Suzuki
Comment 3
2019-10-01 13:11:36 PDT
***
Bug 199016
has been marked as a duplicate of this bug. ***
Basuke Suzuki
Comment 4
2019-10-01 13:20:41 PDT
Comment on
attachment 379935
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=379935&action=review
This is informal review.
> Source/JavaScriptCore/inspector/remote/socket/RemoteInspectorServer.cpp:134 > +bool RemoteInspectorServer::start(const char* address, uint16_t port, String&& backendCommandsPath)
PlayStation port doesn't require this argument. I think it is better to add another method to set m_backendCommandsPath. It shouldn't be too late if the path is set just after start().
> Source/JavaScriptCore/inspector/remote/socket/RemoteInspectorServer.h:43 > + JS_EXPORT_PRIVATE bool start(const char* address, uint16_t port, String&& backendCommandsPath = String());
Ditto.
> Source/WebKit/UIProcess/win/WebProcessPoolWin.cpp:68 > + Inspector::RemoteInspectorServer::singleton().start(host.utf8().data(), port.value(), backendCommandsPath());
Ditto
Devin Rousso
Comment 5
2019-10-01 13:26:55 PDT
Comment on
attachment 379935
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=379935&action=review
> Source/JavaScriptCore/inspector/remote/socket/RemoteInspectorServer.cpp:268 > + if (!m_backendCommandsPath)
Should this be `isEmpty()`?
> Source/JavaScriptCore/inspector/remote/socket/RemoteInspectorServer.cpp:269 > + return String();
You can use `{ }` instead.
> Source/JavaScriptCore/inspector/remote/socket/RemoteInspectorServer.cpp:273 > + return String();
Ditto
> Source/JavaScriptCore/inspector/remote/socket/RemoteInspectorServer.cpp:278 > + return String();
Ditto
> Source/JavaScriptCore/inspector/remote/socket/RemoteInspectorServer.cpp:283 > + FileSystem::readFromFile(handle, buffer.data(), size);
Should we be early-returning with a `String()` if this returns `-1`?
> Source/JavaScriptCore/inspector/remote/socket/RemoteInspectorServer.h:43 > + JS_EXPORT_PRIVATE bool start(const char* address, uint16_t port, String&& backendCommandsPath = String());
I don't think we should have a fallback for this. I'd expect any callers to provide a `backendCommandsPath` (which is what it looks like is done now already). Are there other callers of this that don't provide a `backendCommandsPath`?
> Source/JavaScriptCore/inspector/scripts/codegen/generate_js_backend_commands.py:158 > +class CppBackendCommandsGenerator(JSBackendCommandsGenerator):
I think we'd prefer if you moved this into a separate file 'generate_cpp_backend_commands.py'.
> Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py:166 > + generators.append(CppBackendCommandsGenerator(*generator_arguments))
Please include this for "Frameworks.Test" too. We should also probably have some sort of testing for this, especially since you do some character replacements for the C++ string.
> Source/WebKit/UIProcess/socket/RemoteInspectorClient.cpp:191 > +void RemoteInspectorClient::setBackendCommands(const Event& event)
I think this signature is missing from the header 'RemoateInspectorClient.h'.
> Source/WebKit/UIProcess/socket/RemoteInspectorClient.cpp:196 > + m_backendCommandsURL = makeString("data:text/javascript;base64,", *event.message);
Style: I think we prefer using `.value()` for `Optional` instead of `*`.
> Source/WebKit/UIProcess/win/WebProcessPoolWin.cpp:45 > + return String();
Ditto
> Source/WebKit/UIProcess/win/WebProcessPoolWin.cpp:49 > + return String();
Ditto
> Source/WebKit/UIProcess/win/WebProcessPoolWin.cpp:51 > + return String(path);
Do you need to explicitly construct the `String`, or can it be implicit?
Ross Kirsling
Comment 6
2019-10-01 15:17:45 PDT
(In reply to Devin Rousso from
comment #5
)
> > Source/JavaScriptCore/inspector/remote/socket/RemoteInspectorServer.h:43 > > + JS_EXPORT_PRIVATE bool start(const char* address, uint16_t port, String&& backendCommandsPath = String()); > > I don't think we should have a fallback for this. I'd expect any callers to > provide a `backendCommandsPath` (which is what it looks like is done now > already). Are there other callers of this that don't provide a > `backendCommandsPath`?
It's just PS that uses the C++ copy instead of the path to the JS resource, so yeah, I'll split that out as Basuke also suggested.
> > Source/JavaScriptCore/inspector/scripts/generate-inspector-protocol-bindings.py:166 > > + generators.append(CppBackendCommandsGenerator(*generator_arguments)) > > Please include this for "Frameworks.Test" too. We should also probably have > some sort of testing for this, especially since you do some character > replacements for the C++ string.
Er, now that you mention it, we shouldn't be doing these string replaces at all, since C++11 has raw strings.
> > Source/WebKit/UIProcess/socket/RemoteInspectorClient.cpp:191 > > +void RemoteInspectorClient::setBackendCommands(const Event& event) > > I think this signature is missing from the header 'RemoateInspectorClient.h'.
Oddly enough, it's already there and just not implemented.
Ross Kirsling
Comment 7
2019-10-01 16:30:10 PDT
Created
attachment 379964
[details]
Patch
Ross Kirsling
Comment 8
2019-10-01 16:32:09 PDT
Comment on
attachment 379964
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=379964&action=review
> Source/JavaScriptCore/inspector/remote/socket/RemoteInspectorServer.cpp:265 > + return s_inspectorBackendCommandsString ? s_inspectorBackendCommandsString : String();
Style note: Apparently initializer lists aren't syntactically valid inside ternary branches. :(
Ross Kirsling
Comment 9
2019-10-01 18:01:38 PDT
Created
attachment 379976
[details]
Patch
Ross Kirsling
Comment 10
2019-10-01 18:47:03 PDT
Created
attachment 379978
[details]
Patch
Ross Kirsling
Comment 11
2019-10-01 19:04:59 PDT
Created
attachment 379979
[details]
Patch
Ross Kirsling
Comment 12
2019-10-01 19:22:39 PDT
Sigh...no matter how many files I add, it doesn't please iOS. I'm sure that in itself is fixable, but this all feels like a ton of Xcode wiring for something that we have no particular expectation of ever using outside of PlayStation port.
Ross Kirsling
Comment 13
2019-10-02 13:53:18 PDT
Created
attachment 380054
[details]
Patch
Ross Kirsling
Comment 14
2019-10-02 13:53:52 PDT
Here's the patch without any special support for PlayStation port -- we can deal with that stuff at a later date.
Devin Rousso
Comment 15
2019-10-03 08:53:58 PDT
Comment on
attachment 380054
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=380054&action=review
r=me
> Source/JavaScriptCore/inspector/remote/socket/RemoteInspectorServer.cpp:263 > + auto handle = FileSystem::openFile(m_backendCommandsPath, FileSystem::FileOpenMode::Read);
NIT: I would reorganize this function a bit so you can better ensure that `FileSystem::closeFile` gets called: ``` if (m_backendCommandsPath.isEmpty()) return { }; auto handle = FileSystem::openFile(m_backendCommandsPath, FileSystem::FileOpenMode::Read); if (!FileSystem::isHandleValid(handle)) return { }; String result; long long size; if (FileSystem::getFileSize(handle, size)) { Vector<char> buffer(size); auto bytesRead = FileSystem::readFromFile(handle, buffer.data(), size); result = String::adopt(WTFMove(buffer)); } FileSystem::closeFile(handle); return result; ```
Ross Kirsling
Comment 16
2019-10-03 11:50:53 PDT
Unfortunately it doesn't seem like String::adopt can handle a Vector of char, which is the type used by FileSystem::readFromFile.
Ross Kirsling
Comment 17
2019-10-03 13:52:48 PDT
(In reply to Ross Kirsling from
comment #16
)
> Unfortunately it doesn't seem like String::adopt can handle a Vector of > char, which is the type used by FileSystem::readFromFile.
(Nevermind, I can reinterpret_cast from LChar...)
Ross Kirsling
Comment 18
2019-10-03 13:54:03 PDT
Created
attachment 380159
[details]
Patch for landing
WebKit Commit Bot
Comment 19
2019-10-03 14:37:54 PDT
Comment on
attachment 380159
[details]
Patch for landing Clearing flags on attachment: 380159 Committed
r250679
: <
https://trac.webkit.org/changeset/250679
>
WebKit Commit Bot
Comment 20
2019-10-03 14:37:56 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 21
2019-10-03 14:38:24 PDT
<
rdar://problem/55961622
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug