Changeset 260382 in webkit


Ignore:
Timestamp:
Apr 20, 2020 11:43:45 AM (4 years ago)
Author:
Chris Dumez
Message:

Sending beacons when Fetch KeepAlive feature is disabled crashes the WebProcess
https://bugs.webkit.org/show_bug.cgi?id=210753
<rdar://problem/61896221>

Reviewed by Geoffrey Garen.

Source/WebCore:

Test: http/wpt/beacon/beacon-legacy-code-path.html

  • testing/InternalSettings.cpp:

(WebCore::InternalSettings::Backup::Backup):
(WebCore::InternalSettings::Backup::restoreTo):
(WebCore::InternalSettings::setFetchAPIKeepAliveEnabled):

  • testing/InternalSettings.h:
  • testing/InternalSettings.idl:

Add internal settings to disable Fetch Keep Alive for layout testing.

Source/WebKit:

  • WebProcess/Network/WebLoaderStrategy.cpp:

(WebKit::WebLoaderStrategy::startPingLoad):
Make sure NetworkResourceLoadParameters's webPageProxyID / webPageID / webFrameID are properly
initialized before sending the IPC or IPC decoding will fail.

LayoutTests:

Add layout test coverage.

  • http/wpt/beacon/beacon-legacy-code-path-expected.txt: Added.
  • http/wpt/beacon/beacon-legacy-code-path.html: Added.
Location:
trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r260380 r260382  
     12020-04-20  Chris Dumez  <cdumez@apple.com>
     2
     3        Sending beacons when Fetch KeepAlive feature is disabled crashes the WebProcess
     4        https://bugs.webkit.org/show_bug.cgi?id=210753
     5        <rdar://problem/61896221>
     6
     7        Reviewed by Geoffrey Garen.
     8
     9        Add layout test coverage.
     10
     11        * http/wpt/beacon/beacon-legacy-code-path-expected.txt: Added.
     12        * http/wpt/beacon/beacon-legacy-code-path.html: Added.
     13
    1142020-04-20  Youenn Fablet  <youenn@apple.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r260380 r260382  
     12020-04-20  Chris Dumez  <cdumez@apple.com>
     2
     3        Sending beacons when Fetch KeepAlive feature is disabled crashes the WebProcess
     4        https://bugs.webkit.org/show_bug.cgi?id=210753
     5        <rdar://problem/61896221>
     6
     7        Reviewed by Geoffrey Garen.
     8
     9        Test: http/wpt/beacon/beacon-legacy-code-path.html
     10
     11        * testing/InternalSettings.cpp:
     12        (WebCore::InternalSettings::Backup::Backup):
     13        (WebCore::InternalSettings::Backup::restoreTo):
     14        (WebCore::InternalSettings::setFetchAPIKeepAliveEnabled):
     15        * testing/InternalSettings.h:
     16        * testing/InternalSettings.idl:
     17        Add internal settings to disable Fetch Keep Alive for layout testing.
     18
    1192020-04-20  Youenn Fablet  <youenn@apple.com>
    220
  • trunk/Source/WebCore/testing/InternalSettings.cpp

    r255342 r260382  
    120120    , m_setScreenCaptureEnabled(RuntimeEnabledFeatures::sharedFeatures().screenCaptureEnabled())
    121121#endif
     122    , m_fetchAPIKeepAliveAPIEnabled(RuntimeEnabledFeatures::sharedFeatures().fetchAPIKeepAliveEnabled())
    122123    , m_shouldMockBoldSystemFontForAccessibility(RenderTheme::singleton().shouldMockBoldSystemFontForAccessibility())
    123124#if USE(AUDIO_SESSION)
     
    223224    RuntimeEnabledFeatures::sharedFeatures().setScreenCaptureEnabled(m_setScreenCaptureEnabled);
    224225#endif
     226    RuntimeEnabledFeatures::sharedFeatures().setFetchAPIKeepAliveEnabled(m_fetchAPIKeepAliveAPIEnabled);
    225227    RuntimeEnabledFeatures::sharedFeatures().setCustomPasteboardDataEnabled(m_customPasteboardDataEnabled);
    226228
     
    810812}
    811813
     814void InternalSettings::setFetchAPIKeepAliveEnabled(bool enabled)
     815{
     816    RuntimeEnabledFeatures::sharedFeatures().setFetchAPIKeepAliveEnabled(enabled);
     817}
     818
    812819ExceptionOr<String> InternalSettings::userInterfaceDirectionPolicy()
    813820{
  • trunk/Source/WebCore/testing/InternalSettings.h

    r255241 r260382  
    132132    static void setPictureInPictureAPIEnabled(bool);
    133133    static void setScreenCaptureEnabled(bool);
     134    static void setFetchAPIKeepAliveEnabled(bool);
    134135
    135136    static bool webAnimationsCSSIntegrationEnabled();
     
    221222        bool m_webGL2Enabled;
    222223        bool m_setScreenCaptureEnabled;
     224        bool m_fetchAPIKeepAliveAPIEnabled;
    223225       
    224226        bool m_shouldMockBoldSystemFontForAccessibility;
  • trunk/Source/WebCore/testing/InternalSettings.idl

    r255241 r260382  
    9898    void setWebGPUEnabled(boolean enabled);
    9999    void setScreenCaptureEnabled(boolean enabled);
     100    void setFetchAPIKeepAliveEnabled(boolean enabled);
    100101
    101102    [MayThrowException] DOMString userInterfaceDirectionPolicy();
  • trunk/Source/WebKit/ChangeLog

    r260381 r260382  
     12020-04-20  Chris Dumez  <cdumez@apple.com>
     2
     3        Sending beacons when Fetch KeepAlive feature is disabled crashes the WebProcess
     4        https://bugs.webkit.org/show_bug.cgi?id=210753
     5        <rdar://problem/61896221>
     6
     7        Reviewed by Geoffrey Garen.
     8
     9        * WebProcess/Network/WebLoaderStrategy.cpp:
     10        (WebKit::WebLoaderStrategy::startPingLoad):
     11        Make sure NetworkResourceLoadParameters's webPageProxyID / webPageID / webFrameID are properly
     12        initialized before sending the IPC or IPC decoding will fail.
     13
    1142020-04-20  David Kilzer  <ddkilzer@apple.com>
    215
  • trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp

    r260283 r260382  
    640640void WebLoaderStrategy::startPingLoad(Frame& frame, ResourceRequest& request, const HTTPHeaderMap& originalRequestHeaders, const FetchOptions& options, ContentSecurityPolicyImposition policyCheck, PingLoadCompletionHandler&& completionHandler)
    641641{
     642    auto* webFrame = WebFrame::fromCoreFrame(frame);
    642643    auto* document = frame.document();
    643     if (!document) {
     644    if (!document || !webFrame) {
    644645        if (completionHandler)
    645646            completionHandler(internalError(request.url()), { });
     
    647648    }
    648649
     650    auto* webPage = webFrame->page();
     651    if (!webPage) {
     652        if (completionHandler)
     653            completionHandler(internalError(request.url()), { });
     654        return;
     655    }
     656
    649657    NetworkResourceLoadParameters loadParameters;
    650658    loadParameters.identifier = generateLoadIdentifier();
     659    loadParameters.webPageProxyID = webPage->webPageProxyIdentifier();
     660    loadParameters.webPageID = webPage->identifier();
     661    loadParameters.webFrameID = webFrame->frameID();
    651662    loadParameters.request = request;
    652663    loadParameters.sourceOrigin = &document->securityOrigin();
     
    667678    addParametersShared(&frame, loadParameters);
    668679   
    669     auto* webFrameLoaderClient = toWebFrameLoaderClient(frame.loader().client());
    670     auto* webFrame = webFrameLoaderClient ? &webFrameLoaderClient->webFrame() : nullptr;
    671     auto* webPage = webFrame ? webFrame->page() : nullptr;
    672     if (webPage)
    673         loadParameters.isNavigatingToAppBoundDomain = webPage->isNavigatingToAppBoundDomain();
     680    loadParameters.isNavigatingToAppBoundDomain = webPage->isNavigatingToAppBoundDomain();
    674681   
    675682#if ENABLE(CONTENT_EXTENSIONS)
    676683    loadParameters.mainDocumentURL = document->topDocument().url();
    677684    // FIXME: Instead of passing userContentControllerIdentifier, we should just pass webPageId to NetworkProcess.
    678     if (webPage)
    679         loadParameters.userContentControllerIdentifier = webPage->userContentControllerIdentifier();
     685    loadParameters.userContentControllerIdentifier = webPage->userContentControllerIdentifier();
    680686#endif
    681687
Note: See TracChangeset for help on using the changeset viewer.