Changeset 252980 in webkit


Ignore:
Timestamp:
Dec 2, 2019 1:40:33 AM (4 years ago)
Author:
Carlos Garcia Campos
Message:

[GTK][PSON] Crash in NetworkProcessProxy::openNetworkProcessConnection
https://bugs.webkit.org/show_bug.cgi?id=204703

Reviewed by Michael Catanzaro.

Stop sending a message to all web process to prefetch DNS for a hostname. All web processes then send a messaage
to their network process to prefetch the DNS. Instead, send a message directly to the network process.

  • NetworkProcess/NetworkProcess.messages.in:
  • UIProcess/API/glib/WebKitWebContext.cpp:

(webkit_web_context_prefetch_dns):

  • WebProcess/InjectedBundle/API/glib/WebKitWebExtension.cpp:
Location:
trunk/Source/WebKit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r252976 r252980  
     12019-12-02  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK][PSON] Crash in NetworkProcessProxy::openNetworkProcessConnection
     4        https://bugs.webkit.org/show_bug.cgi?id=204703
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        Stop sending a message to all web process to prefetch DNS for a hostname. All web processes then send a messaage
     9        to their network process to prefetch the DNS. Instead, send a message directly to the network process.
     10
     11        * NetworkProcess/NetworkProcess.messages.in:
     12        * UIProcess/API/glib/WebKitWebContext.cpp:
     13        (webkit_web_context_prefetch_dns):
     14        * WebProcess/InjectedBundle/API/glib/WebKitWebExtension.cpp:
     15
    1162019-12-01  Fujii Hironori  <Hironori.Fujii@sony.com>
    217
  • trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in

    r252840 r252980  
    3232    UserPreferredLanguagesChanged(Vector<String> languages)
    3333    SetNetworkProxySettings(struct WebCore::SoupNetworkProxySettings settings)
     34    PrefetchDNS(String hostname)
    3435#endif
    3536
  • trunk/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp

    r251181 r252980  
    2828#include "APIString.h"
    2929#include "LegacyGlobalSettings.h"
     30#include "NetworkProcessMessages.h"
    3031#include "TextChecker.h"
    3132#include "TextCheckerState.h"
    3233#include "WebAutomationSession.h"
    3334#include "WebCertificateInfo.h"
     35#include "WebKit2Initialize.h"
    3436#include "WebKitAutomationSessionPrivate.h"
    3537#include "WebKitDownloadClient.h"
     
    6062#include <libintl.h>
    6163#include <memory>
     64#include <pal/HysteresisActivity.h>
    6265#include <wtf/FileSystem.h>
    6366#include <wtf/HashMap.h>
     67#include <wtf/HashSet.h>
    6468#include <wtf/Language.h>
    6569#include <wtf/NeverDestroyed.h>
     
    192196
    193197struct _WebKitWebContextPrivate {
     198    _WebKitWebContextPrivate()
     199        : dnsPrefetchHystereris([this](PAL::HysteresisState state) { if (state == PAL::HysteresisState::Stopped) dnsPrefetchedHosts.clear(); })
     200    {
     201    }
     202
    194203    RefPtr<WebProcessPool> processPool;
    195204    bool clientsDetached;
     
    223232#endif
    224233    std::unique_ptr<WebKitProtocolHandler> webkitProtocolHandler;
     234
     235    HashSet<String> dnsPrefetchedHosts;
     236    PAL::HysteresisActivity dnsPrefetchHystereris;
    225237};
    226238
     
    439451    bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
    440452    bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
     453
     454    InitializeWebKit2();
    441455
    442456    gObjectClass->get_property = webkitWebContextGetProperty;
     
    15531567    g_return_if_fail(hostname);
    15541568
    1555     API::Dictionary::MapType message;
    1556     message.set(String::fromUTF8("Hostname"), API::String::create(String::fromUTF8(hostname)));
    1557     context->priv->processPool->postMessageToInjectedBundle(String::fromUTF8("PrefetchDNS"), API::Dictionary::create(WTFMove(message)).ptr());
     1569    if (context->priv->dnsPrefetchedHosts.add(hostname).isNewEntry)
     1570        context->priv->processPool->sendToNetworkingProcess(Messages::NetworkProcess::PrefetchDNS(String::fromUTF8(hostname)));
     1571    context->priv->dnsPrefetchHystereris.impulse();
    15581572}
    15591573
  • trunk/Source/WebKit/WebProcess/InjectedBundle/API/glib/WebKitWebExtension.cpp

    r251181 r252980  
    199199    }
    200200
    201     void didReceiveMessage(InjectedBundle&, const String& messageName, API::Object* messageBody) override
    202     {
    203         ASSERT(messageBody->type() == API::Object::Type::Dictionary);
    204         API::Dictionary& message = *static_cast<API::Dictionary*>(messageBody);
    205         if (messageName == String::fromUTF8("PrefetchDNS")) {
    206             API::String* hostname = static_cast<API::String*>(message.get(String::fromUTF8("Hostname")));
    207             WebProcess::singleton().prefetchDNS(hostname->string());
    208         } else
    209             ASSERT_NOT_REACHED();
    210     }
    211 
    212201    void didReceiveMessageToPage(InjectedBundle&, WebPage& page, const String& messageName, API::Object* messageBody) override
    213202    {
Note: See TracChangeset for help on using the changeset viewer.