Bug 225615 - Promote `-[WKWebView _pageExtendedBackgroundColor]` SPI to `-[WKWebView underPageBackgroundColor]` API
Summary: Promote `-[WKWebView _pageExtendedBackgroundColor]` SPI to `-[WKWebView under...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit API (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Devin Rousso
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-05-10 14:32 PDT by Devin Rousso
Modified: 2021-05-14 14:34 PDT (History)
16 users (show)

See Also:


Attachments
Patch (71.43 KB, patch)
2021-05-10 15:02 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
Patch (71.00 KB, patch)
2021-05-10 18:40 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
[Patch] logging for EWS (76.05 KB, patch)
2021-05-11 12:28 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
[Patch] logging for EWS (76.91 KB, patch)
2021-05-11 16:19 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
[Patch] logging for EWS (75.30 KB, patch)
2021-05-11 20:45 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
[Patch] logging for EWS (76.27 KB, patch)
2021-05-12 00:51 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
Patch (72.28 KB, patch)
2021-05-12 11:32 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
Patch (74.12 KB, patch)
2021-05-14 13:44 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Devin Rousso 2021-05-10 14:32:37 PDT
.
Comment 1 Devin Rousso 2021-05-10 14:32:55 PDT
<rdar://problem/76568094>
Comment 2 Devin Rousso 2021-05-10 15:02:01 PDT
Created attachment 428209 [details]
Patch
Comment 3 Wenson Hsieh 2021-05-10 16:46:40 PDT
Comment on attachment 428209 [details]
Patch

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

> Source/WebCore/page/Page.cpp:2577
> +    if (auto* frameView = mainFrame().view()) {
> +        if (auto* renderView = frameView->renderView()) {

Nit - `if (auto … = makeRefPtr(…))`

> Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:493
> +    return webView.underPageBackgroundColor.CGColor;

We seem to have lost the null check for `webView->_page` here, since `-underPageBackgroundColor` dereferences `_page`.

> Source/WebKit/UIProcess/WebPageProxy.cpp:8622
> +#if !PLATFORM(MAC) && !PLATFORM(IOS_FAMILY)

Nit - !PLATFORM(COCOA)?

> Source/WebKit/UIProcess/WebPageProxy.h:2661
> +    bool m_pendingUnderPageBackgroundColorOverrideToDispatch { false };

Nit - m_hasPendingUnderPageBackgroundColorOverrideToDispatch? (The current name makes it sound like it should be a `Color` or `Optional<Color>`)
Comment 4 Devin Rousso 2021-05-10 16:57:14 PDT
Comment on attachment 428209 [details]
Patch

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

>> Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:493
>> +    return webView.underPageBackgroundColor.CGColor;
> 
> We seem to have lost the null check for `webView->_page` here, since `-underPageBackgroundColor` dereferences `_page`.

Is it ever actually possible for a `WKWebView` to not have a `_page`?
Comment 5 Wenson Hsieh 2021-05-10 17:04:49 PDT
Comment on attachment 428209 [details]
Patch

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

>>> Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:493
>>> +    return webView.underPageBackgroundColor.CGColor;
>> 
>> We seem to have lost the null check for `webView->_page` here, since `-underPageBackgroundColor` dereferences `_page`.
> 
> Is it ever actually possible for a `WKWebView` to not have a `_page`?

`_page` is set very early on when initializing the web view, but it might be theoretically possible for a WebKit client to call into API that requires `_page` before this happens...

Potentially something like trying to `-setBackgroundColor` before calling into the superclass initializer?
Comment 6 Devin Rousso 2021-05-10 18:40:08 PDT
Created attachment 428234 [details]
Patch
Comment 7 Devin Rousso 2021-05-11 12:28:34 PDT
Created attachment 428306 [details]
[Patch] logging for EWS
Comment 8 Devin Rousso 2021-05-11 16:19:23 PDT
Created attachment 428326 [details]
[Patch] logging for EWS
Comment 9 Devin Rousso 2021-05-11 20:45:34 PDT
Created attachment 428339 [details]
[Patch] logging for EWS
Comment 10 Devin Rousso 2021-05-12 00:51:59 PDT
Created attachment 428352 [details]
[Patch] logging for EWS
Comment 11 Devin Rousso 2021-05-12 11:32:20 PDT
Created attachment 428391 [details]
Patch
Comment 12 EWS 2021-05-14 13:35:33 PDT
Tools/Scripts/svn-apply failed to apply attachment 428391 [details] to trunk.
Please resolve the conflicts and upload a new patch.
Comment 13 Devin Rousso 2021-05-14 13:44:49 PDT
Created attachment 428651 [details]
Patch
Comment 14 EWS 2021-05-14 14:34:54 PDT
Committed r277505 (237736@main): <https://commits.webkit.org/237736@main>

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