Modified: trunk/Source/WebKit/ChangeLog (252756 => 252757)
--- trunk/Source/WebKit/ChangeLog 2019-11-22 00:54:47 UTC (rev 252756)
+++ trunk/Source/WebKit/ChangeLog 2019-11-22 01:32:38 UTC (rev 252757)
@@ -1,3 +1,19 @@
+2019-11-21 Sihui Liu <[email protected]>
+
+ Crash in com.apple.WebKit.WebContent at WebKit: WebKit::StorageAreaMap::loadValuesIfNeeded
+ https://bugs.webkit.org/show_bug.cgi?id=204459
+ <rdar://problem/57383446>
+
+ Reviewed by Geoffrey Garen.
+
+ If m_storageMapID can be null if connect() fails.
+
+ * WebProcess/WebStorage/StorageAreaMap.cpp:
+ (WebKit::StorageAreaMap::setItem):
+ (WebKit::StorageAreaMap::removeItem):
+ (WebKit::StorageAreaMap::clear):
+ (WebKit::StorageAreaMap::loadValuesIfNeeded):
+
2019-11-21 Peng Liu <[email protected]>
Ignore the requests to enter/exit video fullscreen/picture-in-picture if the requesting mode is the same as the current mode
Modified: trunk/Source/WebKit/WebProcess/WebStorage/StorageAreaMap.cpp (252756 => 252757)
--- trunk/Source/WebKit/WebProcess/WebStorage/StorageAreaMap.cpp 2019-11-22 00:54:47 UTC (rev 252756)
+++ trunk/Source/WebKit/WebProcess/WebStorage/StorageAreaMap.cpp 2019-11-22 01:32:38 UTC (rev 252757)
@@ -107,7 +107,10 @@
m_pendingValueChanges.add(key);
- WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::StorageManagerSet::SetItem(*m_storageMapID, sourceArea->identifier(), m_currentSeed, key, value, sourceFrame->document()->url()), 0);
+ if (m_storageMapID)
+ WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::StorageManagerSet::SetItem(*m_storageMapID, sourceArea->identifier(), m_currentSeed, key, value, sourceFrame->document()->url()), 0);
+ else
+ LOG_ERROR("StorageAreaMap::setItem fails because storage map ID is invalid");
}
void StorageAreaMap::removeItem(WebCore::Frame* sourceFrame, StorageAreaImpl* sourceArea, const String& key)
@@ -123,7 +126,10 @@
m_pendingValueChanges.add(key);
- WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::StorageManagerSet::RemoveItem(*m_storageMapID, sourceArea->identifier(), m_currentSeed, key, sourceFrame->document()->url()), 0);
+ if (m_storageMapID)
+ WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::StorageManagerSet::RemoveItem(*m_storageMapID, sourceArea->identifier(), m_currentSeed, key, sourceFrame->document()->url()), 0);
+ else
+ LOG_ERROR("StorageAreaMap::removeItem fails because storage map ID is invalid");
}
void StorageAreaMap::clear(WebCore::Frame* sourceFrame, StorageAreaImpl* sourceArea)
@@ -134,7 +140,11 @@
m_hasPendingClear = true;
m_storageMap = StorageMap::create(m_quotaInBytes);
- WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::StorageManagerSet::Clear(*m_storageMapID, sourceArea->identifier(), m_currentSeed, sourceFrame->document()->url()), 0);
+
+ if (m_storageMapID)
+ WebProcess::singleton().ensureNetworkProcessConnection().connection().send(Messages::StorageManagerSet::Clear(*m_storageMapID, sourceArea->identifier(), m_currentSeed, sourceFrame->document()->url()), 0);
+ else
+ LOG_ERROR("StorageAreaMap::removeItem fails because storage map ID is invalid");
}
bool StorageAreaMap::contains(const String& key)
@@ -160,13 +170,16 @@
if (m_storageMap)
return;
- // The StorageManagerSet::GetValues() IPC may be very slow because it may need to fetch the values from disk and there may be a lot
- // of data.
- IPC::UnboundedSynchronousIPCScope unboundedSynchronousIPCScope;
-
HashMap<String, String> values;
- WebProcess::singleton().ensureNetworkProcessConnection().connection().sendSync(Messages::StorageManagerSet::GetValues(*m_storageMapID), Messages::StorageManagerSet::GetValues::Reply(values), 0);
+ if (m_storageMapID) {
+ // The StorageManagerSet::GetValues() IPC may be very slow because it may need to fetch the values from disk and there may be a lot
+ // of data.
+ IPC::UnboundedSynchronousIPCScope unboundedSynchronousIPCScope;
+ WebProcess::singleton().ensureNetworkProcessConnection().connection().sendSync(Messages::StorageManagerSet::GetValues(*m_storageMapID), Messages::StorageManagerSet::GetValues::Reply(values), 0);
+ } else
+ LOG_ERROR("StorageAreaMap::loadValuesIfNeeded fails to load from network process because storage map ID is invalid");
+
m_storageMap = StorageMap::create(m_quotaInBytes);
m_storageMap->importItems(WTFMove(values));
}