<!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>[210822] trunk/Source</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/210822">210822</a></dd>
<dt>Author</dt> <dd>joepeck@webkit.org</dd>
<dt>Date</dt> <dd>2017-01-17 11:24:23 -0800 (Tue, 17 Jan 2017)</dd>
</dl>
<h3>Log Message</h3>
<pre>Crash when closing tab with debugger paused
https://bugs.webkit.org/show_bug.cgi?id=161746
<rdar://problem/15607819>
Reviewed by Brian Burg and Brent Fulgham.
Source/WebCore:
* page/Page.h:
(WebCore::Page::incrementNestedRunLoopCount):
(WebCore::Page::decrementNestedRunLoopCount):
(WebCore::Page::insideNestedRunLoop):
Keep track of whether or not this Page is inside of a nested run loop.
Currently the only nested run loop we know about is EventLoop used
by Web Inspector when debugging JavaScript.
(WebCore::Page::whenUnnested):
Callback that can be called when we are no longer inside of a nested
run loop.
(WebCore::Page::~Page):
Ensure we are not in a known nested run loop when destructing, since
that could be unsafe.
* inspector/PageScriptDebugServer.cpp:
(WebCore::PageScriptDebugServer::runEventLoopWhilePausedInternal):
Increment and decrement as we go into or leave the nested runloop.
* inspector/InspectorController.cpp:
(WebCore::InspectorController::inspectedPageDestroyed):
(WebCore::InspectorController::disconnectAllFrontends):
Rework destruction to allow disconnectAllFrontends to happen earlier
if necessary. WebKit clients may use this to disconnect remote
frontends when closing a Page.
Source/WebKit/mac:
* WebView/WebView.mm:
(WebKit::DeferredPageDestructor::createDeferredPageDestructor):
(WebKit::DeferredPageDestructor::DeferredPageDestructor):
(WebKit::DeferredPageDestructor::tryDestruction):
(-[WebView _close]):
Defer destruction of the Page if we are in a nested runloop.
Source/WebKit2:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::DeferredPageDestructor::createDeferredPageDestructor):
(WebKit::DeferredPageDestructor::DeferredPageDestructor):
(WebKit::DeferredPageDestructor::tryDestruction):
(WebKit::WebPage::close):
Defer destruction of the Page and WebPage if we are in a nested runloop.
Also, proactively close all inspector frontends, including remote frontends.
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::handleSyntheticClick):
(WebKit::WebPage::completeSyntheticClick):
Return early in some cases where a nested run loop may have closed
the WebPage on us while handling JavaScript events.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorControllercpp">trunk/Source/WebCore/inspector/InspectorController.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorPageScriptDebugServercpp">trunk/Source/WebCore/inspector/PageScriptDebugServer.cpp</a></li>
<li><a href="#trunkSourceWebCorepagePagecpp">trunk/Source/WebCore/page/Page.cpp</a></li>
<li><a href="#trunkSourceWebCorepagePageh">trunk/Source/WebCore/page/Page.h</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewmm">trunk/Source/WebKit/mac/WebView/WebView.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageiosWebPageIOSmm">trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (210821 => 210822)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-01-17 18:55:55 UTC (rev 210821)
+++ trunk/Source/WebCore/ChangeLog        2017-01-17 19:24:23 UTC (rev 210822)
</span><span class="lines">@@ -1,3 +1,38 @@
</span><ins>+2017-01-17 Joseph Pecoraro <pecoraro@apple.com>
+
+ Crash when closing tab with debugger paused
+ https://bugs.webkit.org/show_bug.cgi?id=161746
+ <rdar://problem/15607819>
+
+ Reviewed by Brian Burg and Brent Fulgham.
+
+ * page/Page.h:
+ (WebCore::Page::incrementNestedRunLoopCount):
+ (WebCore::Page::decrementNestedRunLoopCount):
+ (WebCore::Page::insideNestedRunLoop):
+ Keep track of whether or not this Page is inside of a nested run loop.
+ Currently the only nested run loop we know about is EventLoop used
+ by Web Inspector when debugging JavaScript.
+
+ (WebCore::Page::whenUnnested):
+ Callback that can be called when we are no longer inside of a nested
+ run loop.
+
+ (WebCore::Page::~Page):
+ Ensure we are not in a known nested run loop when destructing, since
+ that could be unsafe.
+
+ * inspector/PageScriptDebugServer.cpp:
+ (WebCore::PageScriptDebugServer::runEventLoopWhilePausedInternal):
+ Increment and decrement as we go into or leave the nested runloop.
+
+ * inspector/InspectorController.cpp:
+ (WebCore::InspectorController::inspectedPageDestroyed):
+ (WebCore::InspectorController::disconnectAllFrontends):
+ Rework destruction to allow disconnectAllFrontends to happen earlier
+ if necessary. WebKit clients may use this to disconnect remote
+ frontends when closing a Page.
+
</ins><span class="cx"> 2017-01-16 Filip Pizlo <fpizlo@apple.com>
</span><span class="cx">
</span><span class="cx"> JSCell::classInfo() shouldn't have a bunch of mitigations for being called during destruction
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorController.cpp (210821 => 210822)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorController.cpp        2017-01-17 18:55:55 UTC (rev 210821)
+++ trunk/Source/WebCore/inspector/InspectorController.cpp        2017-01-17 19:24:23 UTC (rev 210822)
</span><span class="lines">@@ -203,16 +203,13 @@
</span><span class="cx"> {
</span><span class="cx"> m_injectedScriptManager->disconnect();
</span><span class="cx">
</span><del>- // If the local frontend page was destroyed, close the window.
- if (m_inspectorFrontendClient)
- m_inspectorFrontendClient->closeWindow();
-
- // The frontend should call setInspectorFrontendClient(nullptr) under closeWindow().
- ASSERT(!m_inspectorFrontendClient);
-
</del><span class="cx"> // Clean up resources and disconnect local and remote frontends.
</span><span class="cx"> disconnectAllFrontends();
</span><span class="cx">
</span><ins>+ // Disconnect the client.
+ m_inspectorClient->inspectedPageDestroyed();
+ m_inspectorClient = nullptr;
+
</ins><span class="cx"> m_agents.discardValues();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -300,9 +297,16 @@
</span><span class="cx">
</span><span class="cx"> void InspectorController::disconnectAllFrontends()
</span><span class="cx"> {
</span><del>- // The local frontend client should be disconnected already.
</del><ins>+ // If the local frontend page was destroyed, close the window.
+ if (m_inspectorFrontendClient)
+ m_inspectorFrontendClient->closeWindow();
+
+ // The frontend should call setInspectorFrontendClient(nullptr) under closeWindow().
</ins><span class="cx"> ASSERT(!m_inspectorFrontendClient);
</span><span class="cx">
</span><ins>+ if (!m_frontendRouter->hasFrontends())
+ return;
+
</ins><span class="cx"> for (unsigned i = 0; i < m_frontendRouter->frontendCount(); ++i)
</span><span class="cx"> InspectorInstrumentation::frontendDeleted();
</span><span class="cx">
</span><span class="lines">@@ -315,10 +319,6 @@
</span><span class="cx"> // Destroy the inspector overlay's page.
</span><span class="cx"> m_overlay->freePage();
</span><span class="cx">
</span><del>- // Disconnect local WK2 frontend and destroy the client.
- m_inspectorClient->inspectedPageDestroyed();
- m_inspectorClient = nullptr;
-
</del><span class="cx"> // Disconnect any remaining remote frontends.
</span><span class="cx"> m_frontendRouter->disconnectAllFrontends();
</span><span class="cx"> m_isAutomaticInspection = false;
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorPageScriptDebugServercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/PageScriptDebugServer.cpp (210821 => 210822)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/PageScriptDebugServer.cpp        2017-01-17 18:55:55 UTC (rev 210821)
+++ trunk/Source/WebCore/inspector/PageScriptDebugServer.cpp        2017-01-17 19:24:23 UTC (rev 210822)
</span><span class="lines">@@ -114,9 +114,13 @@
</span><span class="cx"> {
</span><span class="cx"> TimerBase::fireTimersInNestedEventLoop();
</span><span class="cx">
</span><ins>+ m_page.incrementNestedRunLoopCount();
+
</ins><span class="cx"> EventLoop loop;
</span><span class="cx"> while (!m_doneProcessingDebuggerEvents && !loop.ended())
</span><span class="cx"> loop.cycle();
</span><ins>+
+ m_page.decrementNestedRunLoopCount();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool PageScriptDebugServer::isContentScript(ExecState* exec) const
</span></span></pre></div>
<a id="trunkSourceWebCorepagePagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Page.cpp (210821 => 210822)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Page.cpp        2017-01-17 18:55:55 UTC (rev 210821)
+++ trunk/Source/WebCore/page/Page.cpp        2017-01-17 19:24:23 UTC (rev 210822)
</span><span class="lines">@@ -200,7 +200,6 @@
</span><span class="cx"> , m_validationMessageClient(WTFMove(pageConfiguration.validationMessageClient))
</span><span class="cx"> , m_diagnosticLoggingClient(WTFMove(pageConfiguration.diagnosticLoggingClient))
</span><span class="cx"> , m_webGLStateTracker(WTFMove(pageConfiguration.webGLStateTracker))
</span><del>- , m_subframeCount(0)
</del><span class="cx"> , m_openedByDOM(false)
</span><span class="cx"> , m_tabKeyCyclesThroughElements(true)
</span><span class="cx"> , m_defersLoading(false)
</span><span class="lines">@@ -288,6 +287,9 @@
</span><span class="cx">
</span><span class="cx"> Page::~Page()
</span><span class="cx"> {
</span><ins>+ ASSERT(!m_nestedRunLoopCount);
+ ASSERT(!m_unnestCallback);
+
</ins><span class="cx"> m_validationMessageClient = nullptr;
</span><span class="cx"> m_diagnosticLoggingClient = nullptr;
</span><span class="cx"> m_mainFrame->setView(nullptr);
</span><span class="lines">@@ -1684,6 +1686,41 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+void Page::incrementNestedRunLoopCount()
+{
+ m_nestedRunLoopCount++;
+}
+
+void Page::decrementNestedRunLoopCount()
+{
+ ASSERT(m_nestedRunLoopCount);
+ if (m_nestedRunLoopCount <= 0)
+ return;
+
+ m_nestedRunLoopCount--;
+
+ if (!m_nestedRunLoopCount && m_unnestCallback) {
+ callOnMainThread([this] {
+ if (insideNestedRunLoop())
+ return;
+
+ // This callback may destruct the Page.
+ if (m_unnestCallback) {
+ auto callback = m_unnestCallback;
+ m_unnestCallback = nullptr;
+ callback();
+ }
+ });
+ }
+}
+
+void Page::whenUnnested(std::function<void()> callback)
+{
+ ASSERT(!m_unnestCallback);
+
+ m_unnestCallback = callback;
+}
+
</ins><span class="cx"> #if ENABLE(REMOTE_INSPECTOR)
</span><span class="cx"> bool Page::remoteInspectionAllowed() const
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCorepagePageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Page.h (210821 => 210822)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Page.h        2017-01-17 18:55:55 UTC (rev 210821)
+++ trunk/Source/WebCore/page/Page.h        2017-01-17 19:24:23 UTC (rev 210822)
</span><span class="lines">@@ -192,6 +192,11 @@
</span><span class="cx"> void decrementSubframeCount() { ASSERT(m_subframeCount); --m_subframeCount; }
</span><span class="cx"> int subframeCount() const { checkSubframeCountConsistency(); return m_subframeCount; }
</span><span class="cx">
</span><ins>+ void incrementNestedRunLoopCount();
+ void decrementNestedRunLoopCount();
+ bool insideNestedRunLoop() const { return m_nestedRunLoopCount > 0; }
+ WEBCORE_EXPORT void whenUnnested(std::function<void()>);
+
</ins><span class="cx"> #if ENABLE(REMOTE_INSPECTOR)
</span><span class="cx"> WEBCORE_EXPORT bool remoteInspectionAllowed() const;
</span><span class="cx"> WEBCORE_EXPORT void setRemoteInspectionAllowed(bool);
</span><span class="lines">@@ -622,7 +627,10 @@
</span><span class="cx"> std::unique_ptr<DiagnosticLoggingClient> m_diagnosticLoggingClient;
</span><span class="cx"> std::unique_ptr<WebGLStateTracker> m_webGLStateTracker;
</span><span class="cx">
</span><del>- int m_subframeCount;
</del><ins>+ int m_nestedRunLoopCount { 0 };
+ std::function<void()> m_unnestCallback;
+
+ int m_subframeCount { 0 };
</ins><span class="cx"> String m_groupName;
</span><span class="cx"> bool m_openedByDOM;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (210821 => 210822)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2017-01-17 18:55:55 UTC (rev 210821)
+++ trunk/Source/WebKit/mac/ChangeLog        2017-01-17 19:24:23 UTC (rev 210822)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2017-01-17 Joseph Pecoraro <pecoraro@apple.com>
+
+ Crash when closing tab with debugger paused
+ https://bugs.webkit.org/show_bug.cgi?id=161746
+ <rdar://problem/15607819>
+
+ Reviewed by Brian Burg and Brent Fulgham.
+
+ * WebView/WebView.mm:
+ (WebKit::DeferredPageDestructor::createDeferredPageDestructor):
+ (WebKit::DeferredPageDestructor::DeferredPageDestructor):
+ (WebKit::DeferredPageDestructor::tryDestruction):
+ (-[WebView _close]):
+ Defer destruction of the Page if we are in a nested runloop.
+
</ins><span class="cx"> 2017-01-16 Joseph Pecoraro <pecoraro@apple.com>
</span><span class="cx">
</span><span class="cx"> Remove the REQUEST_ANIMATION_FRAME flag
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (210821 => 210822)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebView.mm        2017-01-17 18:55:55 UTC (rev 210821)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm        2017-01-17 19:24:23 UTC (rev 210822)
</span><span class="lines">@@ -582,6 +582,38 @@
</span><span class="cx"> return WebPageVisibilityStateVisible;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+namespace WebKit {
+
+class DeferredPageDestructor {
+public:
+ static void createDeferredPageDestructor(std::unique_ptr<Page> page)
+ {
+ new DeferredPageDestructor(WTFMove(page));
+ }
+
+private:
+ DeferredPageDestructor(std::unique_ptr<Page> page)
+ : m_page(WTFMove(page))
+ {
+ tryDestruction();
+ }
+
+ void tryDestruction()
+ {
+ if (m_page->insideNestedRunLoop()) {
+ m_page->whenUnnested([this] { tryDestruction(); });
+ return;
+ }
+
+ m_page = nullptr;
+ delete this;
+ }
+
+ std::unique_ptr<Page> m_page;
+};
+
+} // namespace WebKit
+
</ins><span class="cx"> @interface WebView (WebFileInternal)
</span><span class="cx"> #if !PLATFORM(IOS)
</span><span class="cx"> - (float)_deviceScaleFactor;
</span><span class="lines">@@ -2148,8 +2180,8 @@
</span><span class="cx"> // all the plug-ins in the page cache to break any retain cycles.
</span><span class="cx"> // See comment in HistoryItem::releaseAllPendingPageCaches() for more information.
</span><span class="cx"> Page* page = _private->page;
</span><del>- _private->page = 0;
- delete page;
</del><ins>+ _private->page = nullptr;
+ WebKit::DeferredPageDestructor::createDeferredPageDestructor(std::unique_ptr<Page>(page));
</ins><span class="cx">
</span><span class="cx"> #if !PLATFORM(IOS)
</span><span class="cx"> if (_private->hasSpellCheckerDocumentTag) {
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (210821 => 210822)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2017-01-17 18:55:55 UTC (rev 210821)
+++ trunk/Source/WebKit2/ChangeLog        2017-01-17 19:24:23 UTC (rev 210822)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2017-01-17 Joseph Pecoraro <pecoraro@apple.com>
+
+ Crash when closing tab with debugger paused
+ https://bugs.webkit.org/show_bug.cgi?id=161746
+ <rdar://problem/15607819>
+
+ Reviewed by Brian Burg and Brent Fulgham.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::DeferredPageDestructor::createDeferredPageDestructor):
+ (WebKit::DeferredPageDestructor::DeferredPageDestructor):
+ (WebKit::DeferredPageDestructor::tryDestruction):
+ (WebKit::WebPage::close):
+ Defer destruction of the Page and WebPage if we are in a nested runloop.
+ Also, proactively close all inspector frontends, including remote frontends.
+
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::handleSyntheticClick):
+ (WebKit::WebPage::completeSyntheticClick):
+ Return early in some cases where a nested run loop may have closed
+ the WebPage on us while handling JavaScript events.
+
</ins><span class="cx"> 2017-01-16 Joseph Pecoraro <pecoraro@apple.com>
</span><span class="cx">
</span><span class="cx"> Remove the REQUEST_ANIMATION_FRAME flag
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (210821 => 210822)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2017-01-17 18:55:55 UTC (rev 210821)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2017-01-17 19:24:23 UTC (rev 210822)
</span><span class="lines">@@ -144,6 +144,7 @@
</span><span class="cx"> #include <WebCore/HistoryController.h>
</span><span class="cx"> #include <WebCore/HistoryItem.h>
</span><span class="cx"> #include <WebCore/HitTestResult.h>
</span><ins>+#include <WebCore/InspectorController.h>
</ins><span class="cx"> #include <WebCore/JSDOMWindow.h>
</span><span class="cx"> #include <WebCore/KeyboardEvent.h>
</span><span class="cx"> #include <WebCore/MIMETypeRegistry.h>
</span><span class="lines">@@ -279,6 +280,37 @@
</span><span class="cx"> WebPage* m_page;
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+class DeferredPageDestructor {
+public:
+ static void createDeferredPageDestructor(std::unique_ptr<Page> page, WebPage* webPage)
+ {
+ new DeferredPageDestructor(WTFMove(page), webPage);
+ }
+
+private:
+ DeferredPageDestructor(std::unique_ptr<Page> page, WebPage* webPage)
+ : m_page(WTFMove(page))
+ , m_webPage(webPage)
+ {
+ tryDestruction();
+ }
+
+ void tryDestruction()
+ {
+ if (m_page->insideNestedRunLoop()) {
+ m_page->whenUnnested([this] { tryDestruction(); });
+ return;
+ }
+
+ m_page = nullptr;
+ m_webPage = nullptr;
+ delete this;
+ }
+
+ std::unique_ptr<Page> m_page;
+ RefPtr<WebPage> m_webPage;
+};
+
</ins><span class="cx"> DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, webPageCounter, ("WebPage"));
</span><span class="cx">
</span><span class="cx"> Ref<WebPage> WebPage::create(uint64_t pageID, const WebPageCreationParameters& parameters)
</span><span class="lines">@@ -1027,6 +1059,8 @@
</span><span class="cx"> m_inspector = nullptr;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ m_page->inspectorController().disconnectAllFrontends();
+
</ins><span class="cx"> #if ENABLE(FULLSCREEN_API)
</span><span class="cx"> m_fullScreenManager = nullptr;
</span><span class="cx"> #endif
</span><span class="lines">@@ -1084,9 +1118,10 @@
</span><span class="cx">
</span><span class="cx"> m_printContext = nullptr;
</span><span class="cx"> m_mainFrame->coreFrame()->loader().detachFromParent();
</span><del>- m_page = nullptr;
</del><span class="cx"> m_drawingArea = nullptr;
</span><span class="cx">
</span><ins>+ DeferredPageDestructor::createDeferredPageDestructor(WTFMove(m_page), this);
+
</ins><span class="cx"> bool isRunningModal = m_isRunningModal;
</span><span class="cx"> m_isRunningModal = false;
</span><span class="cx">
</span><span class="lines">@@ -2398,7 +2433,6 @@
</span><span class="cx"> bool handled = handleGestureEvent(gestureEvent, m_page.get());
</span><span class="cx"> send(Messages::WebPageProxy::DidReceiveEvent(static_cast<uint32_t>(gestureEvent.type()), handled));
</span><span class="cx"> }
</span><del>-
</del><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> bool WebPage::scroll(Page* page, ScrollDirection direction, ScrollGranularity granularity)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageiosWebPageIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (210821 => 210822)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm        2017-01-17 18:55:55 UTC (rev 210821)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm        2017-01-17 19:24:23 UTC (rev 210822)
</span><span class="lines">@@ -535,6 +535,9 @@
</span><span class="cx"> m_pendingSyntheticClickNode = nullptr;
</span><span class="cx"> m_pendingSyntheticClickLocation = FloatPoint();
</span><span class="cx">
</span><ins>+ if (m_isClosed)
+ return;
+
</ins><span class="cx"> switch (WKObservedContentChange()) {
</span><span class="cx"> case WKContentVisibilityChange:
</span><span class="cx"> // The move event caused new contents to appear. Don't send the click event.
</span><span class="lines">@@ -570,12 +573,19 @@
</span><span class="cx">
</span><span class="cx"> RefPtr<Frame> oldFocusedFrame = m_page->focusController().focusedFrame();
</span><span class="cx"> RefPtr<Element> oldFocusedElement = oldFocusedFrame ? oldFocusedFrame->document()->focusedElement() : nullptr;
</span><del>- m_userIsInteracting = true;
</del><span class="cx">
</span><ins>+ SetForScope<bool> userIsInteractingChange { m_userIsInteracting, true };
+
</ins><span class="cx"> bool tapWasHandled = false;
</span><span class="cx"> m_lastInteractionLocation = roundedAdjustedPoint;
</span><ins>+
</ins><span class="cx"> tapWasHandled |= mainframe.eventHandler().handleMousePressEvent(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, LeftButton, PlatformEvent::MousePressed, 1, false, false, false, false, currentTime(), WebCore::ForceAtClick, syntheticClickType));
</span><ins>+ if (m_isClosed)
+ return;
+
</ins><span class="cx"> tapWasHandled |= mainframe.eventHandler().handleMouseReleaseEvent(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, LeftButton, PlatformEvent::MouseReleased, 1, false, false, false, false, currentTime(), WebCore::ForceAtClick, syntheticClickType));
</span><ins>+ if (m_isClosed)
+ return;
</ins><span class="cx">
</span><span class="cx"> RefPtr<Frame> newFocusedFrame = m_page->focusController().focusedFrame();
</span><span class="cx"> RefPtr<Element> newFocusedElement = newFocusedFrame ? newFocusedFrame->document()->focusedElement() : nullptr;
</span><span class="lines">@@ -587,8 +597,6 @@
</span><span class="cx"> if (newFocusedElement && newFocusedElement == oldFocusedElement)
</span><span class="cx"> elementDidFocus(newFocusedElement.get());
</span><span class="cx">
</span><del>- m_userIsInteracting = false;
-
</del><span class="cx"> if (!tapWasHandled || !nodeRespondingToClick || !nodeRespondingToClick->isElementNode())
</span><span class="cx"> send(Messages::WebPageProxy::DidNotHandleTapAsClick(roundedIntPoint(location)));
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>