[webkit-help] Triggering icon load after FrameLoaderClient::dispatchDidChangeIcons event

Konstantin Tokarev annulen at yandex.ru
Fri Apr 21 05:17:28 PDT 2017


Hello,

I'm trying to support dynamic updates of favicon in WebKit1 (Qt port), like
what happens in the following example:

<html>
  <head>
    <link rel="shortcut icon" href="https://0x0.st/xgW.ico"/>
    <script>
updateIcon = function() {
    var link = document.querySelector("link[rel*='icon']")
    link.href = 'https://0x0.st/xgV.ico';
};
    </script>                                                                                                                                             
  </head>                                                                                                                                                   
  <body>                                                                                                                                                    
    <input type="button" onClick="updateIcon()" value="Click me!"/>
  </body>
</html>

I've found that FrameLoaderClient::dispatchDidChangeIcons() is called in this
case, however FrameLoaderClient::dispatchDidReceiveIcon() is not, and
icon inside IconDatabase is not updated.

I've found that doing the following call in my overload of dispatchDidChangeIcons
fixes things:

  m_frame->loader().icon().startLoader();

(where m_frame is WebCore::Frame)

Is it the right thng to do? I see startLoader is called only inside Document, this makes
me wonder if there is any layering violation here.

Thanks in advance!

-- 
Regards,
Konstantin


More information about the webkit-help mailing list