Diff
Modified: releases/WebKitGTK/webkit-2.0/Source/WebKit2/ChangeLog (151366 => 151367)
--- releases/WebKitGTK/webkit-2.0/Source/WebKit2/ChangeLog 2013-06-10 08:47:57 UTC (rev 151366)
+++ releases/WebKitGTK/webkit-2.0/Source/WebKit2/ChangeLog 2013-06-10 09:09:47 UTC (rev 151367)
@@ -1,3 +1,42 @@
+2013-04-12 Adenilson Cavalcanti <[email protected]>
+
+ [WK2] WebPageProxy loadURL() won't work when called just after terminateProcess()
+ https://bugs.webkit.org/show_bug.cgi?id=110743
+
+ Reviewed by Benjamin Poulain.
+
+ A call to loadURL() just after terminating WebProcess will fail thanks to
+ WebPageProxy being in an undefined state since it is in the middle of its own
+ cleanup after process termination.
+
+ To properly fix this, not only WebPageProxy cleanup should be made
+ at WebProcess termination request, but also WebProcessProxy needs
+ to only return to its caller after terminating the process and
+ closing connections. Otherwise, WebPageProxy can even be able to
+ detect that WebProcess is no longer running, but a call to respawn
+ the process will fail.
+
+ To fix these issues, this patch moves the cleanup code to a shared private function
+ that is used for both the cases i.e. user termination and real crash. WebProcess
+ shutdown is done using a new method that ensures that all cleanup was done before
+ returning.
+
+ A last change introduced in this patch is that for user requested termination,
+ clients are no longer notified of a crash (since it is not a crash).
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::terminateProcess):
+ (WebKit::WebPageProxy::processDidCrash):
+ (WebKit):
+ (WebKit::WebPageProxy::resetStateAfterProcessExited):
+ * UIProcess/WebPageProxy.h:
+ (WebPageProxy):
+ * UIProcess/WebProcessProxy.cpp:
+ (WebKit::WebProcessProxy::userRequestedTerminate):
+ (WebKit):
+ * UIProcess/WebProcessProxy.h:
+ (WebProcessProxy):
+
2013-04-26 Eduardo Lima Mitev <[email protected]>
[GTK] Compilation of ProcessLauncherGtk.cpp fails due to unresolved symbols
Modified: releases/WebKitGTK/webkit-2.0/Source/WebKit2/UIProcess/WebPageProxy.cpp (151366 => 151367)
--- releases/WebKitGTK/webkit-2.0/Source/WebKit2/UIProcess/WebPageProxy.cpp 2013-06-10 08:47:57 UTC (rev 151366)
+++ releases/WebKitGTK/webkit-2.0/Source/WebKit2/UIProcess/WebPageProxy.cpp 2013-06-10 09:09:47 UTC (rev 151367)
@@ -1477,7 +1477,8 @@
if (!m_isValid)
return;
- m_process->terminate();
+ m_process->requestTermination();
+ resetStateAfterProcessExited();
}
#if !USE(CF) || defined(BUILDING_QT__)
@@ -3605,8 +3606,17 @@
void WebPageProxy::processDidCrash()
{
+ ASSERT(m_isValid);
+
+ resetStateAfterProcessExited();
+
+ m_pageClient->processDidCrash();
+ m_loaderClient.processDidCrash(this);
+}
+
+void WebPageProxy::resetStateAfterProcessExited()
+{
ASSERT(m_pageClient);
-
m_process->removeMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_pageID);
m_isValid = false;
@@ -3693,17 +3703,12 @@
m_pendingLearnOrIgnoreWordMessageCount = 0;
- m_pageClient->processDidCrash();
- m_loaderClient.processDidCrash(this);
+ // If the call out to the loader client didn't cause the web process to be relaunched,
+ // we'll call setNeedsDisplay on the view so that we won't have the old contents showing.
+ // If the call did cause the web process to be relaunched, we'll keep the old page contents showing
+ // until the new web process has painted its contents.
+ setViewNeedsDisplay(IntRect(IntPoint(), viewSize()));
- if (!m_isValid) {
- // If the call out to the loader client didn't cause the web process to be relaunched,
- // we'll call setNeedsDisplay on the view so that we won't have the old contents showing.
- // If the call did cause the web process to be relaunched, we'll keep the old page contents showing
- // until the new web process has painted its contents.
- setViewNeedsDisplay(IntRect(IntPoint(), viewSize()));
- }
-
// Can't expect DidReceiveEvent notifications from a crashed web process.
m_keyEventQueue.clear();
Modified: releases/WebKitGTK/webkit-2.0/Source/WebKit2/UIProcess/WebPageProxy.h (151366 => 151367)
--- releases/WebKitGTK/webkit-2.0/Source/WebKit2/UIProcess/WebPageProxy.h 2013-06-10 08:47:57 UTC (rev 151366)
+++ releases/WebKitGTK/webkit-2.0/Source/WebKit2/UIProcess/WebPageProxy.h 2013-06-10 09:09:47 UTC (rev 151367)
@@ -758,6 +758,8 @@
virtual Type type() const { return APIType; }
+ void resetStateAfterProcessExited();
+
// CoreIPC::MessageReceiver
virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&) OVERRIDE;
virtual void didReceiveSyncMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&, OwnPtr<CoreIPC::MessageEncoder>&) OVERRIDE;
Modified: releases/WebKitGTK/webkit-2.0/Source/WebKit2/UIProcess/WebProcessProxy.cpp (151366 => 151367)
--- releases/WebKitGTK/webkit-2.0/Source/WebKit2/UIProcess/WebProcessProxy.cpp 2013-06-10 08:47:57 UTC (rev 151366)
+++ releases/WebKitGTK/webkit-2.0/Source/WebKit2/UIProcess/WebProcessProxy.cpp 2013-06-10 09:09:47 UTC (rev 151367)
@@ -618,4 +618,11 @@
#endif
}
+void WebProcessProxy::requestTermination()
+{
+ ChildProcessProxy::terminate();
+ webConnection()->didClose();
+ disconnect();
+}
+
} // namespace WebKit
Modified: releases/WebKitGTK/webkit-2.0/Source/WebKit2/UIProcess/WebProcessProxy.h (151366 => 151367)
--- releases/WebKitGTK/webkit-2.0/Source/WebKit2/UIProcess/WebProcessProxy.h 2013-06-10 08:47:57 UTC (rev 151366)
+++ releases/WebKitGTK/webkit-2.0/Source/WebKit2/UIProcess/WebProcessProxy.h 2013-06-10 09:09:47 UTC (rev 151367)
@@ -115,6 +115,8 @@
void updateProcessSuppressionState();
#endif
+ void requestTermination();
+
private:
explicit WebProcessProxy(PassRefPtr<WebContext>);
Modified: releases/WebKitGTK/webkit-2.0/Tools/ChangeLog (151366 => 151367)
--- releases/WebKitGTK/webkit-2.0/Tools/ChangeLog 2013-06-10 08:47:57 UTC (rev 151366)
+++ releases/WebKitGTK/webkit-2.0/Tools/ChangeLog 2013-06-10 09:09:47 UTC (rev 151367)
@@ -1,3 +1,31 @@
+2013-04-12 Adenilson Cavalcanti <[email protected]>
+
+ [WK2] WebPageProxy loadURL() won't work when called just after terminateProcess()
+ https://bugs.webkit.org/show_bug.cgi?id=110743
+
+ Reviewed by Benjamin Poulain.
+
+ Adding a new test file to check if loading a page just after WebProcess
+ has crashed (or was terminated) works. The test executes the
+ following steps (Load, Crash, Load), thus stressing WebProcess
+ reattach and process termination code path.
+
+ * TestWebKitAPI/GNUmakefile.am:
+ * TestWebKitAPI/PlatformEfl.cmake:
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit2/MouseMoveAfterCrash.cpp:
+ (TestWebKitAPI::setPageLoaderClient):
+ (TestWebKitAPI::TEST):
+ * TestWebKitAPI/Tests/WebKit2/LoadPageOnCrash.cpp: Added.
+ (TestWebKitAPI):
+ (WebKit2CrashLoader):
+ (TestWebKitAPI::WebKit2CrashLoader::WebKit2CrashLoader):
+ (TestWebKitAPI::WebKit2CrashLoader::loadUrl):
+ (TestWebKitAPI::WebKit2CrashLoader::crashWebProcess):
+ (TestWebKitAPI::didFinishLoad):
+ (TestWebKitAPI::TEST):
+ * TestWebKitAPI/Tests/WebKit2/WebKit2.pro:
+
2013-04-20 Manuel Rego Casasnovas <[email protected]>
[GTK] Fix unit test webkit2/WebKitFindController/hide
Modified: releases/WebKitGTK/webkit-2.0/Tools/TestWebKitAPI/GNUmakefile.am (151366 => 151367)
--- releases/WebKitGTK/webkit-2.0/Tools/TestWebKitAPI/GNUmakefile.am 2013-06-10 08:47:57 UTC (rev 151366)
+++ releases/WebKitGTK/webkit-2.0/Tools/TestWebKitAPI/GNUmakefile.am 2013-06-10 09:09:47 UTC (rev 151367)
@@ -152,6 +152,7 @@
Tools/TestWebKitAPI/Tests/WebKit2/InjectedBundleInitializationUserDataCallbackWins.cpp \
Tools/TestWebKitAPI/Tests/WebKit2/LoadAlternateHTMLStringWithNonDirectoryURL.cpp \
Tools/TestWebKitAPI/Tests/WebKit2/LoadCanceledNoServerRedirectCallback.cpp \
+ Tools/TestWebKitAPI/Tests/WebKit2/LoadPageOnCrash.cpp \
Tools/TestWebKitAPI/Tests/WebKit2/MouseMoveAfterCrash.cpp \
Tools/TestWebKitAPI/Tests/WebKit2/ReloadPageAfterCrash.cpp \
Tools/TestWebKitAPI/Tests/WebKit2/ResizeWindowAfterCrash.cpp \
Modified: releases/WebKitGTK/webkit-2.0/Tools/TestWebKitAPI/PlatformEfl.cmake (151366 => 151367)
--- releases/WebKitGTK/webkit-2.0/Tools/TestWebKitAPI/PlatformEfl.cmake 2013-06-10 08:47:57 UTC (rev 151366)
+++ releases/WebKitGTK/webkit-2.0/Tools/TestWebKitAPI/PlatformEfl.cmake 2013-06-10 09:09:47 UTC (rev 151367)
@@ -67,6 +67,7 @@
InjectedBundleInitializationUserDataCallbackWins
LoadAlternateHTMLStringWithNonDirectoryURL
LoadCanceledNoServerRedirectCallback
+ LoadPageOnCrash
MouseMoveAfterCrash
ReloadPageAfterCrash
ResizeWindowAfterCrash
Modified: releases/WebKitGTK/webkit-2.0/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (151366 => 151367)
--- releases/WebKitGTK/webkit-2.0/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2013-06-10 08:47:57 UTC (rev 151366)
+++ releases/WebKitGTK/webkit-2.0/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2013-06-10 09:09:47 UTC (rev 151367)
@@ -90,6 +90,7 @@
81B50193140F232300D9EB58 /* StringBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 81B50192140F232300D9EB58 /* StringBuilder.cpp */; };
8A2C750E16CED9550024F352 /* ResizeWindowAfterCrash.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A2C750D16CED9550024F352 /* ResizeWindowAfterCrash.cpp */; };
8A3AF93B16C9ED2700D248C1 /* ReloadPageAfterCrash.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A3AF93A16C9ED2700D248C1 /* ReloadPageAfterCrash.cpp */; };
+ 8AA28C1A16D2FA7B002FF4DB /* LoadPageOnCrash.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8AA28C1916D2FA7B002FF4DB /* LoadPageOnCrash.cpp */; };
930AD402150698D00067970F /* lots-of-text.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 930AD401150698B30067970F /* lots-of-text.html */; };
9318778915EEC57700A9CCE3 /* NewFirstVisuallyNonEmptyLayoutForImages.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93AF4ECA1506F035007FD57E /* NewFirstVisuallyNonEmptyLayoutForImages.cpp */; };
9361002914DC95A70061379D /* lots-of-iframes.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 9361002814DC957B0061379D /* lots-of-iframes.html */; };
@@ -351,6 +352,7 @@
81B50192140F232300D9EB58 /* StringBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringBuilder.cpp; path = WTF/StringBuilder.cpp; sourceTree = "<group>"; };
8A2C750D16CED9550024F352 /* ResizeWindowAfterCrash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResizeWindowAfterCrash.cpp; sourceTree = "<group>"; };
8A3AF93A16C9ED2700D248C1 /* ReloadPageAfterCrash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReloadPageAfterCrash.cpp; sourceTree = "<group>"; };
+ 8AA28C1916D2FA7B002FF4DB /* LoadPageOnCrash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LoadPageOnCrash.cpp; sourceTree = "<group>"; };
8DD76FA10486AA7600D96B5E /* TestWebKitAPI */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = TestWebKitAPI; sourceTree = BUILT_PRODUCTS_DIR; };
930AD401150698B30067970F /* lots-of-text.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "lots-of-text.html"; sourceTree = "<group>"; };
9361002814DC957B0061379D /* lots-of-iframes.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "lots-of-iframes.html"; sourceTree = "<group>"; };
@@ -650,6 +652,7 @@
52CB47401448FB9300873995 /* LoadAlternateHTMLStringWithNonDirectoryURL.cpp */,
33DC8910141953A300747EF7 /* LoadCanceledNoServerRedirectCallback.cpp */,
33DC89131419579F00747EF7 /* LoadCanceledNoServerRedirectCallback_Bundle.cpp */,
+ 8AA28C1916D2FA7B002FF4DB /* LoadPageOnCrash.cpp */,
33BE5AF4137B5A6C00705813 /* MouseMoveAfterCrash.cpp */,
33BE5AF8137B5AAE00705813 /* MouseMoveAfterCrash_Bundle.cpp */,
93F1DB3014DA20760024C362 /* NewFirstVisuallyNonEmptyLayout.cpp */,
@@ -1023,6 +1026,7 @@
26300B1816755CD90066886D /* ListHashSet.cpp in Sources */,
52CB47411448FB9300873995 /* LoadAlternateHTMLStringWithNonDirectoryURL.cpp in Sources */,
33DC8911141953A300747EF7 /* LoadCanceledNoServerRedirectCallback.cpp in Sources */,
+ 8AA28C1A16D2FA7B002FF4DB /* LoadPageOnCrash.cpp in Sources */,
B4039F9D15E6D8B3007255D6 /* MathExtras.cpp in Sources */,
CD5497B415857F0C00B5BC30 /* MediaTime.cpp in Sources */,
E1220DA0155B25480013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.mm in Sources */,
Added: releases/WebKitGTK/webkit-2.0/Tools/TestWebKitAPI/Tests/WebKit2/LoadPageOnCrash.cpp (0 => 151367)
--- releases/WebKitGTK/webkit-2.0/Tools/TestWebKitAPI/Tests/WebKit2/LoadPageOnCrash.cpp (rev 0)
+++ releases/WebKitGTK/webkit-2.0/Tools/TestWebKitAPI/Tests/WebKit2/LoadPageOnCrash.cpp 2013-06-10 09:09:47 UTC (rev 151367)
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2013 Adenilson Cavalcanti <[email protected]>
+ *
+ * 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 "config.h"
+#include "PlatformUtilities.h"
+#include "PlatformWebView.h"
+#include "Test.h"
+#include <WebKit2/WKRetainPtr.h>
+
+namespace TestWebKitAPI {
+
+static void didFinishLoad(WKPageRef, WKFrameRef, WKTypeRef, const void*);
+
+class WebKit2CrashLoader {
+public:
+ WebKit2CrashLoader()
+ : context(AdoptWK, WKContextCreate())
+ , webView(context.get())
+ , url(adoptWK(WKURLCreateWithUTF8CString("about:blank")))
+ , firstSuccessfulLoad(false)
+ , secondSuccessfulLoad(false)
+ {
+ memset(&loaderClient, 0, sizeof(loaderClient));
+ loaderClient.clientInfo = this;
+ loaderClient.didFinishLoadForFrame = didFinishLoad;
+ WKPageSetPageLoaderClient(webView.page(), &loaderClient);
+ }
+
+ void loadUrl()
+ {
+ WKPageLoadURL(webView.page(), url.get());
+ }
+
+ void terminateWebProcess()
+ {
+ WKPageTerminate(webView.page());
+ }
+
+ WKRetainPtr<WKContextRef> context;
+ WKPageLoaderClient loaderClient;
+ PlatformWebView webView;
+ WKRetainPtr<WKURLRef> url;
+
+ bool firstSuccessfulLoad;
+ bool secondSuccessfulLoad;
+};
+
+// We are going to have 2 load events intertwined by a simulated crash
+// (i.e. Load -> Crash -> Load).
+void didFinishLoad(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo)
+{
+ WebKit2CrashLoader* testHelper = const_cast<WebKit2CrashLoader*>(static_cast<const WebKit2CrashLoader*>(clientInfo));
+
+ // First load worked, let's crash WebProcess.
+ if (!testHelper->firstSuccessfulLoad) {
+ testHelper->firstSuccessfulLoad = true;
+ return;
+ }
+
+ // Second load worked, we are done.
+ EXPECT_TRUE(testHelper->firstSuccessfulLoad);
+ if (!testHelper->secondSuccessfulLoad) {
+ testHelper->secondSuccessfulLoad = true;
+ return;
+ }
+}
+
+// This test will load a blank page and next kill WebProcess, the expected
+// result is that a call to page load should spawn a new WebProcess.
+TEST(WebKit2, LoadPageAfterCrash)
+{
+ WebKit2CrashLoader helper;
+ helper.loadUrl();
+ Util::run(&helper.firstSuccessfulLoad);
+ helper.terminateWebProcess();
+ helper.loadUrl();
+ Util::run(&helper.secondSuccessfulLoad);
+}
+
+} // namespace TestWebKitAPI
Modified: releases/WebKitGTK/webkit-2.0/Tools/TestWebKitAPI/Tests/WebKit2/MouseMoveAfterCrash.cpp (151366 => 151367)
--- releases/WebKitGTK/webkit-2.0/Tools/TestWebKitAPI/Tests/WebKit2/MouseMoveAfterCrash.cpp 2013-06-10 08:47:57 UTC (rev 151366)
+++ releases/WebKitGTK/webkit-2.0/Tools/TestWebKitAPI/Tests/WebKit2/MouseMoveAfterCrash.cpp 2013-06-10 09:09:47 UTC (rev 151367)
@@ -37,11 +37,6 @@
didFinishLoad = true;
}
-static void processDidCrash(WKPageRef page, const void*)
-{
- WKPageReload(page);
-}
-
static void setPageLoaderClient(WKPageRef page)
{
WKPageLoaderClient loaderClient;
@@ -49,7 +44,6 @@
loaderClient.version = 0;
loaderClient.clientInfo = 0;
loaderClient.didFinishLoadForFrame = didFinishLoadForFrame;
- loaderClient.processDidCrash = processDidCrash;
WKPageSetPageLoaderClient(page, &loaderClient);
}
@@ -79,11 +73,11 @@
webView.simulateMouseMove(10, 10);
webView.simulateMouseMove(20, 20);
- // After moving the mouse (while the web process was hung on the Pause message), kill the web process. It is restarted in
- // processDidCrash by reloading the page.
+ // After moving the mouse (while the web process was hung on the Pause message), kill the web process. It is restarted by reloading the page.
WKPageTerminate(webView.page());
+ WKPageReload(webView.page());
- // Wait until we load the page a second time (via reloading the page in processDidCrash).
+ // Wait until we load the page a second time.
Util::run(&didFinishLoad);
EXPECT_JS_FALSE(webView.page(), "didMoveMouse()");
Modified: releases/WebKitGTK/webkit-2.0/Tools/TestWebKitAPI/Tests/WebKit2/WebKit2.pro (151366 => 151367)
--- releases/WebKitGTK/webkit-2.0/Tools/TestWebKitAPI/Tests/WebKit2/WebKit2.pro 2013-06-10 08:47:57 UTC (rev 151366)
+++ releases/WebKitGTK/webkit-2.0/Tools/TestWebKitAPI/Tests/WebKit2/WebKit2.pro 2013-06-10 09:09:47 UTC (rev 151367)
@@ -19,6 +19,7 @@
InjectedBundleInitializationUserDataCallbackWins.cpp \
LoadAlternateHTMLStringWithNonDirectoryURL.cpp \
LoadCanceledNoServerRedirectCallback.cpp \
+ LoadPageOnCrash.cpp \
MouseMoveAfterCrash.cpp \
PageLoadBasic.cpp \
PageLoadDidChangeLocationWithinPageForFrame.cpp \