Title: [272418] trunk/Source/WebKit
- Revision
- 272418
- Author
- [email protected]
- Date
- 2021-02-05 09:11:37 -0800 (Fri, 05 Feb 2021)
Log Message
CrashTracer: com.apple.WebKit.Networking at WebKit: WebKit::ResourceLoadStatisticsDatabaseStore::setPrevalentResource
https://bugs.webkit.org/show_bug.cgi?id=221432
<rdar://problem/67069819>
Reviewed by John Wilander.
We are seeing crashes in ResourceLoadStatisticsDatabaseStore::setPrevalentResource
as a result of trying to use a nullopt domainID value. In theory this should
never be WTF::nullopt but is because of a failing SQLite query in
ResourceLoadStatisticsDatabaseStore::domainID which reports the error "not an error".
To fix this we should check the domain ID and return early with a
debug assert in setPrevalentResource() if it is WTF::nullopt to avoid
a crash. Additionally, we should add more information to the logging
statement, specifically the SQLite statement string, to try and debug further.
* NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::domainID const):
(WebKit::ResourceLoadStatisticsDatabaseStore::setPrevalentResource):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (272417 => 272418)
--- trunk/Source/WebKit/ChangeLog 2021-02-05 16:54:00 UTC (rev 272417)
+++ trunk/Source/WebKit/ChangeLog 2021-02-05 17:11:37 UTC (rev 272418)
@@ -1,3 +1,25 @@
+2021-02-05 Kate Cheney <[email protected]>
+
+ CrashTracer: com.apple.WebKit.Networking at WebKit: WebKit::ResourceLoadStatisticsDatabaseStore::setPrevalentResource
+ https://bugs.webkit.org/show_bug.cgi?id=221432
+ <rdar://problem/67069819>
+
+ Reviewed by John Wilander.
+
+ We are seeing crashes in ResourceLoadStatisticsDatabaseStore::setPrevalentResource
+ as a result of trying to use a nullopt domainID value. In theory this should
+ never be WTF::nullopt but is because of a failing SQLite query in
+ ResourceLoadStatisticsDatabaseStore::domainID which reports the error "not an error".
+
+ To fix this we should check the domain ID and return early with a
+ debug assert in setPrevalentResource() if it is WTF::nullopt to avoid
+ a crash. Additionally, we should add more information to the logging
+ statement, specifically the SQLite statement string, to try and debug further.
+
+ * NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
+ (WebKit::ResourceLoadStatisticsDatabaseStore::domainID const):
+ (WebKit::ResourceLoadStatisticsDatabaseStore::setPrevalentResource):
+
2021-02-05 Sihui Liu <[email protected]>
SpeechRecognitionPermissionManager should not handle requests that are already cancelled
Modified: trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp (272417 => 272418)
--- trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp 2021-02-05 16:54:00 UTC (rev 272417)
+++ trunk/Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp 2021-02-05 17:11:37 UTC (rev 272418)
@@ -796,7 +796,7 @@
auto scopedStatement = this->scopedStatement(m_domainIDFromStringStatement, domainIDFromStringQuery, "domainID"_s);
if (!scopedStatement
|| scopedStatement->bindText(1, domain.string()) != SQLITE_OK) {
- RELEASE_LOG_ERROR_IF_ALLOWED(m_sessionID, "%p - ResourceLoadStatisticsDatabaseStore::domainIDFromString failed, error message: %{private}s", this, m_database.lastErrorMsg());
+ RELEASE_LOG_ERROR_IF_ALLOWED(m_sessionID, "%p - ResourceLoadStatisticsDatabaseStore::domainIDFromString failed. Statement: %s. Error message: %{private}s", this, scopedStatement->query().utf8().data(), m_database.lastErrorMsg());
ASSERT_NOT_REACHED();
return WTF::nullopt;
}
@@ -1670,6 +1670,13 @@
if (shouldSkip(domain))
return;
+ auto registrableDomainID = domainID(domain);
+ if (!registrableDomainID) {
+ RELEASE_LOG_ERROR_IF_ALLOWED(m_sessionID, "%p - ResourceLoadStatisticsDatabaseStore::setPrevalentResource domainID should exist but was not found.", this);
+ ASSERT_NOT_REACHED();
+ return;
+ }
+
auto scopedUpdatePrevalentResourceStatement = this->scopedStatement(m_updatePrevalentResourceStatement, updatePrevalentResourceQuery, "setPrevalentResource"_s);
if (!scopedUpdatePrevalentResourceStatement
|| scopedUpdatePrevalentResourceStatement->bindInt(1, 1) != SQLITE_OK
@@ -1693,7 +1700,7 @@
}
StdSet<unsigned> nonPrevalentRedirectionSources;
- recursivelyFindNonPrevalentDomainsThatRedirectedToThisDomain(domainID(domain).value(), nonPrevalentRedirectionSources, 0);
+ recursivelyFindNonPrevalentDomainsThatRedirectedToThisDomain(*registrableDomainID, nonPrevalentRedirectionSources, 0);
setDomainsAsPrevalent(WTFMove(nonPrevalentRedirectionSources));
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes