[webkit-changes] [WebKit/WebKit] d84062: [WPE] Increased memory consumption of WebProcess d...

Przemyslaw Gorszkowski noreply at github.com
Mon Jan 20 00:40:38 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d84062d7b5e2a29f7c29c1edf5bbfcf5eae6935b
      https://github.com/WebKit/WebKit/commit/d84062d7b5e2a29f7c29c1edf5bbfcf5eae6935b
  Author: Przemyslaw Gorszkowski <pgorszkowski at igalia.com>
  Date:   2025-01-20 (Mon, 20 Jan 2025)

  Changed paths:
    M Source/WebCore/inspector/NetworkResourcesData.cpp
    M Source/WebCore/inspector/NetworkResourcesData.h

  Log Message:
  -----------
  [WPE] Increased memory consumption of WebProcess during regular video playback and RWI
https://bugs.webkit.org/show_bug.cgi?id=284108

Reviewed by Devin Rousso.

When WebInspector is used, the downloaded data is cached also for it in NetworkResourcesData.
The single resource data cannot be greater than maximumSingleResourceContentSize (50MB) and
the total size of resources content cannot be greater than maximumResourcesContentSize (200MB).
At the end of downloading the resource, the binary data is decoded to the string represantation
(base64 or other depends on decoder). Decoding process can increased the size of the kept resource
data. The limit maximumSingleResourceContentSize is checked but maximumResourcesContentSize limit
is not checked which can lead to situation that m_contentSize (the total size of resources content)
is greater than maximumResourcesContentSize. This causes that condition checked in
NetworkResourcesData::ensureFreeSpace is invalid because subtraction unsigned values where
first value(minuend) is smaller than the second one(subtrahend) gives a huge number (instead of
negative number).

This change ensures that after decoding binary data into string representation the total size of
resources content (m_contentSize) is not greater than maximumResourcesContentSize. The assert is
added in NetworkResourcesData::ensureFreeSpace to check that m_contentSize is not greater than
maximumResourcesContentSize.

I fixed implementation of function NetworkResourcesData::clear in case passing the preservedLoaderId.
In that case we should update m_requestIdsDeque and m_contentSize and not just clear them.

Additionally I changed the type of m_requestIdsDeque from Deque<String> to ListHashSet<String>.
This change fixes adding to m_requestIdsDeque the same requestId many times.

* Source/WebCore/inspector/NetworkResourcesData.cpp:
(WebCore::NetworkResourcesData::ResourceData::decodeDataToContent):
(WebCore::NetworkResourcesData::setResourceContent):
(WebCore::NetworkResourcesData::maybeAddResourceData):
(WebCore::NetworkResourcesData::maybeDecodeDataToContent):
(WebCore::NetworkResourcesData::clear):
(WebCore::NetworkResourcesData::ensureFreeSpace):
* Source/WebCore/inspector/NetworkResourcesData.h:

Canonical link: https://commits.webkit.org/289143@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list