Title: [149573] trunk
Revision
149573
Author
[email protected]
Date
2013-05-04 19:32:24 -0700 (Sat, 04 May 2013)

Log Message

REGRESSION(r148312): Crash when calling WKPageClose(page) followed by WKPageTerminate(page)
<rdar://problem/13702008>
https://bugs.webkit.org/show_bug.cgi?id=115607

Reviewed by Benjamin Poulain.

Source/WebKit2: 

API Test: WebKit2.CloseThenTerminate

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::resetStateAfterProcessExited):
Don't try to reset the state if the page is closed, it won't work and its not worth it.

Tools: 

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2/CloseThenTerminate.cpp: Added.
(TestWebKitAPI::didFinishLoadForFrame):
(TestWebKitAPI::TEST):
Add test that calls WKPageClose, follow by WKPageTerminate. If it crashes, its not working.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (149572 => 149573)


--- trunk/Source/WebKit2/ChangeLog	2013-05-05 01:53:46 UTC (rev 149572)
+++ trunk/Source/WebKit2/ChangeLog	2013-05-05 02:32:24 UTC (rev 149573)
@@ -1,3 +1,17 @@
+2013-05-04  Sam Weinig  <[email protected]>
+
+        REGRESSION(r148312): Crash when calling WKPageClose(page) followed by WKPageTerminate(page)
+        <rdar://problem/13702008>
+        https://bugs.webkit.org/show_bug.cgi?id=115607
+
+        Reviewed by Benjamin Poulain.
+
+        API Test: WebKit2.CloseThenTerminate
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::resetStateAfterProcessExited):
+        Don't try to reset the state if the page is closed, it won't work and its not worth it.
+
 2013-05-04  Beth Dakin  <[email protected]>
 
         https://bugs.webkit.org/show_bug.cgi?id=115574

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (149572 => 149573)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2013-05-05 01:53:46 UTC (rev 149572)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2013-05-05 02:32:24 UTC (rev 149573)
@@ -3854,6 +3854,9 @@
 
 void WebPageProxy::resetStateAfterProcessExited()
 {
+    if (!isValid())
+        return;
+
     ASSERT(m_pageClient);
     m_process->removeMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_pageID);
 

Modified: trunk/Tools/ChangeLog (149572 => 149573)


--- trunk/Tools/ChangeLog	2013-05-05 01:53:46 UTC (rev 149572)
+++ trunk/Tools/ChangeLog	2013-05-05 02:32:24 UTC (rev 149573)
@@ -1,3 +1,17 @@
+2013-05-04  Sam Weinig  <[email protected]>
+
+        REGRESSION(r148312): Crash when calling WKPageClose(page) followed by WKPageTerminate(page)
+        <rdar://problem/13702008>
+        https://bugs.webkit.org/show_bug.cgi?id=115607
+
+        Reviewed by Benjamin Poulain.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebKit2/CloseThenTerminate.cpp: Added.
+        (TestWebKitAPI::didFinishLoadForFrame):
+        (TestWebKitAPI::TEST):
+        Add test that calls WKPageClose, follow by WKPageTerminate. If it crashes, its not working.
+
 2013-05-04  Zan Dobersek  <[email protected]>
 
         Unreviewed.

Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (149572 => 149573)


--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2013-05-05 01:53:46 UTC (rev 149572)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj	2013-05-05 02:32:24 UTC (rev 149573)
@@ -91,6 +91,7 @@
 		76E182DA1547550100F1FADD /* WillSendSubmitEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76E182D91547550100F1FADD /* WillSendSubmitEvent.cpp */; };
 		76E182DD1547569100F1FADD /* WillSendSubmitEvent_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76E182DC1547569100F1FADD /* WillSendSubmitEvent_Bundle.cpp */; };
 		76E182DF154767E600F1FADD /* auto-submitting-form.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 76E182DE15475A8300F1FADD /* auto-submitting-form.html */; };
+		7C8DDAAB1735DEEE00EA5AC0 /* CloseThenTerminate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C8DDAA91735DE1D00EA5AC0 /* CloseThenTerminate.cpp */; };
 		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 */; };
@@ -365,6 +366,7 @@
 		76E182D91547550100F1FADD /* WillSendSubmitEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WillSendSubmitEvent.cpp; sourceTree = "<group>"; };
 		76E182DC1547569100F1FADD /* WillSendSubmitEvent_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WillSendSubmitEvent_Bundle.cpp; sourceTree = "<group>"; };
 		76E182DE15475A8300F1FADD /* auto-submitting-form.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "auto-submitting-form.html"; sourceTree = "<group>"; };
+		7C8DDAA91735DE1D00EA5AC0 /* CloseThenTerminate.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CloseThenTerminate.cpp; sourceTree = "<group>"; };
 		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>"; };
@@ -643,6 +645,7 @@
 				C0C5D3BB14598B6F00A802A6 /* mac */,
 				BC90977B125571AE00083756 /* Resources */,
 				BC246D8C132F115A00B56D7C /* AboutBlankLoad.cpp */,
+				7C8DDAA91735DE1D00EA5AC0 /* CloseThenTerminate.cpp */,
 				BC246D98132F1FE100B56D7C /* CanHandleRequest.cpp */,
 				BC246D97132F1FE100B56D7C /* CanHandleRequest_Bundle.cpp */,
 				F6F3F29013342FEB00A6BF19 /* CookieManager.cpp */,
@@ -1094,6 +1097,7 @@
 				14F3B11315E45EAB00210069 /* SaturatedArithmeticOperations.cpp in Sources */,
 				261516D615B0E60500A2C201 /* SetAndUpdateCacheModel.mm in Sources */,
 				52B8CF9615868CF000281053 /* SetDocumentURI.mm in Sources */,
+				7C8DDAAB1735DEEE00EA5AC0 /* CloseThenTerminate.cpp in Sources */,
 				51FCF79A1534AC6D00104491 /* ShouldGoToBackForwardListItem.cpp in Sources */,
 				C540F776152E4DA000A40C8C /* SimplifyMarkup.mm in Sources */,
 				C02B77F2126612140026BF0F /* SpacebarScrolling.cpp in Sources */,

Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2/CloseThenTerminate.cpp (0 => 149573)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/CloseThenTerminate.cpp	                        (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/CloseThenTerminate.cpp	2013-05-05 02:32:24 UTC (rev 149573)
@@ -0,0 +1,61 @@
+/*
+ * 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"
+
+namespace TestWebKitAPI {
+    
+static bool loaded;
+
+static void didFinishLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void* clientInfo)
+{
+    loaded = true;
+}
+
+// Test for https://webkit.org/b/115607
+// This tests that we don't crash when calling WKPageClose and WKPageTerminate.
+
+TEST(WebKit2, CloseThenTerminate)
+{
+    WKRetainPtr<WKContextRef> context = adoptWK(WKContextCreate());
+    PlatformWebView webView(context.get());
+
+    WKPageLoaderClient loaderClient;
+    memset(&loaderClient, 0 , sizeof(loaderClient));
+    loaderClient.didFinishLoadForFrame = didFinishLoadForFrame;
+    WKPageSetPageLoaderClient(webView.page(), &loaderClient);
+
+    WKRetainPtr<WKURLRef> url(AdoptWK, Util::createURLForResource("simple", "html"));
+    WKPageLoadURL(webView.page(), url.get());
+
+    Util::run(&loaded);
+
+    WKPageClose(webView.page());
+    WKPageTerminate(webView.page());
+}
+
+} // namespace TestWebKitAPI
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to