Changeset 228469 in webkit
- Timestamp:
- Feb 14, 2018 10:27:37 AM (6 years ago)
- Location:
- tags/Safari-605.1.27.2
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
tags/Safari-605.1.27.2/LayoutTests/ChangeLog
r228280 r228469 1 2018-02-14 Jason Marcell <jmarcell@apple.com> 2 3 Cherry-pick r228435. rdar://problem/37538686 4 5 2018-02-13 Antti Koivisto <antti@apple.com> 6 7 Crash when breakpoint hit in unload handler 8 https://bugs.webkit.org/show_bug.cgi?id=169855 9 <rdar://problem/28683567> 10 11 Reviewed by Daniel Bates and Joseph Pecoraro. 12 13 * inspector/debugger/reload-paused-expected.txt: Added. 14 * inspector/debugger/reload-paused.html: Added. 15 1 16 2018-02-08 Ryan Haddad <ryanhaddad@apple.com> 2 17 -
tags/Safari-605.1.27.2/Source/WebCore/ChangeLog
r228426 r228469 1 2018-02-14 Jason Marcell <jmarcell@apple.com> 2 3 Cherry-pick r228435. rdar://problem/37538686 4 5 2018-02-13 Antti Koivisto <antti@apple.com> 6 7 Crash when breakpoint hit in unload handler 8 https://bugs.webkit.org/show_bug.cgi?id=169855 9 <rdar://problem/28683567> 10 11 Reviewed by Daniel Bates. 12 13 Test: inspector/debugger/reload-paused.html 14 15 CachedRawResource::updateBuffer may generate unload event in client notify callback. If Inspector was 16 paused, this even would spawn a nested runloop. CachedRawResource::finishLoading would get called in 17 the nested loop, confusing the DocumentLoader state machine and resulting in crashes later. 18 19 * loader/cache/CachedRawResource.cpp: 20 (WebCore::CachedRawResource::updateBuffer): 21 22 - Set a bit when entering the client callback. 23 - Ensure we don't re-enter updateBuffer. 24 - If finishLoading got delayed during client callback, do it at the end. 25 26 (WebCore::CachedRawResource::finishLoading): 27 28 If we are in updateBuffer client callback, save the buffer and bail out. 29 30 * loader/cache/CachedRawResource.h: 31 1 32 2018-02-12 Jason Marcell <jmarcell@apple.com> 2 33 -
tags/Safari-605.1.27.2/Source/WebCore/loader/cache/CachedRawResource.cpp
r224699 r228469 34 34 #include "SubresourceLoader.h" 35 35 #include <wtf/CompletionHandler.h> 36 #include <wtf/SetForScope.h> 36 37 #include <wtf/text/StringView.h> 37 38 … … 56 57 void CachedRawResource::updateBuffer(SharedBuffer& data) 57 58 { 59 // Skip any updateBuffers triggered from nested runloops. We'll have the complete buffer in finishLoading. 60 if (m_inIncrementalDataNotify) 61 return; 62 58 63 CachedResourceHandle<CachedRawResource> protectedThis(this); 59 64 ASSERT(dataBufferingPolicy() == BufferData); … … 62 67 auto incrementalData = calculateIncrementalDataChunk(&data); 63 68 setEncodedSize(data.size()); 64 if (incrementalData) 69 if (incrementalData) { 70 SetForScope<bool> notifyScope(m_inIncrementalDataNotify, true); 65 71 notifyClientsDataWasReceived(incrementalData->data(), incrementalData->size()); 72 } 73 66 74 if (dataBufferingPolicy() == DoNotBufferData) { 67 75 if (m_loader) 68 76 m_loader->setDataBufferingPolicy(DoNotBufferData); 69 77 clear(); 70 return; 71 } 72 73 CachedResource::updateBuffer(data); 78 } else 79 CachedResource::updateBuffer(data); 80 81 if (m_delayedFinishLoading) { 82 auto delayedFinishLoading = std::exchange(m_delayedFinishLoading, std::nullopt); 83 finishLoading(delayedFinishLoading->buffer.get()); 84 } 74 85 } 75 86 … … 83 94 void CachedRawResource::finishLoading(SharedBuffer* data) 84 95 { 96 if (m_inIncrementalDataNotify) { 97 // We may get here synchronously from updateBuffer() if the callback there ends up spinning a runloop. 98 // In that case delay the call. 99 m_delayedFinishLoading = std::make_optional(DelayedFinishLoading { data }); 100 return; 101 }; 85 102 CachedResourceHandle<CachedRawResource> protectedThis(this); 86 103 DataBufferingPolicy dataBufferingPolicy = this->dataBufferingPolicy(); -
tags/Safari-605.1.27.2/Source/WebCore/loader/cache/CachedRawResource.h
r226508 r228469 76 76 unsigned long m_identifier; 77 77 bool m_allowEncodedDataReplacement; 78 bool m_inIncrementalDataNotify { false }; 78 79 79 80 struct RedirectPair { … … 90 91 91 92 Vector<RedirectPair> m_redirectChain; 93 94 struct DelayedFinishLoading { 95 RefPtr<SharedBuffer> buffer; 96 }; 97 std::optional<DelayedFinishLoading> m_delayedFinishLoading; 92 98 }; 93 99
Note: See TracChangeset
for help on using the changeset viewer.