<!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>[207948] releases/WebKitGTK/webkit-2.14</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/207948">207948</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2016-10-27 00:18:05 -0700 (Thu, 27 Oct 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/206922">r206922</a> - [WK2] didRemoveFrameFromHierarchy callback doesn't fire for subframes when evicting from PageCache.
&lt;https://webkit.org/b/163098&gt;
&lt;rdar://problem/28663488&gt;

Reviewed by Antti Koivisto.

Source/WebCore:

Fix a bug where WK2 didRemoveFrameFromHierarchy callbacks wouldn't fire for subframes that were getting
kicked out of PageCache. The problem was happening because CachedFrame would disconnect the Frame from
its Page just before calling FrameLoader::detachViewsAndDocumentLoader() where the callbacks are fired.
Without a Page, the WebFrame on WK2 side can't find its WebPage, and so it can't fire its callbacks.

The fix is just to switch the order of those two lines.

This bug was causing frequent DOM and window object leaks in some clients *cough* Safari *cough* that
were relying on didRemoveFrameFromHierarchy to release their isolated worlds.

Test: WebKit2.DidRemoveFrameFromHiearchyInPageCache

* history/CachedFrame.cpp:
(WebCore::CachedFrame::destroy):

Tools:

Add an API test that puts a 10-subframe page into the page cache, then loads other pages
until the first page gets kicked out. The test succeeds if we receive didRemoveFrameFromHierarchy
callbacks for all the subframes.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2/DidRemoveFrameFromHiearchyInPageCache.cpp: Added.
(TestWebKitAPI::didFinishLoadForFrame):
(TestWebKitAPI::setPageLoaderClient):
(TestWebKitAPI::didReceivePageMessageFromInjectedBundle):
(TestWebKitAPI::setInjectedBundleClient):
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKit2/DidRemoveFrameFromHiearchyInPageCache_Bundle.cpp: Added.
(TestWebKitAPI::didRemoveFrameFromHierarchyCallback):
(TestWebKitAPI::DidRemoveFrameFromHiearchyInPageCacheTest::DidRemoveFrameFromHiearchyInPageCacheTest):
(TestWebKitAPI::DidRemoveFrameFromHiearchyInPageCacheTest::didCreatePage):
* TestWebKitAPI/Tests/WebKit2/many-iframes.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit214SourceWebCoreChangeLog">releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit214SourceWebCorehistoryCachedFramecpp">releases/WebKitGTK/webkit-2.14/Source/WebCore/history/CachedFrame.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit214ToolsChangeLog">releases/WebKitGTK/webkit-2.14/Tools/ChangeLog</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit214ToolsTestWebKitAPITestsWebKit2DidRemoveFrameFromHiearchyInPageCachecpp">releases/WebKitGTK/webkit-2.14/Tools/TestWebKitAPI/Tests/WebKit2/DidRemoveFrameFromHiearchyInPageCache.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit214ToolsTestWebKitAPITestsWebKit2DidRemoveFrameFromHiearchyInPageCache_Bundlecpp">releases/WebKitGTK/webkit-2.14/Tools/TestWebKitAPI/Tests/WebKit2/DidRemoveFrameFromHiearchyInPageCache_Bundle.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit214ToolsTestWebKitAPITestsWebKit2manyiframeshtml">releases/WebKitGTK/webkit-2.14/Tools/TestWebKitAPI/Tests/WebKit2/many-iframes.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit214SourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog (207947 => 207948)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog        2016-10-27 07:16:08 UTC (rev 207947)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog        2016-10-27 07:18:05 UTC (rev 207948)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2016-10-07  Andreas Kling  &lt;akling@apple.com&gt;
+
+        [WK2] didRemoveFrameFromHierarchy callback doesn't fire for subframes when evicting from PageCache.
+        &lt;https://webkit.org/b/163098&gt;
+        &lt;rdar://problem/28663488&gt;
+
+        Reviewed by Antti Koivisto.
+
+        Fix a bug where WK2 didRemoveFrameFromHierarchy callbacks wouldn't fire for subframes that were getting
+        kicked out of PageCache. The problem was happening because CachedFrame would disconnect the Frame from
+        its Page just before calling FrameLoader::detachViewsAndDocumentLoader() where the callbacks are fired.
+        Without a Page, the WebFrame on WK2 side can't find its WebPage, and so it can't fire its callbacks.
+
+        The fix is just to switch the order of those two lines.
+
+        This bug was causing frequent DOM and window object leaks in some clients *cough* Safari *cough* that
+        were relying on didRemoveFrameFromHierarchy to release their isolated worlds.
+
+        Test: WebKit2.DidRemoveFrameFromHiearchyInPageCache
+
+        * history/CachedFrame.cpp:
+        (WebCore::CachedFrame::destroy):
+
</ins><span class="cx"> 2016-10-07  Zalan Bujtas  &lt;zalan@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         https://vuldb.com/?cvssv3.2012 takes long time to load.
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit214SourceWebCorehistoryCachedFramecpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/history/CachedFrame.cpp (207947 => 207948)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Source/WebCore/history/CachedFrame.cpp        2016-10-27 07:16:08 UTC (rev 207947)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/history/CachedFrame.cpp        2016-10-27 07:18:05 UTC (rev 207948)
</span><span class="lines">@@ -248,8 +248,8 @@
</span><span class="cx">     m_document-&gt;domWindow()-&gt;willDestroyCachedFrame();
</span><span class="cx"> 
</span><span class="cx">     if (!m_isMainFrame) {
</span><ins>+        m_view-&gt;frame().loader().detachViewsAndDocumentLoader();
</ins><span class="cx">         m_view-&gt;frame().detachFromPage();
</span><del>-        m_view-&gt;frame().loader().detachViewsAndDocumentLoader();
</del><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     for (int i = m_childFrames.size() - 1; i &gt;= 0; --i)
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit214ToolsChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.14/Tools/ChangeLog (207947 => 207948)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Tools/ChangeLog        2016-10-27 07:16:08 UTC (rev 207947)
+++ releases/WebKitGTK/webkit-2.14/Tools/ChangeLog        2016-10-27 07:18:05 UTC (rev 207948)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2016-10-07  Andreas Kling  &lt;akling@apple.com&gt;
+
+        [WK2] didRemoveFrameFromHierarchy callback doesn't fire for subframes when evicting from PageCache.
+        &lt;https://webkit.org/b/163098&gt;
+        &lt;rdar://problem/28663488&gt;
+
+        Reviewed by Antti Koivisto.
+
+        Add an API test that puts a 10-subframe page into the page cache, then loads other pages
+        until the first page gets kicked out. The test succeeds if we receive didRemoveFrameFromHierarchy
+        callbacks for all the subframes.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebKit2/DidRemoveFrameFromHiearchyInPageCache.cpp: Added.
+        (TestWebKitAPI::didFinishLoadForFrame):
+        (TestWebKitAPI::setPageLoaderClient):
+        (TestWebKitAPI::didReceivePageMessageFromInjectedBundle):
+        (TestWebKitAPI::setInjectedBundleClient):
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/WebKit2/DidRemoveFrameFromHiearchyInPageCache_Bundle.cpp: Added.
+        (TestWebKitAPI::didRemoveFrameFromHierarchyCallback):
+        (TestWebKitAPI::DidRemoveFrameFromHiearchyInPageCacheTest::DidRemoveFrameFromHiearchyInPageCacheTest):
+        (TestWebKitAPI::DidRemoveFrameFromHiearchyInPageCacheTest::didCreatePage):
+        * TestWebKitAPI/Tests/WebKit2/many-iframes.html: Added.
+
</ins><span class="cx"> 2016-09-28  Michael Catanzaro  &lt;mcatanzaro@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] Add Chrome UA quirk
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit214ToolsTestWebKitAPITestsWebKit2DidRemoveFrameFromHiearchyInPageCachecpp"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.14/Tools/TestWebKitAPI/Tests/WebKit2/DidRemoveFrameFromHiearchyInPageCache.cpp (0 => 207948)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Tools/TestWebKitAPI/Tests/WebKit2/DidRemoveFrameFromHiearchyInPageCache.cpp                                (rev 0)
+++ releases/WebKitGTK/webkit-2.14/Tools/TestWebKitAPI/Tests/WebKit2/DidRemoveFrameFromHiearchyInPageCache.cpp        2016-10-27 07:18:05 UTC (rev 207948)
</span><span class="lines">@@ -0,0 +1,109 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+
+#if WK_HAVE_C_SPI
+
+#include &quot;PlatformUtilities.h&quot;
+#include &quot;PlatformWebView.h&quot;
+#include &quot;Test.h&quot;
+
+#include &lt;WebKit/WKString.h&gt;
+
+namespace TestWebKitAPI {
+
+static bool finished = false;
+static int didRemoveFrameFromHierarchyCount;
+
+static void didFinishLoadForFrame(WKPageRef, WKFrameRef frame, WKTypeRef, const void*)
+{
+    // Only mark finished when the main frame loads
+    if (!WKFrameIsMainFrame(frame))
+        return;
+
+    finished = true;
+}
+
+static void setPageLoaderClient(WKPageRef page)
+{
+    WKPageLoaderClientV1 loaderClient;
+    memset(&amp;loaderClient, 0, sizeof(loaderClient));
+
+    loaderClient.base.version = 1;
+    loaderClient.didFinishLoadForFrame = didFinishLoadForFrame;
+
+    WKPageSetPageLoaderClient(page, &amp;loaderClient.base);
+}
+
+static void didReceivePageMessageFromInjectedBundle(WKPageRef, WKStringRef messageName, WKTypeRef, const void*)
+{
+    if (WKStringIsEqualToUTF8CString(messageName, &quot;DidRemoveFrameFromHierarchy&quot;))
+        ++didRemoveFrameFromHierarchyCount;
+}
+
+static void setInjectedBundleClient(WKPageRef page)
+{
+    WKPageInjectedBundleClientV0 injectedBundleClient = {
+        { 0, nullptr },
+        didReceivePageMessageFromInjectedBundle,
+        nullptr,
+    };
+    WKPageSetPageInjectedBundleClient(page, &amp;injectedBundleClient.base);
+}
+
+TEST(WebKit2, DidRemoveFrameFromHiearchyInPageCache)
+{
+    WKRetainPtr&lt;WKContextRef&gt; context = adoptWK(Util::createContextForInjectedBundleTest(&quot;DidRemoveFrameFromHiearchyInPageCache&quot;));
+    // Enable the page cache so we can test the WKBundlePageDidRemoveFrameFromHierarchyCallback API
+    WKContextSetCacheModel(context.get(), kWKCacheModelPrimaryWebBrowser);
+
+    PlatformWebView webView(context.get());
+    setPageLoaderClient(webView.page());
+    setInjectedBundleClient(webView.page());
+
+    finished = false;
+    WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource(&quot;many-iframes&quot;, &quot;html&quot;)).get());
+    Util::run(&amp;finished);
+
+    // Perform a couple of loads so &quot;many-iframes&quot; gets kicked out of the PageCache.
+    finished = false;
+    WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource(&quot;simple&quot;, &quot;html&quot;)).get());
+    Util::run(&amp;finished);
+
+    finished = false;
+    WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource(&quot;simple2&quot;, &quot;html&quot;)).get());
+    Util::run(&amp;finished);
+
+    finished = false;
+    WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource(&quot;simple3&quot;, &quot;html&quot;)).get());
+    Util::run(&amp;finished);
+
+    EXPECT_EQ(didRemoveFrameFromHierarchyCount, 10);
+}
+
+} // namespace TestWebKitAPI
+
+#endif
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit214ToolsTestWebKitAPITestsWebKit2DidRemoveFrameFromHiearchyInPageCache_Bundlecpp"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.14/Tools/TestWebKitAPI/Tests/WebKit2/DidRemoveFrameFromHiearchyInPageCache_Bundle.cpp (0 => 207948)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Tools/TestWebKitAPI/Tests/WebKit2/DidRemoveFrameFromHiearchyInPageCache_Bundle.cpp                                (rev 0)
+++ releases/WebKitGTK/webkit-2.14/Tools/TestWebKitAPI/Tests/WebKit2/DidRemoveFrameFromHiearchyInPageCache_Bundle.cpp        2016-10-27 07:18:05 UTC (rev 207948)
</span><span class="lines">@@ -0,0 +1,75 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+
+#if WK_HAVE_C_SPI
+
+#include &quot;InjectedBundleTest.h&quot;
+
+#include &quot;PlatformUtilities.h&quot;
+#include &lt;WebKit/WKBundlePage.h&gt;
+
+namespace TestWebKitAPI {
+
+class DidRemoveFrameFromHiearchyInPageCacheTest : public InjectedBundleTest {
+public:
+    DidRemoveFrameFromHiearchyInPageCacheTest(const std::string&amp; identifier);
+
+    virtual void didCreatePage(WKBundleRef, WKBundlePageRef);
+};
+
+static InjectedBundleTest::Register&lt;DidRemoveFrameFromHiearchyInPageCacheTest&gt; registrar(&quot;DidRemoveFrameFromHiearchyInPageCache&quot;);
+
+static unsigned didRemoveFrameFromHierarchyCount;
+
+void didRemoveFrameFromHierarchyCallback(WKBundlePageRef page, WKBundleFrameRef, WKTypeRef*, const void*)
+{
+    didRemoveFrameFromHierarchyCount++;
+
+    WKRetainPtr&lt;WKStringRef&gt; message(AdoptWK, WKStringCreateWithUTF8CString(&quot;DidRemoveFrameFromHierarchy&quot;));
+    WKBundlePagePostMessage(page, message.get(), message.get());
+}
+
+DidRemoveFrameFromHiearchyInPageCacheTest::DidRemoveFrameFromHiearchyInPageCacheTest(const std::string&amp; identifier)
+    : InjectedBundleTest(identifier)
+{
+}
+
+void DidRemoveFrameFromHiearchyInPageCacheTest::didCreatePage(WKBundleRef bundle, WKBundlePageRef page)
+{
+    WKBundlePageLoaderClientV8 pageLoaderClient;
+    memset(&amp;pageLoaderClient, 0, sizeof(pageLoaderClient));
+
+    pageLoaderClient.base.version = 8;
+    pageLoaderClient.base.clientInfo = this;
+    pageLoaderClient.didRemoveFrameFromHierarchy = didRemoveFrameFromHierarchyCallback;
+
+    WKBundlePageSetPageLoaderClient(page, &amp;pageLoaderClient.base);
+}
+
+} // namespace TestWebKitAPI
+
+#endif
</ins></span></pre></div>
<a id="releasesWebKitGTKwebkit214ToolsTestWebKitAPITestsWebKit2manyiframeshtml"></a>
<div class="addfile"><h4>Added: releases/WebKitGTK/webkit-2.14/Tools/TestWebKitAPI/Tests/WebKit2/many-iframes.html (0 => 207948)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.14/Tools/TestWebKitAPI/Tests/WebKit2/many-iframes.html                                (rev 0)
+++ releases/WebKitGTK/webkit-2.14/Tools/TestWebKitAPI/Tests/WebKit2/many-iframes.html        2016-10-27 07:18:05 UTC (rev 207948)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+&lt;html&gt;
+&lt;body&gt;
+  Simple HTML file with many iframes.
+  &lt;iframe src=&quot;simple.html&quot;&gt;&lt;/iframe&gt;
+  &lt;iframe src=&quot;simple.html&quot;&gt;&lt;/iframe&gt;
+  &lt;iframe src=&quot;simple.html&quot;&gt;&lt;/iframe&gt;
+  &lt;iframe src=&quot;simple.html&quot;&gt;&lt;/iframe&gt;
+  &lt;iframe src=&quot;simple.html&quot;&gt;&lt;/iframe&gt;
+  &lt;iframe src=&quot;simple.html&quot;&gt;&lt;/iframe&gt;
+  &lt;iframe src=&quot;simple.html&quot;&gt;&lt;/iframe&gt;
+  &lt;iframe src=&quot;simple.html&quot;&gt;&lt;/iframe&gt;
+  &lt;iframe src=&quot;simple.html&quot;&gt;&lt;/iframe&gt;
+  &lt;iframe src=&quot;simple.html&quot;&gt;&lt;/iframe&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre>
</div>
</div>

</body>
</html>