Index: Source/web/tests/WebViewTest.cpp |
diff --git a/Source/web/tests/WebViewTest.cpp b/Source/web/tests/WebViewTest.cpp |
index 60a64287b59825d9f426122b721fd0f98052d5b6..43957ea548f6aae5dfcb2526652f7b814810dc8d 100644 |
--- a/Source/web/tests/WebViewTest.cpp |
+++ b/Source/web/tests/WebViewTest.cpp |
@@ -1809,7 +1809,7 @@ TEST_F(WebViewTest, DeleteElementWithRegisteredHandler) |
URLTestHelpers::registerMockedURLLoad(toKURL(url), "simple_div.html"); |
WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad(url, true); |
- WebCore::Document* document = webViewImpl->mainFrameImpl()->frame()->document(); |
+ RefPtrWillBePersistent<WebCore::Document> document = webViewImpl->mainFrameImpl()->frame()->document(); |
WebCore::Element* div = document->getElementById("div"); |
WebCore::EventHandlerRegistry& registry = document->frameHost()->eventHandlerRegistry(); |
@@ -1818,6 +1818,13 @@ TEST_F(WebViewTest, DeleteElementWithRegisteredHandler) |
WebCore::TrackExceptionState exceptionState; |
div->remove(exceptionState); |
+#if ENABLE(OILPAN) |
+ // For oilpan we have to force a GC to ensure the event handlers have been removed when |
+ // checking below. We do a precise GC (collectAllGarbage does not scan the stack) |
+ // to ensure the div element dies. This is also why the Document is in a Persistent |
+ // since we want that to stay around. |
+ Heap::collectAllGarbage(); |
+#endif |
EXPECT_FALSE(registry.hasEventHandlers(WebCore::EventHandlerRegistry::ScrollEvent)); |
} |