Changeset 245327 in webkit
- Timestamp:
- May 15, 2019 9:35:58 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r245322 r245327 1 2019-05-15 Youenn Fablet <youenn@apple.com> 2 3 Constant crashes under WebPage::isThrottleable() after r245299 4 https://bugs.webkit.org/show_bug.cgi?id=197902 5 <rdar://problem/50793796> 6 7 Reviewed by Alex Christensen. 8 9 Update throttle state after a run loop iteration when page state changes to make sure the pageMap does not have null pages. 10 Add appNapEnabled preference that is used by added API test. 11 12 * WebProcess/WebPage/WebPage.cpp: 13 (WebKit::WebPage::updateThrottleState): 14 * UIProcess/API/Cocoa/WKPreferences.mm: 15 (-[WKPreferences _setAppNapEnabled:]): 16 (-[WKPreferences _appNapEnabled]): 17 * UIProcess/API/Cocoa/WKPreferencesPrivate.h: 18 1 19 2019-05-15 Alex Christensen <achristensen@webkit.org> 2 20 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm
r244465 r245327 1266 1266 } 1267 1267 1268 - (void)_setAppNapEnabled:(BOOL)enabled 1269 { 1270 _preferences->setPageVisibilityBasedProcessSuppressionEnabled(enabled); 1271 } 1272 1273 - (BOOL)_appNapEnabled 1274 { 1275 return _preferences->pageVisibilityBasedProcessSuppressionEnabled(); 1276 } 1277 1268 1278 #endif // PLATFORM(MAC) 1269 1279 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h
r245294 r245327 201 201 @property (nonatomic, setter=_setWebAudioEnabled:) BOOL _webAudioEnabled WK_API_AVAILABLE(macos(10.14)); 202 202 @property (nonatomic, setter=_setAggressiveTileRetentionEnabled:) BOOL _aggressiveTileRetentionEnabled WK_API_AVAILABLE(macos(10.14)); 203 @property (nonatomic, setter=_setAppNapEnabled:) BOOL _appNapEnabled WK_API_AVAILABLE(macos(WK_MAC_TBA)); 203 204 #endif 204 205 -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r245299 r245327 777 777 778 778 #if ENABLE(SERVICE_WORKER) 779 if (auto* connection = ServiceWorkerProvider::singleton().existingServiceWorkerConnectionForSession(sessionID())) { 780 if (isThrottleable != connection->isThrottleable()) 781 connection->updateThrottleState(); 782 } 779 RunLoop::main().dispatch([isThrottleable, sessionID = sessionID()] { 780 if (auto* connection = ServiceWorkerProvider::singleton().existingServiceWorkerConnectionForSession(sessionID)) { 781 if (isThrottleable != connection->isThrottleable()) 782 connection->updateThrottleState(); 783 } 784 }); 783 785 #endif 784 786 } -
trunk/Tools/ChangeLog
r245324 r245327 1 2019-05-15 Youenn Fablet <youenn@apple.com> 2 3 Constant crashes under WebPage::isThrottleable() after r245299 4 https://bugs.webkit.org/show_bug.cgi?id=197902 5 <rdar://problem/50793796> 6 7 Reviewed by Alex Christensen. 8 9 * TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm: 10 1 11 2019-05-15 Philippe Normand <pnormand@igalia.com> 2 12 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm
r245200 r245327 28 28 #import "PlatformUtilities.h" 29 29 #import "Test.h" 30 #import "TestNavigationDelegate.h" 31 #import "TestWKWebView.h" 30 32 #import <WebKit/WKPreferencesPrivate.h> 31 33 #import <WebKit/WKProcessPoolPrivate.h> … … 53 55 54 56 static bool done; 57 static bool didFinishNavigation; 55 58 56 59 static String expectedMessage; … … 1620 1623 } 1621 1624 1625 TEST(ServiceWorkers, ThrottleCrash) 1626 { 1627 ASSERT(mainBytes); 1628 ASSERT(scriptBytes); 1629 1630 [WKWebsiteDataStore _allowWebsiteDataRecordsForAllOrigins]; 1631 1632 // Start with a clean slate data store 1633 [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] modifiedSince:[NSDate distantPast] completionHandler:^() { 1634 done = true; 1635 }]; 1636 TestWebKitAPI::Util::run(&done); 1637 done = false; 1638 1639 auto messageHandler = adoptNS([[SWMessageHandler alloc] init]); 1640 1641 auto handler = adoptNS([[SWSchemes alloc] init]); 1642 handler->resources.set("sw1://host/main.html", ResourceInfo { @"text/html", mainBytes }); 1643 handler->resources.set("sw1://host/sw.js", ResourceInfo { @"application/javascript", scriptBytes }); 1644 1645 auto navigationDelegate = adoptNS([[TestNavigationDelegate alloc] init]); 1646 [navigationDelegate setDidFinishNavigation:^(WKWebView *, WKNavigation *) { 1647 didFinishNavigation = true; 1648 }]; 1649 1650 auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]); 1651 #if PLATFORM(MAC) 1652 [[configuration preferences] _setAppNapEnabled:YES]; 1653 #endif 1654 [[configuration userContentController] addScriptMessageHandler:messageHandler.get() name:@"sw"]; 1655 [configuration setURLSchemeHandler:handler.get() forURLScheme:@"sw1"]; 1656 1657 auto *processPool = configuration.get().processPool; 1658 [processPool _registerURLSchemeServiceWorkersCanHandle:@"sw1"]; 1659 1660 auto webView1 = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get() addToWindow: YES]); 1661 [webView1 setNavigationDelegate:navigationDelegate.get()]; 1662 1663 // Let's make it so that webView1 be app nappable after loading is completed. 1664 [webView1.get().window resignKeyWindow]; 1665 #if PLATFORM(MAC) 1666 [webView1.get().window orderOut:nil]; 1667 #endif 1668 1669 auto *request1 = [NSURLRequest requestWithURL:[NSURL URLWithString:@"sw1://host/main.html"]]; 1670 [webView1 loadRequest:request1]; 1671 1672 didFinishNavigation = false; 1673 TestWebKitAPI::Util::run(&didFinishNavigation); 1674 1675 auto webView2Configuration = adoptNS([[WKWebViewConfiguration alloc] init]); 1676 #if PLATFORM(MAC) 1677 [[webView2Configuration preferences] _setAppNapEnabled:NO]; 1678 #endif 1679 [webView2Configuration setProcessPool:processPool]; 1680 [[webView2Configuration userContentController] addScriptMessageHandler:messageHandler.get() name:@"sw"]; 1681 [webView2Configuration setURLSchemeHandler:handler.get() forURLScheme:@"sw1"]; 1682 webView2Configuration.get()._relatedWebView = webView1.get(); 1683 1684 auto webView2 = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webView2Configuration.get()]); 1685 [webView2 setNavigationDelegate:navigationDelegate.get()]; 1686 1687 [webView2 loadRequest:request1]; 1688 1689 didFinishNavigation = false; 1690 TestWebKitAPI::Util::run(&didFinishNavigation); 1691 } 1692 1622 1693 TEST(ServiceWorkers, LoadData) 1623 1694 {
Note: See TracChangeset
for help on using the changeset viewer.