Bug 220394

Summary: Use smart pointers in UIDelegate and NavigationState
Product: WebKit Reporter: Alex Christensen <achristensen>
Component: New BugsAssignee: Alex Christensen <achristensen>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, ggaren, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
ews-feeder: commit-queue-
Patch
ews-feeder: commit-queue-
Patch
ews-feeder: commit-queue-
Patch
none
Patch none

Description Alex Christensen 2021-01-06 17:47:55 PST
Protect WebPageProxy in didFinishLoadForFrame
Comment 1 Alex Christensen 2021-01-06 17:49:22 PST
Created attachment 417144 [details]
Patch
Comment 2 Alex Christensen 2021-01-06 17:49:25 PST
<rdar://problem/72496374>
Comment 3 Chris Dumez 2021-01-07 08:31:45 PST
Comment on attachment 417144 [details]
Patch

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

> Source/WebKit/UIProcess/WebPageProxy.cpp:4770
> +    auto protectedThis = makeRef(*this);

This is unnecessary in functions called via IPC. We solved it at a global level years ago. If you look at WebPageProxy::didReceiveMessage() in generated code, you will see:
auto protectedThis = makeRef(*this);

We protect the WebPageProxy while calling every function due to an IPC message.
Comment 4 Alex Christensen 2021-01-07 10:38:37 PST
Created attachment 417187 [details]
Patch
Comment 5 Alex Christensen 2021-01-07 10:53:05 PST
Created attachment 417189 [details]
Patch
Comment 6 Alex Christensen 2021-01-07 11:25:07 PST
Created attachment 417192 [details]
Patch
Comment 7 Alex Christensen 2021-01-07 12:18:01 PST
Created attachment 417198 [details]
Patch
Comment 8 Geoffrey Garen 2021-01-07 12:50:07 PST
Comment on attachment 417198 [details]
Patch

r=me

Smart pointer is definitely better than raw pointer here. Would be nice in the future just to make this lifetime mismatch impossible.
Comment 9 Alex Christensen 2021-01-07 13:53:40 PST
Comment on attachment 417198 [details]
Patch

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

> Source/WebKit/UIProcess/Cocoa/UIDelegate.mm:408
> -        return;
> +        return completionHandler(false);

Surprisingly this changed behavior in an undesirable way.  Will revert.
Comment 10 Alex Christensen 2021-01-07 13:53:52 PST
Created attachment 417209 [details]
Patch
Comment 11 EWS 2021-01-07 15:10:55 PST
Committed r271264: <https://trac.webkit.org/changeset/271264>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 417209 [details].