Bug 174073 - Switch all WebKit API related to favicons from WebIconDatabase over to new WebCore::IconLoader mechanism
Summary: Switch all WebKit API related to favicons from WebIconDatabase over to new We...
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: Brady Eidson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-01 22:13 PDT by Brady Eidson
Modified: 2017-07-03 15:17 PDT (History)
9 users (show)

See Also:


Attachments
Patch (23.04 KB, patch)
2017-07-02 17:12 PDT, Brady Eidson
no flags Details | Formatted Diff | Diff
Patch (23.04 KB, patch)
2017-07-02 18:03 PDT, Brady Eidson
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews101 for mac-elcapitan (348.34 KB, application/zip)
2017-07-02 18:48 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews114 for mac-elcapitan (2.62 MB, application/zip)
2017-07-02 18:58 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews105 for mac-elcapitan-wk2 (1.16 MB, application/zip)
2017-07-02 19:10 PDT, Build Bot
no flags Details
Patch (26.38 KB, patch)
2017-07-02 20:29 PDT, Brady Eidson
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews100 for mac-elcapitan (377.45 KB, application/zip)
2017-07-02 21:15 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews114 for mac-elcapitan (7.36 MB, application/zip)
2017-07-02 21:25 PDT, Build Bot
no flags Details
Patch (26.43 KB, patch)
2017-07-02 22:13 PDT, Brady Eidson
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews100 for mac-elcapitan (674.63 KB, application/zip)
2017-07-02 22:54 PDT, Build Bot
no flags Details
Patch (28.54 KB, patch)
2017-07-02 22:54 PDT, Brady Eidson
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews102 for mac-elcapitan (1.14 MB, application/zip)
2017-07-02 23:33 PDT, Build Bot
no flags Details
Patch (30.98 KB, patch)
2017-07-02 23:46 PDT, Brady Eidson
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews104 for mac-elcapitan-wk2 (1.36 MB, application/zip)
2017-07-03 03:25 PDT, Build Bot
no flags Details
Patch (31.07 KB, patch)
2017-07-03 07:26 PDT, Brady Eidson
no flags Details | Formatted Diff | Diff
Patch (31.21 KB, patch)
2017-07-03 11:15 PDT, Brady Eidson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brady Eidson 2017-07-01 22:13:34 PDT
Switch all WebKit API related to favicons from WebIconDatabase over to new WebCore::IconLoader mechanism

With the test I'm adding over in https://bugs.webkit.org/show_bug.cgi?id=174069, this patch will demonstrate no regressions and - in fact - will show a *progression* in the KVO observation of the mainFrameIcon.

