Bug 222204 - NSError returned by WebKit API should actually conform to NSSecureCoding
Summary: NSError returned by WebKit API should actually conform to NSSecureCoding
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alex Christensen
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-02-19 14:49 PST by Alex Christensen
Modified: 2021-02-22 11:09 PST (History)
3 users (show)

See Also:


Attachments
Patch (7.53 KB, patch)
2021-02-19 14:52 PST, Alex Christensen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.