Title: [254756] trunk
- Revision
- 254756
- Author
- beid...@apple.com
- Date
- 2020-01-17 12:06:04 -0800 (Fri, 17 Jan 2020)
Log Message
TestWebKitAPI.AsyncFunction.Promise times out on slower machines in debug builds.
<rdar://problem/58445164> and https://bugs.webkit.org/show_bug.cgi?id=206012
Reviewed by Keith Miller.
Source/WebKit:
For existing API test.
* UIProcess/API/Cocoa/WKProcessPool.mm:
(-[WKProcessPool _garbageCollectJavaScriptObjectsForTesting]):
* UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
Tools:
Previously, to force GC, over 30,000 function calls would be made.
This was too slow on slower machines in debug builds. It eventually would've worked given enough time, but...
It turns just a few hundred function calls with an API call to force GC seems reliable and is much faster.
* TestWebKitAPI/Tests/WebKitCocoa/AsyncFunction.mm:
(TestWebKitAPI::TEST):
(TestWebKitAPI::tryGCPromise): Deleted.
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (254755 => 254756)
--- trunk/Source/WebKit/ChangeLog 2020-01-17 18:59:57 UTC (rev 254755)
+++ trunk/Source/WebKit/ChangeLog 2020-01-17 20:06:04 UTC (rev 254756)
@@ -1,3 +1,16 @@
+2020-01-17 Brady Eidson <beid...@apple.com>
+
+ TestWebKitAPI.AsyncFunction.Promise times out on slower machines in debug builds.
+ <rdar://problem/58445164> and https://bugs.webkit.org/show_bug.cgi?id=206012
+
+ Reviewed by Keith Miller.
+
+ For existing API test.
+
+ * UIProcess/API/Cocoa/WKProcessPool.mm:
+ (-[WKProcessPool _garbageCollectJavaScriptObjectsForTesting]):
+ * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
+
2020-01-17 Daniel Bates <daba...@apple.com>
[iOS] Focusing editable element with WebPage::selectPositionAtPoint() does not bring up keyboard
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm (254755 => 254756)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm 2020-01-17 18:59:57 UTC (rev 254755)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm 2020-01-17 20:06:04 UTC (rev 254756)
@@ -673,4 +673,9 @@
#endif
}
+- (void)_garbageCollectJavaScriptObjectsForTesting
+{
+ _processPool->garbageCollectJavaScriptObjects();
+}
+
@end
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h (254755 => 254756)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h 2020-01-17 18:59:57 UTC (rev 254755)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h 2020-01-17 20:06:04 UTC (rev 254756)
@@ -135,5 +135,6 @@
// Test only.
- (void)_seedResourceLoadStatisticsForTestingWithFirstParty:(NSURL *)firstPartyURL thirdParty:(NSURL *)thirdPartyURL shouldScheduleNotification:(BOOL)shouldScheduleNotification completionHandler:(void(^)(void))completionHandler WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+- (void)_garbageCollectJavaScriptObjectsForTesting WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
@end
Modified: trunk/Tools/ChangeLog (254755 => 254756)
--- trunk/Tools/ChangeLog 2020-01-17 18:59:57 UTC (rev 254755)
+++ trunk/Tools/ChangeLog 2020-01-17 20:06:04 UTC (rev 254756)
@@ -1,3 +1,18 @@
+2020-01-17 Brady Eidson <beid...@apple.com>
+
+ TestWebKitAPI.AsyncFunction.Promise times out on slower machines in debug builds.
+ <rdar://problem/58445164> and https://bugs.webkit.org/show_bug.cgi?id=206012
+
+ Reviewed by Keith Miller.
+
+ Previously, to force GC, over 30,000 function calls would be made.
+ This was too slow on slower machines in debug builds. It eventually would've worked given enough time, but...
+ It turns just a few hundred function calls with an API call to force GC seems reliable and is much faster.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/AsyncFunction.mm:
+ (TestWebKitAPI::TEST):
+ (TestWebKitAPI::tryGCPromise): Deleted.
+
2020-01-16 Keith Miller <keith_mil...@apple.com>
Reland bytecode checkpoints since bugs have been fixed
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/AsyncFunction.mm (254755 => 254756)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/AsyncFunction.mm 2020-01-17 18:59:57 UTC (rev 254755)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/AsyncFunction.mm 2020-01-17 20:06:04 UTC (rev 254756)
@@ -28,6 +28,7 @@
#import "PlatformUtilities.h"
#import "Test.h"
#import "TestWKWebView.h"
+#import <WebKit/WKProcessPoolPrivate.h>
#import <WebKit/WKWebViewPrivate.h>
#import <WebKit/_WKContentWorld.h>
@@ -178,22 +179,6 @@
EXPECT_TRUE([value isEqual:result]);
}
-static void tryGCPromise(WKWebView *webView, bool& done)
-{
- if (done)
- return;
-
- NSString *functionBody = @"return new Promise(function(resolve, reject) { })";
- [webView _callAsyncJavaScriptFunction:functionBody withArguments:nil inWorld:_WKContentWorld.pageContentWorld completionHandler:[&] (id result, NSError *error) {
- EXPECT_NULL(result);
- EXPECT_TRUE(error != nil);
- EXPECT_TRUE([[error description] containsString:@"no longer reachable"]);
- done = true;
- }];
-
- dispatch_async(dispatch_get_main_queue(), ^{ tryGCPromise(webView, done); });
-}
-
TEST(AsyncFunction, Promise)
{
auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
@@ -279,8 +264,19 @@
}];
TestWebKitAPI::Util::run(&done);
+ // Promises known to become unreachable (e.g. via garbage collection) should call back with an error.
done = false;
- tryGCPromise(webView.get(), done);
+ functionBody = @"return new Promise(function(resolve, reject) { })";
+ for (int i = 0; i < 500; ++i) {
+ [webView _callAsyncJavaScriptFunction:functionBody withArguments:nil inWorld:_WKContentWorld.pageContentWorld completionHandler:[&] (id result, NSError *error) {
+ EXPECT_NULL(result);
+ EXPECT_TRUE(error != nil);
+ EXPECT_TRUE([[error description] containsString:@"no longer reachable"]);
+ done = true;
+ }];
+ }
+
+ [webView.get().configuration.processPool _garbageCollectJavaScriptObjectsForTesting];
TestWebKitAPI::Util::run(&done);
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes