Changeset 241906 in webkit
- Timestamp:
- Feb 21, 2019 2:51:13 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r241876 r241906 1 2019-02-21 Andy Estes <aestes@apple.com> 2 3 contentfiltering tests leak documents 4 https://bugs.webkit.org/show_bug.cgi?id=189434 5 <rdar://44239943> 6 7 Reviewed by Simon Fraser. 8 9 Changed ContentFilter to capture the blocked Frame as a WeakPtr to break a reference cycle. 10 11 This fixes world leaks in several tests in LayoutTests/contentfiltering/. 12 13 * bindings/js/ScriptController.h: 14 * loader/ContentFilter.cpp: 15 (WebCore::ContentFilter::didDecide): 16 1 17 2019-02-21 Don Olmstead <don.olmstead@sony.com> 2 18 -
trunk/Source/WebCore/bindings/js/ScriptController.h
r238771 r241906 29 29 #include <wtf/Forward.h> 30 30 #include <wtf/RefPtr.h> 31 #include <wtf/WeakPtr.h> 31 32 #include <wtf/text/TextPosition.h> 32 33 … … 70 71 }; 71 72 72 class ScriptController {73 class ScriptController : public CanMakeWeakPtr<ScriptController> { 73 74 WTF_MAKE_FAST_ALLOCATED; 74 75 -
trunk/Source/WebCore/loader/ContentFilter.cpp
r233668 r241906 229 229 ContentFilterUnblockHandler unblockHandler { m_blockingContentFilter->unblockHandler() }; 230 230 unblockHandler.setUnreachableURL(m_documentLoader.documentURL()); 231 RefPtr<Frame>frame { m_documentLoader.frame() };231 auto frame { m_documentLoader.frame() }; 232 232 String unblockRequestDeniedScript { m_blockingContentFilter->unblockRequestDeniedScript() }; 233 233 if (!unblockRequestDeniedScript.isEmpty() && frame) { 234 static_assert(std::is_base_of<ThreadSafeRefCounted<AbstractFrame>, Frame>::value, "AbstractFrame must be ThreadSafeRefCounted."); 235 unblockHandler.wrapWithDecisionHandler([frame = WTFMove(frame), script = unblockRequestDeniedScript.isolatedCopy()](bool unblocked) { 236 if (!unblocked) 237 frame->script().executeScript(script); 234 unblockHandler.wrapWithDecisionHandler([scriptController = makeWeakPtr(frame->script()), script = unblockRequestDeniedScript.isolatedCopy()](bool unblocked) { 235 if (!unblocked && scriptController) 236 scriptController->executeScript(script); 238 237 }); 239 238 }
Note: See TracChangeset
for help on using the changeset viewer.