WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
180367
Web Inspector: modernize InjectedScript a bit
https://bugs.webkit.org/show_bug.cgi?id=180367
Summary
Web Inspector: modernize InjectedScript a bit
Blaze Burg
Reported
2017-12-04 11:27:29 PST
This code uses all kinds of gross out parameters. Start cleaning this mess up. Eventually we should use Expected<T, ErrorString> as the return type for many of the simple return values here that currently use out-params. This probably won't work for generated commands, but those could use std::optional<ErrorString> and drop the first parameter.
Attachments
Patch
(39.18 KB, patch)
2017-12-04 13:41 PST
,
Blaze Burg
timothy
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Blaze Burg
Comment 1
2017-12-04 13:41:09 PST
Created
attachment 328384
[details]
Patch
EWS Watchlist
Comment 2
2017-12-04 13:42:59 PST
Attachment 328384
[details]
did not pass style-queue: ERROR: Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp:115: out_wasThrown is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp:115: out_savedResultIndex is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp:142: out_wasThrown is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp:239: out_savedResultIndex is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/JavaScriptCore/inspector/InjectedScriptBase.cpp:96: out_resultObject is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/JavaScriptCore/inspector/InjectedScriptBase.cpp:96: out_wasThrown is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/JavaScriptCore/inspector/InjectedScriptBase.cpp:96: out_savedResultIndex is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp:830: out_wasThrown is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp:830: out_savedResultIndex is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] Total errors found: 9 in 8 files If any of these errors are false positives, please file a bug against check-webkit-style.
Blaze Burg
Comment 3
2017-12-04 13:43:56 PST
(In reply to Build Bot from
comment #2
)
>
Attachment 328384
[details]
did not pass style-queue: > > > ERROR: Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp:115: > out_wasThrown is incorrectly named. Don't use underscores in your identifier > names. [readability/naming/underscores] [4] > ERROR: Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp:115: > out_savedResultIndex is incorrectly named. Don't use underscores in your > identifier names. [readability/naming/underscores] [4] > ERROR: Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp:142: > out_wasThrown is incorrectly named. Don't use underscores in your identifier > names. [readability/naming/underscores] [4] > ERROR: Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp:239: > out_savedResultIndex is incorrectly named. Don't use underscores in your > identifier names. [readability/naming/underscores] [4] > ERROR: Source/JavaScriptCore/inspector/InjectedScriptBase.cpp:96: > out_resultObject is incorrectly named. Don't use underscores in your > identifier names. [readability/naming/underscores] [4] > ERROR: Source/JavaScriptCore/inspector/InjectedScriptBase.cpp:96: > out_wasThrown is incorrectly named. Don't use underscores in your identifier > names. [readability/naming/underscores] [4] > ERROR: Source/JavaScriptCore/inspector/InjectedScriptBase.cpp:96: > out_savedResultIndex is incorrectly named. Don't use underscores in your > identifier names. [readability/naming/underscores] [4] > ERROR: > Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp:830: > out_wasThrown is incorrectly named. Don't use underscores in your identifier > names. [readability/naming/underscores] [4] > ERROR: > Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp:830: > out_savedResultIndex is incorrectly named. Don't use underscores in your > identifier names. [readability/naming/underscores] [4] > Total errors found: 9 in 8 files > > > If any of these errors are false positives, please file a bug against > check-webkit-style.
Style bot can go jump in a lake. The code reads much, much better with the out_ prefix.
Alex Christensen
Comment 4
2017-12-05 15:08:41 PST
Comment on
attachment 328384
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=328384&action=review
> Source/JavaScriptCore/ChangeLog:10 > + If there is only one out-parameter and a void return type, then return the value.
I think we should return a std::pair or a std::tuple instead of having out_-prefixed variable names.
Timothy Hatcher
Comment 5
2017-12-05 22:39:20 PST
Comment on
attachment 328384
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=328384&action=review
> Source/JavaScriptCore/inspector/InjectedScriptBase.cpp:128 > + out_resultObject = BindingTraits<Protocol::Runtime::RemoteObject>::runtimeCast(resultObject);
Is "out_" prefix the style we use elsewhere? No a fan.
> Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp:127 > + // FIXME: remove this bridging code when generated protocol commands no longer use OptOutput<T>.
Is there a bug you can reference?
> Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp:256 > + // FIXME: remove this bridging code when generated protocol commands no longer use OptOutput<T>.
Ditto.
Blaze Burg
Comment 6
2017-12-08 14:06:17 PST
Comment on
attachment 328384
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=328384&action=review
>> Source/JavaScriptCore/ChangeLog:10 >> + If there is only one out-parameter and a void return type, then return the value. > > I think we should return a std::pair or a std::tuple instead of having out_-prefixed variable names.
This is the longer term goal for where it makes sense, along with using Expected<T, ErrorString> rather than ErrorString as a in-out param everywhere. But my first-order goal is to remove OptOutput and use std::optional in generated signatures. I'm not completely sold on using Tuples instead of out-params in generated protocol code, as it will make it a lot more annoying to use for little gain.
>> Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp:127 >> + // FIXME: remove this bridging code when generated protocol commands no longer use OptOutput<T>. > > Is there a bug you can reference?
I'll add one. It's the next thing I want to clean up.
Blaze Burg
Comment 7
2017-12-12 13:49:17 PST
Committed
r225804
: <
https://trac.webkit.org/changeset/225804
>
Radar WebKit Bug Importer
Comment 8
2017-12-12 13:50:45 PST
<
rdar://problem/36003463
>
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