Changeset 263996 in webkit
- Timestamp:
- Jul 6, 2020, 4:30:05 PM (5 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r263991 r263996 1 2020-07-06 Chris Dumez <cdumez@apple.com> 2 3 Regression(r249303) Crash under NetworkLoad::NetworkLoad() 4 https://bugs.webkit.org/show_bug.cgi?id=214008 5 <rdar://problem/64853936> 6 7 Reviewed by Alex Christensen. 8 9 * NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp: 10 (WebKit::NetworkCache::SpeculativeLoad::SpeculativeLoad): 11 Do some hardening and fail the SpeculativeLoad if the network session is null, instead of dereferencing 12 the network session unconditionally. The NetworkCache owns the NetworkCacheSpeculativeLoadManager and 13 the NetworkCache is RefCounted so it may outlive its NetworkSession in theory and schedule speculative 14 loads for a session that was just destroyed. 15 16 * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp: 17 (WebKit::NetworkCache::SpeculativeLoadManager::registerLoad): 18 (WebKit::NetworkCache::SpeculativeLoadManager::preloadEntry): 19 * NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h: 20 Capture weakThis in a few lambda and check it when the lambda gets called. It looked unsafe so I 21 decided to do some hardening. 22 1 23 2020-07-06 Peng Liu <peng.liu6@apple.com> 2 24 -
trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheSpeculativeLoad.cpp
r260031 r263996 52 52 ASSERT(!m_cacheEntry || m_cacheEntry->needsValidation()); 53 53 54 auto* networkSession = m_cache->networkProcess().networkSession(m_cache->sessionID()); 55 if (!networkSession) { 56 RunLoop::main().dispatch([completionHandler = WTFMove(m_completionHandler)]() mutable { 57 completionHandler(nullptr); 58 }); 59 return; 60 } 61 54 62 NetworkLoadParameters parameters; 55 63 parameters.webPageProxyID = globalFrameID.webPageProxyID; … … 61 69 parameters.request = m_originalRequest; 62 70 parameters.isNavigatingToAppBoundDomain = isNavigatingToAppBoundDomain; 63 m_networkLoad = makeUnique<NetworkLoad>(*this, nullptr, WTFMove(parameters), * cache.networkProcess().networkSession(cache.sessionID()));71 m_networkLoad = makeUnique<NetworkLoad>(*this, nullptr, WTFMove(parameters), *networkSession); 64 72 } 65 73 -
trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.cpp
r261405 r263996 368 368 369 369 // Retrieve the subresources entry if it exists to start speculative revalidation and to update it. 370 retrieveSubresourcesEntry(resourceKey, [this, frameID, pendingFrameLoad = WTFMove(pendingFrameLoad), isNavigatingToAppBoundDomain](std::unique_ptr<SubresourcesEntry> entry) { 370 retrieveSubresourcesEntry(resourceKey, [this, weakThis = makeWeakPtr(*this), frameID, pendingFrameLoad = WTFMove(pendingFrameLoad), isNavigatingToAppBoundDomain](std::unique_ptr<SubresourcesEntry> entry) { 371 if (!weakThis) 372 return; 373 371 374 if (entry) 372 375 startSpeculativeRevalidation(frameID, *entry, isNavigatingToAppBoundDomain); … … 560 563 m_pendingPreloads.add(key, nullptr); 561 564 562 retrieveEntryFromStorage(subresourceInfo, [this, key, subresourceInfo, frameID, isNavigatingToAppBoundDomain](std::unique_ptr<Entry> entry) { 565 retrieveEntryFromStorage(subresourceInfo, [this, weakThis = makeWeakPtr(*this), key, subresourceInfo, frameID, isNavigatingToAppBoundDomain](std::unique_ptr<Entry> entry) { 566 if (!weakThis) 567 return; 568 563 569 ASSERT(!m_pendingPreloads.get(key)); 564 570 bool removed = m_pendingPreloads.remove(key); -
trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheSpeculativeLoadManager.h
r260031 r263996 34 34 #include <wtf/HashMap.h> 35 35 #include <wtf/Vector.h> 36 #include <wtf/WeakPtr.h> 36 37 37 38 namespace WebKit { … … 44 45 class SubresourcesEntry; 45 46 46 class SpeculativeLoadManager {47 class SpeculativeLoadManager : public CanMakeWeakPtr<SpeculativeLoadManager> { 47 48 WTF_MAKE_FAST_ALLOCATED; 48 49 public:
Note:
See TracChangeset
for help on using the changeset viewer.