Title: [263231] trunk/Source/WebCore
- Revision
- 263231
- Author
- drou...@apple.com
- Date
- 2020-06-18 15:11:22 -0700 (Thu, 18 Jun 2020)
Log Message
Web Inspector: ASSERTION FAILED: decodedLength >= dataLength at WebCore::NetworkResourcesData::ResourceData::decodeDataToContent()
https://bugs.webkit.org/show_bug.cgi?id=213271
<rdar://problem/64168350>
Reviewed by Brian Burg.
Remove the invalid `ASSERT(decodedLength >= dataLength)` as it's very possible for decoded
content to be smaller than encoded content (e.g. something gzipped).
Use `String::sizeInBytes` instead of `StringImpl::sizeInBytes` as the latter also includes
`sizeof(*this)`, which is not really part of the resource's size, as it's really more of an
implementation detail.
* inspector/NetworkResourcesData.h:
* inspector/NetworkResourcesData.cpp:
(WebCore::NetworkResourcesData::ResourceData::removeContent):
(WebCore::NetworkResourcesData::ResourceData::decodeDataToContent):
(WebCore::NetworkResourcesData::setResourceContent):
(WebCore::NetworkResourcesData::maybeDecodeDataToContent):
(WebCore::contentSizeInBytes): Deleted.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (263230 => 263231)
--- trunk/Source/WebCore/ChangeLog 2020-06-18 21:54:49 UTC (rev 263230)
+++ trunk/Source/WebCore/ChangeLog 2020-06-18 22:11:22 UTC (rev 263231)
@@ -1,3 +1,26 @@
+2020-06-18 Devin Rousso <drou...@apple.com>
+
+ Web Inspector: ASSERTION FAILED: decodedLength >= dataLength at WebCore::NetworkResourcesData::ResourceData::decodeDataToContent()
+ https://bugs.webkit.org/show_bug.cgi?id=213271
+ <rdar://problem/64168350>
+
+ Reviewed by Brian Burg.
+
+ Remove the invalid `ASSERT(decodedLength >= dataLength)` as it's very possible for decoded
+ content to be smaller than encoded content (e.g. something gzipped).
+
+ Use `String::sizeInBytes` instead of `StringImpl::sizeInBytes` as the latter also includes
+ `sizeof(*this)`, which is not really part of the resource's size, as it's really more of an
+ implementation detail.
+
+ * inspector/NetworkResourcesData.h:
+ * inspector/NetworkResourcesData.cpp:
+ (WebCore::NetworkResourcesData::ResourceData::removeContent):
+ (WebCore::NetworkResourcesData::ResourceData::decodeDataToContent):
+ (WebCore::NetworkResourcesData::setResourceContent):
+ (WebCore::NetworkResourcesData::maybeDecodeDataToContent):
+ (WebCore::contentSizeInBytes): Deleted.
+
2020-06-18 Andy Estes <aes...@apple.com>
[Apple Pay] Fix a log message typo in PaymentCoordinator::didAuthorizePayment
Modified: trunk/Source/WebCore/inspector/NetworkResourcesData.cpp (263230 => 263231)
--- trunk/Source/WebCore/inspector/NetworkResourcesData.cpp 2020-06-18 21:54:49 UTC (rev 263230)
+++ trunk/Source/WebCore/inspector/NetworkResourcesData.cpp 2020-06-18 22:11:22 UTC (rev 263231)
@@ -58,11 +58,6 @@
m_base64Encoded = base64Encoded;
}
-static size_t contentSizeInBytes(const String& content)
-{
- return content.isNull() ? 0 : content.impl()->sizeInBytes();
-}
-
unsigned NetworkResourcesData::ResourceData::removeContent()
{
unsigned result = 0;
@@ -74,7 +69,7 @@
if (hasContent()) {
ASSERT(!hasData());
- result = contentSizeInBytes(m_content);
+ result = m_content.sizeInBytes();
m_content = String();
}
return result;
@@ -100,7 +95,7 @@
m_dataBuffer->append(data, dataLength);
}
-size_t NetworkResourcesData::ResourceData::decodeDataToContent()
+unsigned NetworkResourcesData::ResourceData::decodeDataToContent()
{
ASSERT(!hasContent());
@@ -116,9 +111,7 @@
m_dataBuffer = nullptr;
- size_t decodedLength = contentSizeInBytes(m_content);
- ASSERT(decodedLength >= dataLength);
- return decodedLength - dataLength;
+ return m_content.sizeInBytes() - dataLength;
}
NetworkResourcesData::NetworkResourcesData()
@@ -194,7 +187,7 @@
if (!resourceData)
return;
- size_t dataLength = contentSizeInBytes(content);
+ size_t dataLength = content.sizeInBytes();
if (dataLength > m_maximumSingleResourceContentSize)
return;
if (resourceData->isContentEvicted())
@@ -258,7 +251,7 @@
return;
m_contentSize += resourceData->decodeDataToContent();
- size_t dataLength = contentSizeInBytes(resourceData->content());
+ size_t dataLength = resourceData->content().sizeInBytes();
if (dataLength > m_maximumSingleResourceContentSize)
m_contentSize -= resourceData->evictContent();
}
Modified: trunk/Source/WebCore/inspector/NetworkResourcesData.h (263230 => 263231)
--- trunk/Source/WebCore/inspector/NetworkResourcesData.h 2020-06-18 21:54:49 UTC (rev 263230)
+++ trunk/Source/WebCore/inspector/NetworkResourcesData.h 2020-06-18 22:11:22 UTC (rev 263231)
@@ -99,7 +99,7 @@
bool hasData() const { return m_dataBuffer; }
size_t dataLength() const;
void appendData(const char* data, size_t dataLength);
- size_t decodeDataToContent();
+ unsigned decodeDataToContent();
String m_requestId;
String m_loaderId;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes