Commit 16a649dc authored by andersca@apple.com's avatar andersca@apple.com

Crash when calling WKPageGetProcessIdentifier after aborted process launch

https://bugs.webkit.org/show_bug.cgi?id=119069
<rdar://problem/14494064>

Reviewed by Andreas Kling.

Source/WebKit2:

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::processIdentifier):
Check if the page is closed instead of checking whether we have a process - We'll always have a process.

(WebKit::WebPageProxy::isValid):
Make this const.

* UIProcess/WebPageProxy.h:

Tools:

Add a test.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2/mac/GetPIDAfterAbortedProcessLaunch.cpp: Added.
(TestWebKitAPI::didFinishLoadForFrame):
(TestWebKitAPI::TEST):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153107 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c73808f2
2013-07-24 Anders Carlsson <andersca@apple.com>
Crash when calling WKPageGetProcessIdentifier after aborted process launch
https://bugs.webkit.org/show_bug.cgi?id=119069
<rdar://problem/14494064>
Reviewed by Andreas Kling.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::processIdentifier):
Check if the page is closed instead of checking whether we have a process - We'll always have a process.
(WebKit::WebPageProxy::isValid):
Make this const.
* UIProcess/WebPageProxy.h:
2013-07-24 Kwang Yul Seo <skyul@company100.net> 2013-07-24 Kwang Yul Seo <skyul@company100.net>
[WK2][Soup] Add entry point for network process [WK2][Soup] Add entry point for network process
......
...@@ -375,13 +375,13 @@ WebProcessProxy* WebPageProxy::process() const ...@@ -375,13 +375,13 @@ WebProcessProxy* WebPageProxy::process() const
PlatformProcessIdentifier WebPageProxy::processIdentifier() const PlatformProcessIdentifier WebPageProxy::processIdentifier() const
{ {
if (!m_process) if (!isValid())
return 0; return 0;
return m_process->processIdentifier(); return m_process->processIdentifier();
} }
bool WebPageProxy::isValid() bool WebPageProxy::isValid() const
{ {
// A page that has been explicitly closed is never valid. // A page that has been explicitly closed is never valid.
if (m_isClosed) if (m_isClosed)
......
...@@ -633,7 +633,7 @@ public: ...@@ -633,7 +633,7 @@ public:
WebPageGroup* pageGroup() const { return m_pageGroup.get(); } WebPageGroup* pageGroup() const { return m_pageGroup.get(); }
bool isValid(); bool isValid() const;
PassRefPtr<ImmutableArray> relatedPages() const; PassRefPtr<ImmutableArray> relatedPages() const;
......
2013-07-24 Anders Carlsson <andersca@apple.com>
Crash when calling WKPageGetProcessIdentifier after aborted process launch
https://bugs.webkit.org/show_bug.cgi?id=119069
<rdar://problem/14494064>
Reviewed by Andreas Kling.
Add a test.
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2/mac/GetPIDAfterAbortedProcessLaunch.cpp: Added.
(TestWebKitAPI::didFinishLoadForFrame):
(TestWebKitAPI::TEST):
2013-07-24 Zan Dobersek <zdobersek@igalia.com> 2013-07-24 Zan Dobersek <zdobersek@igalia.com>
Make KURL::hasPath private Make KURL::hasPath private
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
1ADBEFE3130C6AA100D61D19 /* simple-accelerated-compositing.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1ADBEFBC130C6A0100D61D19 /* simple-accelerated-compositing.html */; }; 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 */; }; 1AE72F48173EB214006362F0 /* TerminateTwice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE72F47173EB214006362F0 /* TerminateTwice.cpp */; };
1AEDE22613E5E7E700E62FE8 /* InjectedBundleControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AEDE22413E5E7A000E62FE8 /* InjectedBundleControllerMac.mm */; }; 1AEDE22613E5E7E700E62FE8 /* InjectedBundleControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AEDE22413E5E7A000E62FE8 /* InjectedBundleControllerMac.mm */; };
1AEF994917A09F5400998EF0 /* GetPIDAfterAbortedProcessLaunch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AEF994817A09F5300998EF0 /* GetPIDAfterAbortedProcessLaunch.cpp */; };
261516D615B0E60500A2C201 /* SetAndUpdateCacheModel.mm in Sources */ = {isa = PBXBuildFile; fileRef = 261516D515B0E60500A2C201 /* SetAndUpdateCacheModel.mm */; }; 261516D615B0E60500A2C201 /* SetAndUpdateCacheModel.mm in Sources */ = {isa = PBXBuildFile; fileRef = 261516D515B0E60500A2C201 /* SetAndUpdateCacheModel.mm */; };
26300B1816755CD90066886D /* ListHashSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26300B1716755CD90066886D /* ListHashSet.cpp */; }; 26300B1816755CD90066886D /* ListHashSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26300B1716755CD90066886D /* ListHashSet.cpp */; };
265AF55015D1E48A00B0CB4A /* WTFString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 265AF54F15D1E48A00B0CB4A /* WTFString.cpp */; }; 265AF55015D1E48A00B0CB4A /* WTFString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 265AF54F15D1E48A00B0CB4A /* WTFString.cpp */; };
...@@ -324,6 +325,7 @@ ...@@ -324,6 +325,7 @@
1ADBEFBC130C6A0100D61D19 /* simple-accelerated-compositing.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "simple-accelerated-compositing.html"; 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>"; }; 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>"; }; 1AEDE22413E5E7A000E62FE8 /* InjectedBundleControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = InjectedBundleControllerMac.mm; sourceTree = "<group>"; };
1AEF994817A09F5300998EF0 /* GetPIDAfterAbortedProcessLaunch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GetPIDAfterAbortedProcessLaunch.cpp; sourceTree = "<group>"; };
261516D515B0E60500A2C201 /* SetAndUpdateCacheModel.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SetAndUpdateCacheModel.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>"; }; 26300B1716755CD90066886D /* ListHashSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ListHashSet.cpp; path = WTF/ListHashSet.cpp; sourceTree = "<group>"; };
265AF54F15D1E48A00B0CB4A /* WTFString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WTFString.cpp; path = WTF/WTFString.cpp; sourceTree = "<group>"; }; 265AF54F15D1E48A00B0CB4A /* WTFString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WTFString.cpp; path = WTF/WTFString.cpp; sourceTree = "<group>"; };
...@@ -979,6 +981,7 @@ ...@@ -979,6 +981,7 @@
BCAA485714A044D40088FAC4 /* EditorCommands.mm */, BCAA485714A044D40088FAC4 /* EditorCommands.mm */,
C0C5D3BC14598B6F00A802A6 /* GetBackingScaleFactor.mm */, C0C5D3BC14598B6F00A802A6 /* GetBackingScaleFactor.mm */,
C0C5D3BD14598B6F00A802A6 /* GetBackingScaleFactor_Bundle.mm */, C0C5D3BD14598B6F00A802A6 /* GetBackingScaleFactor_Bundle.mm */,
1AEF994817A09F5300998EF0 /* GetPIDAfterAbortedProcessLaunch.cpp */,
); );
path = mac; path = mac;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -1166,6 +1169,7 @@ ...@@ -1166,6 +1169,7 @@
3722C8691461E03E00C45D00 /* RenderedImageFromDOMRange.mm in Sources */, 3722C8691461E03E00C45D00 /* RenderedImageFromDOMRange.mm in Sources */,
C0BD669D131D3CF700E18F2A /* ResponsivenessTimerDoesntFireEarly.cpp in Sources */, C0BD669D131D3CF700E18F2A /* ResponsivenessTimerDoesntFireEarly.cpp in Sources */,
C0ADBE8312FCA6AA00D2C129 /* RestoreSessionStateContainingFormData.cpp in Sources */, C0ADBE8312FCA6AA00D2C129 /* RestoreSessionStateContainingFormData.cpp in Sources */,
1AEF994917A09F5400998EF0 /* GetPIDAfterAbortedProcessLaunch.cpp in Sources */,
BC029B181486AD6400817DA9 /* RetainPtr.cpp in Sources */, BC029B181486AD6400817DA9 /* RetainPtr.cpp in Sources */,
BC029B1C1486B25900817DA9 /* RetainPtr.mm in Sources */, BC029B1C1486B25900817DA9 /* RetainPtr.mm in Sources */,
C0991C51143C7D68007998F2 /* RetainPtrHashing.cpp in Sources */, C0991C51143C7D68007998F2 /* RetainPtrHashing.cpp in Sources */,
......
/*
* Copyright (C) 2013 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"
#include <WebKit2/WKPagePrivateMac.h>
#include <WebKit2/WKContextPrivate.h>
namespace TestWebKitAPI {
static bool loaded;
static void didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo)
{
loaded = true;
}
TEST(WebKit2, GetPIDAfterAbortedProcessLaunch)
{
WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
WKContextSetUsesNetworkProcess(context.get(), true);
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());
WKPageClose(webView.page());
// And now we try to get the PID page when the page has been closed before the process launch was complete.
EXPECT_EQ(0, WKPageGetProcessIdentifier(webView.page()));
}
} // namespace TestWebKitAPI
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment