Bug 180127

Summary: Adopt updated NSKeyed[Un]Archiver API when available
Product: WebKit Reporter: Brent Fulgham <bfulgham>
Component: WebKit Misc.Assignee: Brent Fulgham <bfulgham>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, bfulgham, cdumez, commit-queue, dbates, ews-watchlist, japhet, jlewis3, ryanhaddad, simon.fraser, thorton
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 178484    
Attachments:
Description Flags
Patch
none
Patch Part 1 (Landed)
none
Patch Part 2
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch none

Description Brent Fulgham 2017-11-28 21:37:11 PST
Update WebKit/WebCore to use updated NSKeyed[Un]Archiver API when available.
Comment 1 Brent Fulgham 2017-11-28 22:07:15 PST
<rdar://problem/35710738>
Comment 2 Brent Fulgham 2017-11-28 22:22:43 PST
Note: This change adopts the new APIs where they match the behavior of existing WebKit code. No attempts are made in this patch to apply NSSecureCoding in places we were not previously.

There should be absolutely no change in behavior with this patch.
Comment 3 Brent Fulgham 2017-11-28 22:38:35 PST
Created attachment 327834 [details]
Patch
Comment 4 Alex Christensen 2017-11-28 23:06:54 PST
Comment on attachment 327834 [details]
Patch

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

r=me with comments.  Don't break anything.

> Source/WebCore/PAL/pal/spi/cocoa/NSKeyedArchiverSPI.h:34
> +#if USE(APPLE_INTERNAL_SDK) && USE(SECURE_BY_DEFAULT_ARCHIVER_API)
> +
> +#import <Foundation/NSKeyedArchiver_Private.h>
> +
> +#else

I think this would look nicer if it were arranged like this:

#if USE(SECURE_BY_DEFAULT_ARCHIVER_API)
#if USE(APPLE_INTERNAL_SDK)
#import <Foundation/NSKeyedArchiver_Private.h>
#else
...
#endif
#endif

I would also call SECURE_BY_DEFAULT_ARCHIVER_API SECURE_ARCHIVER_API

> Source/WebCore/PAL/pal/spi/cocoa/NSKeyedArchiverSPI.h:62
> +#include <wtf/RetainPtr.h>

This looks strange in the middle of the file.  The things below this are also not SPI declarations.  Maybe they could go in a different header.

> Source/WebCore/PAL/pal/spi/cocoa/NSKeyedArchiverSPI.h:77
> +inline NSData *_Nullable archivedDataWithRootObject(id _Nonnull object)

Would it make sense to call this insecurelyArchivedDataWithRootObject to mirror securelyArchivedDataWithRootObject and emphasize that it's insecure?

> Source/WebCore/loader/archive/cf/LegacyWebArchiveMac.mm:49
>      @try {

Could we have this outside of the #if to have mirrored braces?
Comment 5 Brent Fulgham 2017-11-28 23:27:02 PST
Comment on attachment 327834 [details]
Patch

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

>> Source/WebCore/PAL/pal/spi/cocoa/NSKeyedArchiverSPI.h:34
>> +#else
> 
> I think this would look nicer if it were arranged like this:
> 
> #if USE(SECURE_BY_DEFAULT_ARCHIVER_API)
> #if USE(APPLE_INTERNAL_SDK)
> #import <Foundation/NSKeyedArchiver_Private.h>
> #else
> ...
> #endif
> #endif
> 
> I would also call SECURE_BY_DEFAULT_ARCHIVER_API SECURE_ARCHIVER_API

Ok!

>> Source/WebCore/PAL/pal/spi/cocoa/NSKeyedArchiverSPI.h:62
>> +#include <wtf/RetainPtr.h>
> 
> This looks strange in the middle of the file.  The things below this are also not SPI declarations.  Maybe they could go in a different header.

I'll move the #include, but I don't think these utility functions need to be moved. They allow us to build on systems with or without access to this SPI without requiring tons of #if/defs all over our codebase.

>> Source/WebCore/PAL/pal/spi/cocoa/NSKeyedArchiverSPI.h:77
>> +inline NSData *_Nullable archivedDataWithRootObject(id _Nonnull object)
> 
> Would it make sense to call this insecurelyArchivedDataWithRootObject to mirror securelyArchivedDataWithRootObject and emphasize that it's insecure?

Sure -- that's a good idea.

>> Source/WebCore/loader/archive/cf/LegacyWebArchiveMac.mm:49
>>      @try {
> 
> Could we have this outside of the #if to have mirrored braces?

No -- there are differences in the implementations inside the #if/else.
Comment 6 Brent Fulgham 2017-11-28 23:36:26 PST
Created attachment 327839 [details]
Patch Part 1 (Landed)
Comment 7 WebKit Commit Bot 2017-11-28 23:52:51 PST
Comment on attachment 327839 [details]
Patch Part 1 (Landed)

Clearing flags on attachment: 327839

Committed r225264: <https://trac.webkit.org/changeset/225264>
Comment 8 WebKit Commit Bot 2017-11-28 23:52:53 PST
All reviewed patches have been landed.  Closing bug.
Comment 9 Brent Fulgham 2017-11-29 12:44:56 PST
Reopening for a second fix needed for another API call that changed.
Comment 10 Brent Fulgham 2017-11-29 14:25:07 PST
Created attachment 327907 [details]
Patch Part 2
Comment 11 EWS Watchlist 2017-11-29 14:27:29 PST
Attachment 327907 [details] did not pass style-queue:


ERROR: Source/WebKit/Shared/ios/InteractionInformationAtPosition.mm:86:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Total errors found: 1 in 11 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 12 Brent Fulgham 2017-11-29 14:41:48 PST
Created attachment 327909 [details]
Patch
Comment 13 Brent Fulgham 2017-11-29 14:51:26 PST
Created attachment 327913 [details]
Patch
Comment 14 Brent Fulgham 2017-11-29 15:01:30 PST
Created attachment 327914 [details]
Patch
Comment 15 Brent Fulgham 2017-11-29 16:09:20 PST
Simon discovered another deprecation error, so revising the patch.
Comment 16 Brent Fulgham 2017-11-29 16:10:05 PST
Created attachment 327919 [details]
Patch
Comment 17 Brent Fulgham 2017-11-29 16:20:26 PST
Created attachment 327921 [details]
Patch
Comment 18 WebKit Commit Bot 2017-11-29 17:41:00 PST
Comment on attachment 327921 [details]
Patch

Clearing flags on attachment: 327921

Committed r225309: <https://trac.webkit.org/changeset/225309>
Comment 19 WebKit Commit Bot 2017-11-29 17:41:02 PST
All reviewed patches have been landed.  Closing bug.