Bug 184433

Summary: Refactor Ignore HSTS code
Product: WebKit Reporter: John Wilander <wilander>
Component: WebKit Misc.Assignee: John Wilander <wilander>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, commit-queue, darin, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=184335
Attachments:
Description Flags
Patch
none
Patch for landing none

Description John Wilander 2018-04-09 16:38:43 PDT
Darin Adler pointed out in https://bugs.webkit.org/show_bug.cgi?id=184335 that we might have subtle bugs in the ignore HSTS code due to type conversion. He also suggested moving non-SPI code out of the CFNetwork SPI header. This bug tracks that work.
Comment 1 Radar WebKit Bug Importer 2018-04-09 16:39:23 PDT
<rdar://problem/39298238>
Comment 2 John Wilander 2018-04-09 17:55:30 PDT
Created attachment 337565 [details]
Patch
Comment 3 Darin Adler 2018-04-09 18:40:49 PDT
Comment on attachment 337565 [details]
Patch

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

> Source/WebCore/platform/network/mac/WebCoreURLResponse.mm:337
> +    return [request respondsToSelector:@selector(_schemeWasUpgradedDueToDynamicHSTS)]
> +    && [request _schemeWasUpgradedDueToDynamicHSTS];

Should fix indentation of the second line, indent by 4 spaces.

> Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm:189
> +    return [request respondsToSelector:@selector(_schemeWasUpgradedDueToDynamicHSTS)]
> +    && [request _schemeWasUpgradedDueToDynamicHSTS];

Should fix indentation of the second line, indent by 4 spaces.

> Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm:197
> +    if ([request respondsToSelector:@selector(_setIgnoreHSTS:)]) {
> +        BOOL ignoreHSTSParameter = ignoreHSTS;
> +        [request _setIgnoreHSTS:ignoreHSTSParameter];
> +    }

This local BOOL is not needed here. It *was* needed for wtfObjcMsgSend, but here you can just pass the bool ignoreHSTS and it will be converted to a BOOL. Thus no braces needed either.

> Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm:203
> +    return [request respondsToSelector:@selector(_ignoreHSTS)]
> +    && [request _ignoreHSTS];

Should fix indentation of the second line, indent by 4 spaces.
Comment 4 John Wilander 2018-04-09 20:06:35 PDT
Created attachment 337579 [details]
Patch for landing
Comment 5 John Wilander 2018-04-09 20:07:09 PDT
Thanks for the review and change suggestions, Darin!
Comment 6 WebKit Commit Bot 2018-04-09 20:43:51 PDT
Comment on attachment 337579 [details]
Patch for landing

Clearing flags on attachment: 337579

Committed r230467: <https://trac.webkit.org/changeset/230467>
Comment 7 WebKit Commit Bot 2018-04-09 20:43:53 PDT
All reviewed patches have been landed.  Closing bug.