Diff
Modified: trunk/Source/WebKit2/ChangeLog (149932 => 149933)
--- trunk/Source/WebKit2/ChangeLog 2013-05-11 16:09:43 UTC (rev 149932)
+++ trunk/Source/WebKit2/ChangeLog 2013-05-11 18:00:40 UTC (rev 149933)
@@ -1,3 +1,26 @@
+2013-05-11 Anders Carlsson <[email protected]>
+
+ Crash when terminating a process that has not been fully launched
+ https://bugs.webkit.org/show_bug.cgi?id=115962
+ <rdar://problem/13660916>
+
+ Reviewed by Andreas Kling.
+
+ Handle terminating a process that has not been fully launched.
+
+ * UIProcess/Launcher/ProcessLauncher.cpp:
+ (WebKit::ProcessLauncher::didFinishLaunchingProcess):
+ If we have been invalidated, dispose the connection identifier.
+
+ * UIProcess/Launcher/mac/ProcessLauncherMac.mm:
+ (WebKit::ProcessLauncher::terminateProcess):
+ If we're still launching the process, invalidate so the client won't get an unexpected
+ didFinishLaunching callback.
+
+ * UIProcess/WebProcessProxy.cpp:
+ (WebKit::WebProcessProxy::requestTermination):
+ Check if webConnection() is null before calling it. (It will be null if the process isn't fully launched).
+
2013-05-10 Brian J. Burg <[email protected]>
Web Inspector: Implement WK2 version of WebInspectorFrontendClient::save
Modified: trunk/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp (149932 => 149933)
--- trunk/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp 2013-05-11 16:09:43 UTC (rev 149932)
+++ trunk/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp 2013-05-11 18:00:40 UTC (rev 149933)
@@ -53,7 +53,18 @@
m_isLaunching = false;
if (!m_client) {
- // FIXME: Dispose of the connection identifier.
+ // FIXME: Make Identifier a move-only object and release port rights/connections in the destructor.
+#if PLATFORM(MAC)
+ if (identifier.port)
+ mach_port_mod_refs(mach_task_self(), identifier.port, MACH_PORT_RIGHT_RECEIVE, -1);
+
+#if HAVE(XPC)
+ if (identifier.xpcConnection) {
+ xpc_release(identifier.xpcConnection);
+ identifier.xpcConnection = 0;
+ }
+#endif
+#endif
return;
}
Modified: trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm (149932 => 149933)
--- trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm 2013-05-11 16:09:43 UTC (rev 149932)
+++ trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm 2013-05-11 18:00:40 UTC (rev 149933)
@@ -525,11 +525,17 @@
}
void ProcessLauncher::terminateProcess()
-{
+{
+ if (m_isLaunching) {
+ invalidate();
+ return;
+ }
+
if (!m_processIdentifier)
return;
kill(m_processIdentifier, SIGKILL);
+ m_processIdentifier = 0;
}
void ProcessLauncher::platformInvalidate()
Modified: trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp (149932 => 149933)
--- trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp 2013-05-11 16:09:43 UTC (rev 149932)
+++ trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp 2013-05-11 18:00:40 UTC (rev 149933)
@@ -628,7 +628,10 @@
void WebProcessProxy::requestTermination()
{
ChildProcessProxy::terminate();
- webConnection()->didClose();
+
+ if (webConnection())
+ webConnection()->didClose();
+
disconnect();
}
Modified: trunk/Tools/ChangeLog (149932 => 149933)
--- trunk/Tools/ChangeLog 2013-05-11 16:09:43 UTC (rev 149932)
+++ trunk/Tools/ChangeLog 2013-05-11 18:00:40 UTC (rev 149933)
@@ -1,3 +1,22 @@
+2013-05-11 Anders Carlsson <[email protected]>
+
+ Crash when terminating a process that has not been fully launched
+ https://bugs.webkit.org/show_bug.cgi?id=115962
+ <rdar://problem/13660916>
+
+ Reviewed by Andreas Kling.
+
+ Add TerminateTwice, a test that terminates a page, then reloads it and terminates it again
+ before the process has had a chance to be fully launched.
+
+ * TestWebKitAPI/GNUmakefile.am:
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit2/TerminateTwice.cpp: Added.
+ (TestWebKitAPI):
+ (TestWebKitAPI::didFinishLoadForFrame):
+ (TestWebKitAPI::TEST):
+ * TestWebKitAPI/Tests/WebKit2/WebKit2.pro:
+
2013-05-10 Laszlo Gombos <[email protected]>
Remove Mac OS X Leopard (10.5) support
Modified: trunk/Tools/TestWebKitAPI/GNUmakefile.am (149932 => 149933)
--- trunk/Tools/TestWebKitAPI/GNUmakefile.am 2013-05-11 16:09:43 UTC (rev 149932)
+++ trunk/Tools/TestWebKitAPI/GNUmakefile.am 2013-05-11 18:00:40 UTC (rev 149933)
@@ -286,6 +286,7 @@
Tools/TestWebKitAPI/Tests/WebKit2/RestoreSessionStateContainingFormData.cpp \
Tools/TestWebKitAPI/Tests/WebKit2/ShouldGoToBackForwardListItem.cpp \
Tools/TestWebKitAPI/Tests/WebKit2/SpacebarScrolling.cpp \
+ Tools/TestWebKitAPI/Tests/WebKit2/TerminateTwice.cpp \
Tools/TestWebKitAPI/Tests/WebKit2/UserMessage.cpp \
Tools/TestWebKitAPI/Tests/WebKit2/WillSendSubmitEvent.cpp \
Tools/TestWebKitAPI/Tests/WebKit2/WKConnection.cpp \
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (149932 => 149933)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2013-05-11 16:09:43 UTC (rev 149932)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2013-05-11 18:00:40 UTC (rev 149933)
@@ -24,6 +24,7 @@
1AA9E55914980A9900001A8A /* Functional.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AA9E55714980A9900001A8A /* Functional.cpp */; };
1ADBEFAE130C689C00D61D19 /* ForceRepaint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1ADBEFAD130C689C00D61D19 /* ForceRepaint.cpp */; };
1ADBEFE3130C6AA100D61D19 /* simple-accelerated-compositing.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1ADBEFBC130C6A0100D61D19 /* simple-accelerated-compositing.html */; };
+ 1AE72F48173EB214006362F0 /* TerminateTwice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE72F47173EB214006362F0 /* TerminateTwice.cpp */; };
1AEDE22613E5E7E700E62FE8 /* InjectedBundleControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AEDE22413E5E7A000E62FE8 /* InjectedBundleControllerMac.mm */; };
261516D615B0E60500A2C201 /* SetAndUpdateCacheModel.mm in Sources */ = {isa = PBXBuildFile; fileRef = 261516D515B0E60500A2C201 /* SetAndUpdateCacheModel.mm */; };
26300B1816755CD90066886D /* ListHashSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26300B1716755CD90066886D /* ListHashSet.cpp */; };
@@ -301,6 +302,7 @@
1AA9E55714980A9900001A8A /* Functional.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Functional.cpp; path = WTF/Functional.cpp; sourceTree = "<group>"; };
1ADBEFAD130C689C00D61D19 /* ForceRepaint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ForceRepaint.cpp; sourceTree = "<group>"; };
1ADBEFBC130C6A0100D61D19 /* simple-accelerated-compositing.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "simple-accelerated-compositing.html"; sourceTree = "<group>"; };
+ 1AE72F47173EB214006362F0 /* TerminateTwice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TerminateTwice.cpp; sourceTree = "<group>"; };
1AEDE22413E5E7A000E62FE8 /* InjectedBundleControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = InjectedBundleControllerMac.mm; sourceTree = "<group>"; };
261516D515B0E60500A2C201 /* SetAndUpdateCacheModel.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SetAndUpdateCacheModel.mm; sourceTree = "<group>"; };
26300B1716755CD90066886D /* ListHashSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ListHashSet.cpp; path = WTF/ListHashSet.cpp; sourceTree = "<group>"; };
@@ -715,6 +717,7 @@
51FCF7981534AC6D00104491 /* ShouldGoToBackForwardListItem.cpp */,
51FCF7971534AC6D00104491 /* ShouldGoToBackForwardListItem_Bundle.cpp */,
C02B77F1126612140026BF0F /* SpacebarScrolling.cpp */,
+ 1AE72F47173EB214006362F0 /* TerminateTwice.cpp */,
BC22D31314DC689800FFB1DD /* UserMessage.cpp */,
BC22D31714DC68B800FFB1DD /* UserMessage_Bundle.cpp */,
520BCF4B141EB09E00937EA8 /* WebArchive.cpp */,
@@ -1025,6 +1028,7 @@
26F1B44415CA434F00D1E4BF /* AtomicString.cpp in Sources */,
B55F11A01516834F00915916 /* AttributedString.mm in Sources */,
00CD9F6315BE312C002DA2CE /* BackForwardList.mm in Sources */,
+ 1AE72F48173EB214006362F0 /* TerminateTwice.cpp in Sources */,
26DF5A5E15A29BAA003689C2 /* CancelLoadFromResourceLoadDelegate.mm in Sources */,
BC246D9A132F1FE100B56D7C /* CanHandleRequest.cpp in Sources */,
A7A966DB140ECCC8005EF9B4 /* CheckedArithmeticOperations.cpp in Sources */,
Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2/TerminateTwice.cpp (0 => 149933)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/TerminateTwice.cpp (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/TerminateTwice.cpp 2013-05-11 18:00:40 UTC (rev 149933)
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2011 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 "config.h"
+#include "PlatformUtilities.h"
+#include "PlatformWebView.h"
+
+namespace TestWebKitAPI {
+
+static bool loaded;
+
+static void didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo)
+{
+ loaded = true;
+}
+
+TEST(WebKit2, TerminateTwice)
+{
+ WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
+ PlatformWebView webView(context.get());
+
+ WKPageLoaderClient loaderClient;
+ memset(&loaderClient, 0, sizeof(loaderClient));
+
+ loaderClient.version = 0;
+ loaderClient.didFinishLoadForFrame = didFinishLoadForFrame;
+ WKPageSetPageLoaderClient(webView.page(), &loaderClient);
+
+ WKRetainPtr<WKURLRef> url(AdoptWK, Util::createURLForResource("simple", "html"));
+ WKPageLoadURL(webView.page(), url.get());
+
+ Util::run(&loaded);
+ WKPageTerminate(webView.page());
+
+ // Reloading will start relaunching the process.
+ WKPageReload(webView.page());
+
+ // And now we terminate the page before the process launch is complete.
+ WKPageTerminate(webView.page());
+}
+
+} // namespace TestWebKitAPI
+
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2/WebKit2.pro (149932 => 149933)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/WebKit2.pro 2013-05-11 16:09:43 UTC (rev 149932)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/WebKit2.pro 2013-05-11 18:00:40 UTC (rev 149933)
@@ -30,6 +30,7 @@
ReloadPageAfterCrash.cpp \
ResizeWindowAfterCrash.cpp \
ResponsivenessTimerDoesntFireEarly.cpp \
+ TerminateTwice.cpp \
UserMessage.cpp \
WillSendSubmitEvent.cpp \
WKConnection.cpp \