Title: [241906] trunk/Source/WebCore
- Revision
- 241906
- Author
- [email protected]
- Date
- 2019-02-21 14:51:13 -0800 (Thu, 21 Feb 2019)
Log Message
contentfiltering tests leak documents
https://bugs.webkit.org/show_bug.cgi?id=189434
<rdar://44239943>
Reviewed by Simon Fraser.
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):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (241905 => 241906)
--- trunk/Source/WebCore/ChangeLog 2019-02-21 22:50:14 UTC (rev 241905)
+++ trunk/Source/WebCore/ChangeLog 2019-02-21 22:51:13 UTC (rev 241906)
@@ -1,3 +1,19 @@
+2019-02-21 Andy Estes <[email protected]>
+
+ contentfiltering tests leak documents
+ https://bugs.webkit.org/show_bug.cgi?id=189434
+ <rdar://44239943>
+
+ Reviewed by Simon Fraser.
+
+ 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-21 Don Olmstead <[email protected]>
[CMake][Win] Fix !USE(CF) build of WebCore
Modified: trunk/Source/WebCore/bindings/js/ScriptController.h (241905 => 241906)
--- trunk/Source/WebCore/bindings/js/ScriptController.h 2019-02-21 22:50:14 UTC (rev 241905)
+++ trunk/Source/WebCore/bindings/js/ScriptController.h 2019-02-21 22:51:13 UTC (rev 241906)
@@ -28,6 +28,7 @@
#include <_javascript_Core/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 @@
NotAboutToExecuteScript
};
-class ScriptController {
+class ScriptController : public CanMakeWeakPtr<ScriptController> {
WTF_MAKE_FAST_ALLOCATED;
using RootObjectMap = HashMap<void*, Ref<JSC::Bindings::RootObject>>;
Modified: trunk/Source/WebCore/loader/ContentFilter.cpp (241905 => 241906)
--- trunk/Source/WebCore/loader/ContentFilter.cpp 2019-02-21 22:50:14 UTC (rev 241905)
+++ trunk/Source/WebCore/loader/ContentFilter.cpp 2019-02-21 22:51:13 UTC (rev 241906)
@@ -228,13 +228,12 @@
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));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes