Bug 222204

Summary: NSError returned by WebKit API should actually conform to NSSecureCoding
Product: WebKit Reporter: Alex Christensen <achristensen>
Component: New BugsAssignee: Alex Christensen <achristensen>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, darin, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Alex Christensen 2021-02-19 14:49:29 PST
NSError returned by WebKit API should actually conform to NSSecureCoding
Comment 1 Alex Christensen 2021-02-19 14:52:37 PST
Created attachment 421037 [details]
Patch
Comment 2 Alex Christensen 2021-02-19 14:52:40 PST
<rdar://problem/63893583>
Comment 3 Chris Dumez 2021-02-19 15:14:25 PST
Comment on attachment 421037 [details]
Patch

r=me.
Comment 4 EWS 2021-02-19 16:26:34 PST
Committed r273181: <https://commits.webkit.org/r273181>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 421037 [details].
Comment 5 Darin Adler 2021-02-19 18:27:07 PST
Comment on attachment 421037 [details]
Patch

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

> Source/WebKit/UIProcess/Cocoa/WKReloadFrameErrorRecoveryAttempter.mm:80
> +    return [super init];

What is the advantage of calling [super init] here rather than [self init]?
Comment 6 Alex Christensen 2021-02-22 11:02:27 PST
In this case, I think they are equivalent.  I count 16 calls of [self init] and 464 calls of [super init] in WebKit.
Comment 7 Darin Adler 2021-02-22 11:04:40 PST
(In reply to Alex Christensen from comment #6)
> In this case, I think they are equivalent.  I count 16 calls of [self init]
> and 464 calls of [super init] in WebKit.

I think there are two differences:

1) Calling [super init] calls the init method in the superclass. If the class itself has an init method, it’s ignored, and if the class supports subclassing, the subclass's init method is ignored.

2) Calling [self init] is slightly faster?
Comment 8 Darin Adler 2021-02-22 11:05:09 PST
Typically we only call [super init] in implementations of init methods that do *not* want to call the init in this class.
Comment 9 Alex Christensen 2021-02-22 11:09:11 PST
The pattern I'm familiar with is this:

    if (!(self = [super init]))
        return nil;
    // Initialize all the things in self that are specific to this subclass
    return self;

In this case there is nothing special to initialize in this subclass because all members are default-initialized C++ classes, so I want to return the result of [super init] without doing anything additional to self.

I still think in this case the two are equivalent.