<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[180211] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/180211">180211</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2015-02-16 23:34:29 -0800 (Mon, 16 Feb 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>[GTK] WebKitFrame objects are never released
https://bugs.webkit.org/show_bug.cgi?id=141641

Reviewed by Martin Robinson.

Source/WebKit2:

Use a FrameDestructionObserver derived class to wrap our
WebKitFrame objects and delete them when the frame is destroyed,
instead of using willDestroyFrame callback of WKBundlePageLoaderClient
that has never worked.

* WebProcess/InjectedBundle/API/gtk/WebKitFrame.cpp:
(webkitFrameGetWebFrame):
* WebProcess/InjectedBundle/API/gtk/WebKitFramePrivate.h:
* WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp:
(webkitFrameGetOrCreate):
(webkitFrameDestroy):
(webkitWebPageCreate):
(willDestroyFrame): Deleted.

Tools:

Add a way to check GObjects leaks for WebProcess tests and check
WebKitFrame objects are not leaked.

* TestWebKitAPI/Tests/WebKit2Gtk/FrameTest.cpp:
(WebKitFrameTest::testMainFrame):
(WebKitFrameTest::testURI):
(WebKitFrameTest::testJavaScriptContext):
* TestWebKitAPI/Tests/WebKit2Gtk/WebProcessTest.cpp:
(WebProcessTest::assertObjectIsDeletedWhenTestFinishes):
(runTest):
* TestWebKitAPI/Tests/WebKit2Gtk/WebProcessTest.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPIgtkWebKitFramecpp">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitFrame.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPIgtkWebKitFramePrivateh">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitFramePrivate.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPIgtkWebKitWebPagecpp">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2GtkFrameTestcpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/FrameTest.cpp</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2GtkWebProcessTestcpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/WebProcessTest.cpp</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2GtkWebProcessTesth">trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/WebProcessTest.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (180210 => 180211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-02-17 07:25:13 UTC (rev 180210)
+++ trunk/Source/WebKit2/ChangeLog        2015-02-17 07:34:29 UTC (rev 180211)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2015-02-16  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [GTK] WebKitFrame objects are never released
+        https://bugs.webkit.org/show_bug.cgi?id=141641
+
+        Reviewed by Martin Robinson.
+
+        Use a FrameDestructionObserver derived class to wrap our
+        WebKitFrame objects and delete them when the frame is destroyed,
+        instead of using willDestroyFrame callback of WKBundlePageLoaderClient
+        that has never worked.
+
+        * WebProcess/InjectedBundle/API/gtk/WebKitFrame.cpp:
+        (webkitFrameGetWebFrame):
+        * WebProcess/InjectedBundle/API/gtk/WebKitFramePrivate.h:
+        * WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp:
+        (webkitFrameGetOrCreate):
+        (webkitFrameDestroy):
+        (webkitWebPageCreate):
+        (willDestroyFrame): Deleted.
+
</ins><span class="cx"> 2015-02-16  Tim Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix the !USE(IOSURFACE) build
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIgtkWebKitFramecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitFrame.cpp (180210 => 180211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitFrame.cpp        2015-02-17 07:25:13 UTC (rev 180210)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitFrame.cpp        2015-02-17 07:34:29 UTC (rev 180211)
</span><span class="lines">@@ -47,6 +47,11 @@
</span><span class="cx">     return frame;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+WebFrame* webkitFrameGetWebFrame(WebKitFrame* frame)
+{
+    return frame-&gt;priv-&gt;webFrame.get();
+}
+
</ins><span class="cx"> /**
</span><span class="cx">  * webkit_frame_is_main_frame:
</span><span class="cx">  * @frame: a #WebKitFrame
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIgtkWebKitFramePrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitFramePrivate.h (180210 => 180211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitFramePrivate.h        2015-02-17 07:25:13 UTC (rev 180210)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitFramePrivate.h        2015-02-17 07:34:29 UTC (rev 180211)
</span><span class="lines">@@ -24,5 +24,6 @@
</span><span class="cx"> #include &quot;WebKitFrame.h&quot;
</span><span class="cx"> 
</span><span class="cx"> WebKitFrame* webkitFrameCreate(WebKit::WebFrame*);
</span><ins>+WebKit::WebFrame* webkitFrameGetWebFrame(WebKitFrame*);
</ins><span class="cx"> 
</span><span class="cx"> #endif // WebKitFramePrivate_h
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIgtkWebKitWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp (180210 => 180211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp        2015-02-17 07:25:13 UTC (rev 180210)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebPage.cpp        2015-02-17 07:34:29 UTC (rev 180211)
</span><span class="lines">@@ -42,6 +42,7 @@
</span><span class="cx"> #include &lt;WebCore/Document.h&gt;
</span><span class="cx"> #include &lt;WebCore/DocumentLoader.h&gt;
</span><span class="cx"> #include &lt;WebCore/Frame.h&gt;
</span><ins>+#include &lt;WebCore/FrameDestructionObserver.h&gt;
</ins><span class="cx"> #include &lt;WebCore/FrameView.h&gt;
</span><span class="cx"> #include &lt;WebCore/MainFrame.h&gt;
</span><span class="cx"> #include &lt;glib/gi18n-lib.h&gt;
</span><span class="lines">@@ -75,8 +76,30 @@
</span><span class="cx"> 
</span><span class="cx"> WEBKIT_DEFINE_TYPE(WebKitWebPage, webkit_web_page, G_TYPE_OBJECT)
</span><span class="cx"> 
</span><del>-typedef HashMap&lt;WebFrame*, GRefPtr&lt;WebKitFrame&gt;&gt; WebFrameMap;
</del><ins>+static void webFrameDestroyed(WebFrame*);
</ins><span class="cx"> 
</span><ins>+class WebKitFrameWrapper final: public FrameDestructionObserver {
+public:
+    WebKitFrameWrapper(WebFrame&amp; webFrame)
+        : FrameDestructionObserver(webFrame.coreFrame())
+        , m_webkitFrame(adoptGRef(webkitFrameCreate(&amp;webFrame)))
+    {
+    }
+
+    WebKitFrame* webkitFrame() const { return m_webkitFrame.get(); }
+
+private:
+    virtual void frameDestroyed() override
+    {
+        FrameDestructionObserver::frameDestroyed();
+        webFrameDestroyed(webkitFrameGetWebFrame(m_webkitFrame.get()));
+    }
+
+    GRefPtr&lt;WebKitFrame&gt; m_webkitFrame;
+};
+
+typedef HashMap&lt;WebFrame*, std::unique_ptr&lt;WebKitFrameWrapper&gt;&gt; WebFrameMap;
+
</ins><span class="cx"> static WebFrameMap&amp; webFrameMap()
</span><span class="cx"> {
</span><span class="cx">     static NeverDestroyed&lt;WebFrameMap&gt; map;
</span><span class="lines">@@ -85,14 +108,19 @@
</span><span class="cx"> 
</span><span class="cx"> static WebKitFrame* webkitFrameGetOrCreate(WebFrame* webFrame)
</span><span class="cx"> {
</span><del>-    GRefPtr&lt;WebKitFrame&gt; frame = webFrameMap().get(webFrame);
-    if (frame)
-        return frame.get();
</del><ins>+    auto wrapperPtr = webFrameMap().get(webFrame);
+    if (wrapperPtr)
+        return wrapperPtr-&gt;webkitFrame();
</ins><span class="cx"> 
</span><del>-    frame = adoptGRef(webkitFrameCreate(webFrame));
-    webFrameMap().set(webFrame, frame);
</del><ins>+    std::unique_ptr&lt;WebKitFrameWrapper&gt; wrapper = std::make_unique&lt;WebKitFrameWrapper&gt;(*webFrame);
+    wrapperPtr = wrapper.get();
+    webFrameMap().set(webFrame, WTF::move(wrapper));
+    return wrapperPtr-&gt;webkitFrame();
+}
</ins><span class="cx"> 
</span><del>-    return frame.get();
</del><ins>+static void webFrameDestroyed(WebFrame* webFrame)
+{
+    webFrameMap().remove(webFrame);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static CString getProvisionalURLForFrame(WebFrame* webFrame)
</span><span class="lines">@@ -145,11 +173,6 @@
</span><span class="cx">     g_signal_emit(WEBKIT_WEB_PAGE(clientInfo), signals[DOCUMENT_LOADED], 0);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void willDestroyFrame(WKBundlePageRef, WKBundleFrameRef frame, const void* /* clientInfo */)
-{
-    webFrameMap().remove(toImpl(frame));
-}
-
</del><span class="cx"> static void didClearWindowObjectForFrame(WKBundlePageRef, WKBundleFrameRef frame, WKBundleScriptWorldRef wkWorld, const void* clientInfo)
</span><span class="cx"> {
</span><span class="cx">     if (WebKitScriptWorld* world = webkitScriptWorldGet(toImpl(wkWorld)))
</span><span class="lines">@@ -392,7 +415,7 @@
</span><span class="cx">         0, // didReceiveTitleForFrame
</span><span class="cx">         0, // didFirstLayoutForFrame
</span><span class="cx">         0, // didFirstVisuallyNonEmptyLayoutForFrame
</span><del>-        0, // didRemoveFrameFromHierarchy
</del><ins>+        0, // didRemoveFrameFromHierarchy,
</ins><span class="cx">         0, // didDisplayInsecureContentForFrame
</span><span class="cx">         0, // didRunInsecureContentForFrame
</span><span class="cx">         didClearWindowObjectForFrame,
</span><span class="lines">@@ -415,7 +438,7 @@
</span><span class="cx">         0, // featuresUsedInPage
</span><span class="cx">         0, // willLoadURLRequest
</span><span class="cx">         0, // willLoadDataRequest
</span><del>-        willDestroyFrame
</del><ins>+        0, // willDestroyFrame
</ins><span class="cx">     };
</span><span class="cx">     WKBundlePageSetPageLoaderClient(toAPI(webPage), &amp;loaderClient.base);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (180210 => 180211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-02-17 07:25:13 UTC (rev 180210)
+++ trunk/Tools/ChangeLog        2015-02-17 07:34:29 UTC (rev 180211)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2015-02-16  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [GTK] WebKitFrame objects are never released
+        https://bugs.webkit.org/show_bug.cgi?id=141641
+
+        Reviewed by Martin Robinson.
+
+        Add a way to check GObjects leaks for WebProcess tests and check
+        WebKitFrame objects are not leaked.
+
+        * TestWebKitAPI/Tests/WebKit2Gtk/FrameTest.cpp:
+        (WebKitFrameTest::testMainFrame):
+        (WebKitFrameTest::testURI):
+        (WebKitFrameTest::testJavaScriptContext):
+        * TestWebKitAPI/Tests/WebKit2Gtk/WebProcessTest.cpp:
+        (WebProcessTest::assertObjectIsDeletedWhenTestFinishes):
+        (runTest):
+        * TestWebKitAPI/Tests/WebKit2Gtk/WebProcessTest.h:
+
</ins><span class="cx"> 2015-02-16  Tim Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix the MiniBrowser build with newer clang
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2GtkFrameTestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/FrameTest.cpp (180210 => 180211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/FrameTest.cpp        2015-02-17 07:25:13 UTC (rev 180210)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/FrameTest.cpp        2015-02-17 07:34:29 UTC (rev 180211)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx">     {
</span><span class="cx">         WebKitFrame* frame = webkit_web_page_get_main_frame(page);
</span><span class="cx">         g_assert(WEBKIT_IS_FRAME(frame));
</span><ins>+        assertObjectIsDeletedWhenTestFinishes(G_OBJECT(frame));
</ins><span class="cx">         g_assert(webkit_frame_is_main_frame(frame));
</span><span class="cx"> 
</span><span class="cx">         return true;
</span><span class="lines">@@ -41,6 +42,7 @@
</span><span class="cx">     {
</span><span class="cx">         WebKitFrame* frame = webkit_web_page_get_main_frame(page);
</span><span class="cx">         g_assert(WEBKIT_IS_FRAME(frame));
</span><ins>+        assertObjectIsDeletedWhenTestFinishes(G_OBJECT(frame));
</ins><span class="cx">         g_assert_cmpstr(webkit_web_page_get_uri(page), ==, webkit_frame_get_uri(frame));
</span><span class="cx"> 
</span><span class="cx">         return true;
</span><span class="lines">@@ -50,6 +52,7 @@
</span><span class="cx">     {
</span><span class="cx">         WebKitFrame* frame = webkit_web_page_get_main_frame(page);
</span><span class="cx">         g_assert(WEBKIT_IS_FRAME(frame));
</span><ins>+        assertObjectIsDeletedWhenTestFinishes(G_OBJECT(frame));
</ins><span class="cx">         g_assert(webkit_frame_get_javascript_global_context(frame));
</span><span class="cx"> 
</span><span class="cx">         return true;
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2GtkWebProcessTestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/WebProcessTest.cpp (180210 => 180211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/WebProcessTest.cpp        2015-02-17 07:25:13 UTC (rev 180210)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/WebProcessTest.cpp        2015-02-17 07:34:29 UTC (rev 180211)
</span><span class="lines">@@ -22,9 +22,12 @@
</span><span class="cx"> 
</span><span class="cx"> #include &lt;JavaScriptCore/JSRetainPtr.h&gt;
</span><span class="cx"> #include &lt;gio/gio.h&gt;
</span><ins>+#include &lt;wtf/HashSet.h&gt;
</ins><span class="cx"> #include &lt;wtf/NeverDestroyed.h&gt;
</span><span class="cx"> #include &lt;wtf/gobject/GUniquePtr.h&gt;
</span><span class="cx"> 
</span><ins>+static HashSet&lt;GObject*&gt; s_watchedObjects;
+
</ins><span class="cx"> typedef HashMap&lt;String, std::function&lt;std::unique_ptr&lt;WebProcessTest&gt; ()&gt;&gt; TestsMap;
</span><span class="cx"> static TestsMap&amp; testsMap()
</span><span class="cx"> {
</span><span class="lines">@@ -37,6 +40,14 @@
</span><span class="cx">     testsMap().add(testName, WTF::move(closure));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebProcessTest::assertObjectIsDeletedWhenTestFinishes(GObject* object)
+{
+    s_watchedObjects.add(object);
+    g_object_weak_ref(object, [](gpointer, GObject* finalizedObject) {
+        s_watchedObjects.remove(finalizedObject);
+    }, nullptr);
+}
+
</ins><span class="cx"> std::unique_ptr&lt;WebProcessTest&gt; WebProcessTest::create(const String&amp; testName)
</span><span class="cx"> {
</span><span class="cx">     g_assert(testsMap().contains(testName));
</span><span class="lines">@@ -53,6 +64,7 @@
</span><span class="cx"> 
</span><span class="cx">     WebKitWebPage* webPage = WEBKIT_WEB_PAGE(JSObjectGetPrivate(thisObject));
</span><span class="cx">     g_assert(WEBKIT_IS_WEB_PAGE(webPage));
</span><ins>+    WebProcessTest::assertObjectIsDeletedWhenTestFinishes(G_OBJECT(webPage));
</ins><span class="cx"> 
</span><span class="cx">     std::unique_ptr&lt;WebProcessTest&gt; test = WebProcessTest::create(String::fromUTF8(testPath.get()));
</span><span class="cx">     return JSValueMakeBoolean(context, test-&gt;runTest(g_strrstr(testPath.get(), &quot;/&quot;) + 1, webPage));
</span><span class="lines">@@ -67,6 +79,16 @@
</span><span class="cx"> static void webProcessTestRunnerFinalize(JSObjectRef object)
</span><span class="cx"> {
</span><span class="cx">     g_object_unref(JSObjectGetPrivate(object));
</span><ins>+
+    if (s_watchedObjects.isEmpty())
+        return;
+
+    g_print(&quot;Leaked objects in WebProcess:&quot;);
+    for (const auto object : s_watchedObjects)
+        g_print(&quot; %s(%p)&quot;, g_type_name_from_instance(reinterpret_cast&lt;GTypeInstance*&gt;(object)), object);
+    g_print(&quot;\n&quot;);
+
+    g_assert(s_watchedObjects.isEmpty());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void windowObjectClearedCallback(WebKitScriptWorld* world, WebKitWebPage* webPage, WebKitFrame* frame, WebKitWebExtension* extension)
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2GtkWebProcessTesth"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/WebProcessTest.h (180210 => 180211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/WebProcessTest.h        2015-02-17 07:25:13 UTC (rev 180210)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/WebProcessTest.h        2015-02-17 07:34:29 UTC (rev 180211)
</span><span class="lines">@@ -28,6 +28,8 @@
</span><span class="cx">     virtual ~WebProcessTest() { }
</span><span class="cx">     virtual bool runTest(const char* testName, WebKitWebPage*) = 0;
</span><span class="cx"> 
</span><ins>+    static void assertObjectIsDeletedWhenTestFinishes(GObject*);
+
</ins><span class="cx">     static void add(const String&amp; testName, std::function&lt;std::unique_ptr&lt;WebProcessTest&gt; ()&gt;);
</span><span class="cx">     static std::unique_ptr&lt;WebProcessTest&gt; create(const String&amp; testName);
</span><span class="cx"> };
</span></span></pre>
</div>
</div>

</body>
</html>