WebKit Bugzilla
Attachment 362634 Details for
Bug 189434
: contentfiltering tests leak documents
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-189434-20190221131102.patch (text/plain), 3.16 KB, created by
Andy Estes
on 2019-02-21 13:11:03 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Andy Estes
Created:
2019-02-21 13:11:03 PST
Size:
3.16 KB
patch
obsolete
>Subversion Revision: 241842 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 7a6b613db4474737bf13109a2e54ec2b1e98ad10..1ea50c6a7637bb80f53483fe4c80a1944bdd6738 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,19 @@ >+2019-02-21 Andy Estes <aestes@apple.com> >+ >+ contentfiltering tests leak documents >+ https://bugs.webkit.org/show_bug.cgi?id=189434 >+ <rdar://44239943> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Changed ContentFilter to capture the blocked Frame as a WeakPtr to break a reference cycle. >+ >+ This fixes world leaks in several tests in LayoutTests/contentfiltering/. >+ >+ * bindings/js/ScriptController.h: >+ * loader/ContentFilter.cpp: >+ (WebCore::ContentFilter::didDecide): >+ > 2019-02-20 Alex Christensen <achristensen@webkit.org> > > Always call CompletionHandlers after r240909 >diff --git a/Source/WebCore/bindings/js/ScriptController.h b/Source/WebCore/bindings/js/ScriptController.h >index 6e9ddca08de0f6818a07675baa6f4ae4deeebbeb..f7bee054c299fe75aadb8486c4646d832568a4e3 100644 >--- a/Source/WebCore/bindings/js/ScriptController.h >+++ b/Source/WebCore/bindings/js/ScriptController.h >@@ -28,6 +28,7 @@ > #include <JavaScriptCore/Strong.h> > #include <wtf/Forward.h> > #include <wtf/RefPtr.h> >+#include <wtf/WeakPtr.h> > #include <wtf/text/TextPosition.h> > > #if PLATFORM(COCOA) >@@ -69,7 +70,7 @@ enum ReasonForCallingCanExecuteScripts { > NotAboutToExecuteScript > }; > >-class ScriptController { >+class ScriptController : public CanMakeWeakPtr<ScriptController> { > WTF_MAKE_FAST_ALLOCATED; > > using RootObjectMap = HashMap<void*, Ref<JSC::Bindings::RootObject>>; >diff --git a/Source/WebCore/loader/ContentFilter.cpp b/Source/WebCore/loader/ContentFilter.cpp >index 7bc6998582fd73365ab41c72fbedb574c9e4bc91..628d51d2024cf079515c9cc5e8faa3b16aa22227 100644 >--- a/Source/WebCore/loader/ContentFilter.cpp >+++ b/Source/WebCore/loader/ContentFilter.cpp >@@ -228,13 +228,12 @@ void ContentFilter::didDecide(State state) > > ContentFilterUnblockHandler unblockHandler { m_blockingContentFilter->unblockHandler() }; > unblockHandler.setUnreachableURL(m_documentLoader.documentURL()); >- RefPtr<Frame> frame { m_documentLoader.frame() }; >+ auto frame { m_documentLoader.frame() }; > String unblockRequestDeniedScript { m_blockingContentFilter->unblockRequestDeniedScript() }; > if (!unblockRequestDeniedScript.isEmpty() && frame) { >- static_assert(std::is_base_of<ThreadSafeRefCounted<AbstractFrame>, Frame>::value, "AbstractFrame must be ThreadSafeRefCounted."); >- unblockHandler.wrapWithDecisionHandler([frame = WTFMove(frame), script = unblockRequestDeniedScript.isolatedCopy()](bool unblocked) { >- if (!unblocked) >- frame->script().executeScript(script); >+ unblockHandler.wrapWithDecisionHandler([scriptController = makeWeakPtr(frame->script()), script = unblockRequestDeniedScript.isolatedCopy()](bool unblocked) { >+ if (!unblocked && scriptController) >+ scriptController->executeScript(script); > }); > } > m_documentLoader.frameLoader()->client().contentFilterDidBlockLoad(WTFMove(unblockHandler));
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 189434
: 362634