Changeset 204243 in webkit
- Timestamp:
- Aug 7, 2016 12:08:01 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r204238 r204243 1 2016-08-07 Chris Dumez <cdumez@apple.com> 2 3 Write API test to cover crash fix in r204135 4 https://bugs.webkit.org/show_bug.cgi?id=160587 5 6 Reviewed by Darin Adler. 7 8 * UIProcess/WebPageProxy.cpp: 9 (WebKit::WebPageProxy::terminateProcess): 10 Stop calling resetStateAfterProcessExited() after calling 11 requestTermination() because requestTermination() now calls 12 didClose() which calls processDidCrash() which already calls 13 resetStateAfterProcessExited(). Because the processDidCrash() 14 delegates may start new loads, we really do not want to 15 reset the state again after calling the delegates. 16 17 * UIProcess/WebProcessProxy.cpp: 18 (WebKit::WebProcessProxy::requestTermination): 19 - Call didClose() in WebProcessProxy::requestTermination() so that 20 the processDidCrash() delegates get called in API tests whenever 21 a WebContent process is terminated to simulate a crash. 22 - Stop calling shutDown() and webConnection()->didClose() because 23 didClose() already does this for us. 24 1 25 2016-08-06 Chris Dumez <cdumez@apple.com> 2 26 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r204135 r204243 2354 2354 2355 2355 m_process->requestTermination(); 2356 resetStateAfterProcessExited();2357 2356 } 2358 2357 -
trunk/Source/WebKit2/UIProcess/WebProcessProxy.cpp
r204238 r204243 805 805 ChildProcessProxy::terminate(); 806 806 807 if (webConnection()) 808 webConnection()->didClose(); 809 810 shutDown(); 807 didClose(*connection()); 811 808 } 812 809 -
trunk/Tools/ChangeLog
r204238 r204243 1 2016-08-07 Chris Dumez <cdumez@apple.com> 2 3 Write API test to cover crash fix in r204135 4 https://bugs.webkit.org/show_bug.cgi?id=160587 5 6 Reviewed by Darin Adler. 7 8 Add API test to cover crash fix in r204135. This reproduces the crash 9 by destroying a related WKWebView in the webViewWebContentProcessDidTerminate 10 callback. 11 12 * TestWebKitAPI/Tests/WebKit2Cocoa/Navigation.mm: 13 (-[NavigationDelegate webViewWebContentProcessDidTerminate:]): 14 (TEST): 15 1 16 2016-08-06 Chris Dumez <cdumez@apple.com> 2 17 -
trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/Navigation.mm
r204238 r204243 28 28 #import <WebKit/WKNavigationPrivate.h> 29 29 #import <WebKit/WKNavigationDelegate.h> 30 #import <WebKit/WKProcessPoolPrivate.h> 30 31 #import <WebKit/WKWebView.h> 32 #import <WebKit/WKWebViewConfigurationPrivate.h> 33 #import <WebKit/WKWebViewPrivate.h> 34 #import <WebKit/_WKProcessPoolConfiguration.h> 31 35 #import <wtf/RetainPtr.h> 32 36 #import "PlatformUtilities.h" … … 36 40 37 41 static bool isDone; 42 static std::function<void()> crashHandler; 38 43 static RetainPtr<WKNavigation> currentNavigation; 39 44 … … 59 64 60 65 isDone = true; 66 } 67 68 - (void)webViewWebContentProcessDidTerminate:(WKWebView *)webView 69 { 70 crashHandler(); 61 71 } 62 72 … … 188 198 } 189 199 200 TEST(WKNavigation, WebContentProcessDidTerminate) 201 { 202 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 203 RetainPtr<_WKProcessPoolConfiguration> poolConfiguration = adoptNS([[_WKProcessPoolConfiguration alloc] init]); 204 poolConfiguration.get().maximumProcessCount = 1; 205 RetainPtr<WKProcessPool> processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:poolConfiguration.get()]); 206 207 RetainPtr<WKWebViewConfiguration> configuration1 = adoptNS([[WKWebViewConfiguration alloc] init]); 208 configuration1.get().processPool = processPool.get(); 209 RetainPtr<WKWebView> webView1 = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration1.get()]); 210 211 RetainPtr<NavigationDelegate> delegate1 = adoptNS([[NavigationDelegate alloc] init]); 212 [webView1 setNavigationDelegate:delegate1.get()]; 213 214 NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"data:text/html,1"]]; 215 216 isDone = false; 217 currentNavigation = [webView1 loadRequest:request]; 218 TestWebKitAPI::Util::run(&isDone); 219 220 RetainPtr<WKWebViewConfiguration> configuration2 = adoptNS([[WKWebViewConfiguration alloc] init]); 221 configuration2.get().processPool = processPool.get(); 222 configuration2.get()._relatedWebView = webView1.get(); 223 RetainPtr<WKWebView> webView2 = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration2.get()]); 224 225 RetainPtr<NavigationDelegate> delegate2 = adoptNS([[NavigationDelegate alloc] init]); 226 [webView2 setNavigationDelegate:delegate2.get()]; 227 228 isDone = false; 229 currentNavigation = [webView2 loadRequest:request]; 230 TestWebKitAPI::Util::run(&isDone); 231 232 bool didTerminate = false; 233 crashHandler = [&] { 234 webView1 = nullptr; 235 webView2 = nullptr; 236 [pool drain]; // Make sure the views get deallocated. 237 didTerminate = true; 238 }; 239 240 [webView2 _killWebContentProcessAndResetState]; 241 TestWebKitAPI::Util::run(&didTerminate); 242 } 243 190 244 #endif
Note: See TracChangeset
for help on using the changeset viewer.