Source/WebKit/ChangeLog

 12017-11-28 Youenn Fablet <youenn@apple.com>
 2
 3 NetworkCache::Storage should protect itself when removing operations from its maps
 4 https://bugs.webkit.org/show_bug.cgi?id=180118
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 The operations can contain ref to the Storage object and removing them from the map may destroy the Storage object
 9
 10 * NetworkProcess/cache/NetworkCacheStorage.cpp:
 11 (WebKit::NetworkCache::Storage::finishReadOperation):
 12 (WebKit::NetworkCache::Storage::finishWriteOperation):
 13 (WebKit::NetworkCache::Storage::traverse):
 14
1152017-11-27 Youenn Fablet <youenn@apple.com>
216
317 Register Documents as ServiceWorker clients to the StorageProcess

Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp

@@void Storage::finishReadOperation(ReadOperation& readOperation)
666666 else if (!readOperation.isCanceled)
667667 remove(readOperation.key);
668668
 669 auto protectedThis = makeRef(*this);
 670
669671 ASSERT(m_activeReadOperations.contains(&readOperation));
670672 m_activeReadOperations.remove(&readOperation);
671673

@@void Storage::finishWriteOperation(WriteOperation& writeOperation)
794796 if (--writeOperation.activeCount)
795797 return;
796798
 799 auto protectedThis = makeRef(*this);
 800
797801 m_activeWriteOperations.remove(&writeOperation);
798802 dispatchPendingWriteOperations();
799803

@@void Storage::traverse(const String& type, TraverseFlags flags, TraverseHandler&
915919 }
916920 RunLoop::main().dispatch([this, &traverseOperation] {
917921 traverseOperation.handler(nullptr, { });
 922
 923 auto protectedThis = makeRef(*this);
 924
918925 m_activeTraverseOperations.remove(&traverseOperation);
919926 });
920927 });