Bug 200017 - Fix inspector override conversion in InspectorPageAgent::overrideSetting
Summary: Fix inspector override conversion in InspectorPageAgent::overrideSetting
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebRTC (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-07-22 15:26 PDT by youenn fablet
Modified: 2019-07-22 17:01 PDT (History)
5 users (show)

See Also:


Attachments
Patch (3.61 KB, patch)
2019-07-22 15:31 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch for landing (3.52 KB, patch)
2019-07-22 16:14 PDT, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description youenn fablet 2019-07-22 15:26:57 PDT
Fix inspector override conversion in InspectorPageAgent::overrideSetting
Comment 1 Radar WebKit Bug Importer 2019-07-22 15:30:48 PDT
<rdar://problem/53419693>
Comment 2 youenn fablet 2019-07-22 15:31:17 PDT
Created attachment 374643 [details]
Patch
Comment 3 Devin Rousso 2019-07-22 16:00:59 PDT
Comment on attachment 374643 [details]
Patch

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

r=me, nice catch!

> Source/WebCore/ChangeLog:15
> +         Previously, the conversion for the mock capture value was implicit from a bool pointer to an optional.
> +         Make an explicit conversion as done for regular settings.

Style: there seems to be an extra space before each of these lines.

> Source/WebCore/inspector/agents/InspectorPageAgent.cpp:429
> +    return *value;

Style: I prefer using `.value()` with `WTF::Optional` so it's a bit clearer that it's not a pointer.

> Source/WebCore/inspector/agents/InspectorPageAgent.cpp:445
> +    auto overrideValue = toOptionalBool(value);

NIT: Web Inspector typically uses `as*` instead of `to*` for it's type conversions (see `asBool` in InspectorRuntimeAgent.cpp).

> Source/WebCore/inspector/agents/InspectorPageAgent.cpp:448
> +    case Inspector::Protocol::Page::Setting::name: {                            \

NIT: we can remove the `{` and `}` and make this slightly simpler.
Comment 4 youenn fablet 2019-07-22 16:14:21 PDT
Created attachment 374649 [details]
Patch for landing
Comment 5 youenn fablet 2019-07-22 16:23:32 PDT
Done.

> Style: I prefer using `.value()` with `WTF::Optional` so it's a bit clearer
> that it's not a pointer.

I like using pointer-like code, for instance "if(value) value->doSomething()" or "if(value) doSomething(*value)".
The one case I am sometimes using .value() is when moving the value.
"if (value) doSomething(WTFMove(*value))" seems a bit strange.
Comment 6 WebKit Commit Bot 2019-07-22 17:01:11 PDT
Comment on attachment 374649 [details]
Patch for landing

Clearing flags on attachment: 374649

Committed r247707: <https://trac.webkit.org/changeset/247707>
Comment 7 WebKit Commit Bot 2019-07-22 17:01:12 PDT
All reviewed patches have been landed.  Closing bug.