This will also prep us to cut out massive swaths of icondatabase related code.
Comment 1 Brady Eidson 2017-07-02 17:12:37 PDT Comment hidden (obsolete)
Comment 2 Brady Eidson 2017-07-02 18:03:46 PDT Comment hidden (obsolete)
Comment 3 Build Bot 2017-07-02 18:48:46 PDT Comment hidden (obsolete)
Comment 4 Build Bot 2017-07-02 18:48:47 PDT Comment hidden (obsolete)
Comment 5 Build Bot 2017-07-02 18:58:42 PDT Comment hidden (obsolete)
Comment 6 Build Bot 2017-07-02 18:58:43 PDT Comment hidden (obsolete)
Comment 7 Build Bot 2017-07-02 19:10:00 PDT Comment hidden (obsolete)
Comment 8 Build Bot 2017-07-02 19:10:02 PDT Comment hidden (obsolete)
Comment 9 Brady Eidson 2017-07-02 20:04:12 PDT Comment hidden (obsolete)
Comment 10 Brady Eidson 2017-07-02 20:29:20 PDT Comment hidden (obsolete)
Comment 11 Build Bot 2017-07-02 21:15:18 PDT Comment hidden (obsolete)
Comment 12 Build Bot 2017-07-02 21:15:19 PDT Comment hidden (obsolete)
Comment 13 Build Bot 2017-07-02 21:25:00 PDT Comment hidden (obsolete)
Comment 14 Build Bot 2017-07-02 21:25:02 PDT Comment hidden (obsolete)
Comment 15 Brady Eidson 2017-07-02 21:53:35 PDT Comment hidden (obsolete)
Comment 16 Brady Eidson 2017-07-02 21:53:51 PDT Comment hidden (obsolete)
Comment 17 Brady Eidson 2017-07-02 21:54:58 PDT Comment hidden (obsolete)
Comment 18 Brady Eidson 2017-07-02 21:55:17 PDT Comment hidden (obsolete)
Comment 19 Brady Eidson 2017-07-02 22:02:21 PDT Comment hidden (obsolete)
Comment 20 Brady Eidson 2017-07-02 22:13:18 PDT Comment hidden (obsolete)
Comment 21 Brady Eidson 2017-07-02 22:37:58 PDT Comment hidden (obsolete)
Comment 22 Build Bot 2017-07-02 22:54:33 PDT Comment hidden (obsolete)
Comment 23 Build Bot 2017-07-02 22:54:35 PDT Comment hidden (obsolete)
Comment 24 Brady Eidson 2017-07-02 22:54:43 PDT Comment hidden (obsolete)
Comment 25 Brady Eidson 2017-07-02 23:22:43 PDT Comment hidden (obsolete)
Comment 26 Brady Eidson 2017-07-02 23:29:40 PDT Comment hidden (obsolete)
Comment 27 Build Bot 2017-07-02 23:33:48 PDT Comment hidden (obsolete)
Comment 28 Build Bot 2017-07-02 23:33:50 PDT Comment hidden (obsolete)
Comment 29 Brady Eidson 2017-07-02 23:33:58 PDT Comment hidden (obsolete)
Comment 30 Brady Eidson 2017-07-02 23:37:28 PDT Comment hidden (obsolete)
Comment 31 Brady Eidson 2017-07-02 23:41:26 PDT Comment hidden (obsolete)
Comment 32 Brady Eidson 2017-07-02 23:46:07 PDT Comment hidden (obsolete)
Comment 33 Build Bot 2017-07-03 03:25:45 PDT Comment hidden (obsolete)
Comment 34 Build Bot 2017-07-03 03:25:46 PDT Comment hidden (obsolete)
Comment 35 Brady Eidson 2017-07-03 07:22:21 PDT Comment hidden (obsolete)
Comment 36 Brady Eidson 2017-07-03 07:26:43 PDT
Created attachment 314481 [details]
Patch
Comment 37 Andy Estes 2017-07-03 11:01:50 PDT
Comment on attachment 314481 [details]
Patch

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

> Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm:2283
> +    auto* frame = core(m_webFrame.get());
> +    DocumentLoader* documentLoader = frame->loader().documentLoader();
> +    ASSERT(documentLoader);

Can these be references instead of pointers?

> Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm:2289
> +    if (!frame->isMainFrame() || !documentLoader->url().protocolIsInHTTPFamily() || ![WebView _isIconLoadingEnabled] || disallowedDueToImageLoadSettings) {

I'd rewrite this to check disallowedDueToImageLoadSettings first.

> Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm:2299
> +    for (auto icon = icons.rbegin(); icon != icons.rend(); ++icon) {

It's not clear to me why we have to iterate backwards; I'm sure there's a reason.

> Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm:2311
> +    // No WebCore icon loading on iOS
> +    for (auto& icon : icons)
> +        documentLoader->didGetLoadDecisionForIcon(false, icon.second, 0);

Can iOS be handled like the other cases where icon loading is disallowed?

> Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:1794
> +    for (auto& icon : icons)
> +        webPage->send(Messages::WebPageProxy::GetLoadDecisionForIcon(icon.first, CallbackID::fromInteger(icon.second)));

Can this be sent as one message containing all the icons instead of a message for each icon?

> Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h:260
> +    void getLoadDecisionForIcons(const Vector<std::pair<WebCore::LinkIcon&, uint64_t>>&) final;

The vector of pairs could use a typedef.
Comment 38 Brady Eidson 2017-07-03 11:07:49 PDT
(In reply to Andy Estes from comment #37)
> Comment on attachment 314481 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=314481&action=review
> 
> > Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm:2283
> > +    auto* frame = core(m_webFrame.get());
> > +    DocumentLoader* documentLoader = frame->loader().documentLoader();
> > +    ASSERT(documentLoader);
> 
> Can these be references instead of pointers?

You mean at the level of rearchitecting WebFrameLoaderClient?
The WebFrame could be, the DocumentLoader probably not.

You mean in this patch? No.

> > Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm:2289
> > +    if (!frame->isMainFrame() || !documentLoader->url().protocolIsInHTTPFamily() || ![WebView _isIconLoadingEnabled] || disallowedDueToImageLoadSettings) {
> 
> I'd rewrite this to check disallowedDueToImageLoadSettings first.

Yah probably a good call.

> > Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm:2299
> > +    for (auto icon = icons.rbegin(); icon != icons.rend(); ++icon) {
> 
> It's not clear to me why we have to iterate backwards; I'm sure there's a
> reason.

I'll add a comment. It's preserving previous behavior of choosing the last icon listed instead of the first.

> > Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm:2311
> > +    // No WebCore icon loading on iOS
> > +    for (auto& icon : icons)
> > +        documentLoader->didGetLoadDecisionForIcon(false, icon.second, 0);
> 
> Can iOS be handled like the other cases where icon loading is disallowed?

I briefly considered a way of combining the runtime "disallowed" check with the iOS build time behavior.

Every iteration I came up with made the code super ugly.

> > Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:1794
> > +    for (auto& icon : icons)
> > +        webPage->send(Messages::WebPageProxy::GetLoadDecisionForIcon(icon.first, CallbackID::fromInteger(icon.second)));
> 
> Can this be sent as one message containing all the icons instead of a
> message for each icon?

Yes, but that's outside the scope of this patch. (Before this patch the UI process expects one at a time, and the same is true after this patch)
Comment 39 Andy Estes 2017-07-03 11:13:25 PDT
(In reply to Brady Eidson from comment #38)
> (In reply to Andy Estes from comment #37)
> > Comment on attachment 314481 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=314481&action=review
> > 
> > > Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm:2283
> > > +    auto* frame = core(m_webFrame.get());
> > > +    DocumentLoader* documentLoader = frame->loader().documentLoader();
> > > +    ASSERT(documentLoader);
> > 
> > Can these be references instead of pointers?
> 
> You mean at the level of rearchitecting WebFrameLoaderClient?
> The WebFrame could be, the DocumentLoader probably not.
> 
> You mean in this patch? No.

I simply meant:

    auto& frame = *core(m_webFrame.get());
    DocumentLoader& documentLoader = *frame->loader().documentLoader();
Comment 40 Brady Eidson 2017-07-03 11:15:00 PDT
Created attachment 314500 [details]
Patch
Comment 41 Brady Eidson 2017-07-03 14:26:37 PDT
(In reply to Andy Estes from comment #39)
> (In reply to Brady Eidson from comment #38)
> > (In reply to Andy Estes from comment #37)
> > > Comment on attachment 314481 [details]
> > > Patch
> > > 
> > > View in context:
> > > https://bugs.webkit.org/attachment.cgi?id=314481&action=review
> > > 
> > > > Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm:2283
> > > > +    auto* frame = core(m_webFrame.get());
> > > > +    DocumentLoader* documentLoader = frame->loader().documentLoader();
> > > > +    ASSERT(documentLoader);
> > > 
> > > Can these be references instead of pointers?
> > 
> > You mean at the level of rearchitecting WebFrameLoaderClient?
> > The WebFrame could be, the DocumentLoader probably not.
> > 
> > You mean in this patch? No.
> 
> I simply meant:
> 
>     auto& frame = *core(m_webFrame.get());
>     DocumentLoader& documentLoader = *frame->loader().documentLoader();

Oh, no, I much prefer to hold the ASSERT.
Comment 42 WebKit Commit Bot 2017-07-03 15:17:05 PDT
Comment on attachment 314500 [details]
Patch

Clearing flags on attachment: 314500

Committed r219099: <http://trac.webkit.org/changeset/219099>
Comment 43 WebKit Commit Bot 2017-07-03 15:17:07 PDT
All reviewed patches have been landed.  Closing bug.