Title: [161998] trunk/Source/WebKit2
Revision
161998
Author
[email protected]
Date
2014-01-14 13:19:12 -0800 (Tue, 14 Jan 2014)

Log Message

WebKit2 leaks sudden termination assertions when a page with unload handlers is closed.
<https://webkit.org/b/126974> / <rdar://problem/15812954>

When a page with an unload handler is loaded, the web process tells the UI process that it
should disable sudden termination. However, when the page is closed the connection between
the web and UI process is torn down before the web content has a chance to tell the UI
process to reenable sudden termination.

Reviewed by Anders Carlsson.

* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::WebProcessProxy):
(WebKit::WebProcessProxy::~WebProcessProxy): Balance any outstanding disableSuddenTermination calls.
(WebKit::WebProcessProxy::enableSuddenTermination): Decrement the count.
(WebKit::WebProcessProxy::disableSuddenTermination): Increment the count.
* UIProcess/WebProcessProxy.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (161997 => 161998)


--- trunk/Source/WebKit2/ChangeLog	2014-01-14 20:59:26 UTC (rev 161997)
+++ trunk/Source/WebKit2/ChangeLog	2014-01-14 21:19:12 UTC (rev 161998)
@@ -1,3 +1,22 @@
+2014-01-14  Mark Rowe  <[email protected]>
+
+        WebKit2 leaks sudden termination assertions when a page with unload handlers is closed.
+        <https://webkit.org/b/126974> / <rdar://problem/15812954>
+
+        When a page with an unload handler is loaded, the web process tells the UI process that it
+        should disable sudden termination. However, when the page is closed the connection between
+        the web and UI process is torn down before the web content has a chance to tell the UI
+        process to reenable sudden termination.
+
+        Reviewed by Anders Carlsson.
+
+        * UIProcess/WebProcessProxy.cpp:
+        (WebKit::WebProcessProxy::WebProcessProxy):
+        (WebKit::WebProcessProxy::~WebProcessProxy): Balance any outstanding disableSuddenTermination calls.
+        (WebKit::WebProcessProxy::enableSuddenTermination): Decrement the count.
+        (WebKit::WebProcessProxy::disableSuddenTermination): Increment the count.
+        * UIProcess/WebProcessProxy.h:
+
 2014-01-14  Joseph Pecoraro  <[email protected]>
 
         Web Inspector: For Remote Inspection link WebProcess's to their parent UIProcess

Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp (161997 => 161998)


--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp	2014-01-14 20:59:26 UTC (rev 161997)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp	2014-01-14 21:19:12 UTC (rev 161998)
@@ -94,6 +94,7 @@
 #if PLATFORM(MAC)
     , m_processSuppressionEnabled(false)
 #endif
+    , m_numberOfTimesSuddenTerminationWasDisabled(0)
 {
     connect();
 }
@@ -102,6 +103,9 @@
 {
     if (m_webConnection)
         m_webConnection->invalidate();
+
+    while (m_numberOfTimesSuddenTerminationWasDisabled-- > 0)
+        WebCore::enableSuddenTermination();
 }
 
 void WebProcessProxy::getLaunchOptions(ProcessLauncher::LaunchOptions& launchOptions)
@@ -662,7 +666,9 @@
     if (!isValid())
         return;
 
+    ASSERT(m_numberOfTimesSuddenTerminationWasDisabled);
     WebCore::enableSuddenTermination();
+    --m_numberOfTimesSuddenTerminationWasDisabled;
 }
 
 void WebProcessProxy::disableSuddenTermination()
@@ -671,6 +677,7 @@
         return;
 
     WebCore::disableSuddenTermination();
+    ++m_numberOfTimesSuddenTerminationWasDisabled;
 }
 
 RefPtr<API::Object> WebProcessProxy::apiObjectByConvertingToHandles(API::Object* object)

Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.h (161997 => 161998)


--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.h	2014-01-14 20:59:26 UTC (rev 161997)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.h	2014-01-14 21:19:12 UTC (rev 161998)
@@ -208,6 +208,8 @@
     HashSet<uint64_t> m_processSuppressiblePages;
     bool m_processSuppressionEnabled;
 #endif
+
+    int m_numberOfTimesSuddenTerminationWasDisabled;
 };
     
 } // namespace WebKit
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to