WebKit Bugzilla
Attachment 369924 Details for
Bug 197902
: Constant crashes under WebPage::isThrottleable() after r245299
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-197902-20190514223048.patch (text/plain), 8.11 KB, created by
youenn fablet
on 2019-05-14 22:30:49 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2019-05-14 22:30:49 PDT
Size:
8.11 KB
patch
obsolete
>Subversion Revision: 245178 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 3ff0d207f34fff1a9a92395c5cc3a69119e15b9d..0ed1fd51bb09c415706b72c484d7f80edfaee2d6 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,21 @@ >+2019-05-14 Youenn Fablet <youenn@apple.com> >+ >+ Constant crashes under WebPage::isThrottleable() after r245299 >+ https://bugs.webkit.org/show_bug.cgi?id=197902 >+ <rdar://problem/50793796> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Update throttle state after a run loop iteration when page state changes to make sure the pageMap does not have null pages. >+ Add appNapEnabled preference that is used by added API test. >+ >+ * WebProcess/WebPage/WebPage.cpp: >+ (WebKit::WebPage::updateThrottleState): >+ * UIProcess/API/Cocoa/WKPreferences.mm: >+ (-[WKPreferences _setAppNapEnabled:]): >+ (-[WKPreferences _appNapEnabled]): >+ * UIProcess/API/Cocoa/WKPreferencesPrivate.h: >+ > 2019-05-14 Youenn Fablet <youenn@apple.com> > > getUserMedia sandbox extensions should not be revoked when a getUserMedia allowed request is being processed >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm b/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm >index c3befce190f9a985aa10f716f56c3bb5dff9a582..65384ec1d046e403e0693821dd8e83b1960404f8 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm >@@ -1265,6 +1265,16 @@ - (BOOL)_aggressiveTileRetentionEnabled > return _preferences->aggressiveTileRetentionEnabled(); > } > >+- (void)_setAppNapEnabled:(BOOL)enabled >+{ >+ _preferences->setPageVisibilityBasedProcessSuppressionEnabled(enabled); >+} >+ >+- (BOOL)_appNapEnabled >+{ >+ return _preferences->pageVisibilityBasedProcessSuppressionEnabled(); >+} >+ > #endif // PLATFORM(MAC) > > - (BOOL)_javaScriptCanAccessClipboard >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h b/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h >index 5e66516778a4a156d2e092932023dd47d487767a..381f71825900d8fb58e1de298c123957356b2922 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h >@@ -200,6 +200,7 @@ typedef NS_ENUM(NSInteger, _WKEditableLinkBehavior) { > @property (nonatomic, setter=_setWantsBalancedSetDefersLoadingBehavior:) BOOL _wantsBalancedSetDefersLoadingBehavior WK_API_AVAILABLE(macos(10.14)); > @property (nonatomic, setter=_setWebAudioEnabled:) BOOL _webAudioEnabled WK_API_AVAILABLE(macos(10.14)); > @property (nonatomic, setter=_setAggressiveTileRetentionEnabled:) BOOL _aggressiveTileRetentionEnabled WK_API_AVAILABLE(macos(10.14)); >+@property (nonatomic, setter=_setAppNapEnabled:) BOOL _appNapEnabled WK_API_AVAILABLE(macos(WK_MAC_TBA)); > #endif > > @end >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >index fa233289208cd00c9e26b0d38687e6db2e6fc78b..b6ca2bc1e86c6a32a25f65c5f34800da3462c59b 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >@@ -773,10 +773,12 @@ void WebPage::updateThrottleState() > m_userActivity.start(); > > #if ENABLE(SERVICE_WORKER) >- if (auto* connection = ServiceWorkerProvider::singleton().existingServiceWorkerConnectionForSession(sessionID())) { >- if (isThrottleable != connection->isThrottleable()) >- connection->updateThrottleState(); >- } >+ RunLoop::main().dispatch([isThrottleable, sessionID = sessionID()] { >+ if (auto* connection = ServiceWorkerProvider::singleton().existingServiceWorkerConnectionForSession(sessionID)) { >+ if (isThrottleable != connection->isThrottleable()) >+ connection->updateThrottleState(); >+ } >+ }); > #endif > } > >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 13e21371a2a3aa2bc03a420b7b09943275389ea0..1933b944af0fbd9f8980ae63c742304819e48af1 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,13 @@ >+2019-05-14 Youenn Fablet <youenn@apple.com> >+ >+ Constant crashes under WebPage::isThrottleable() after r245299 >+ https://bugs.webkit.org/show_bug.cgi?id=197902 >+ <rdar://problem/50793796> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm: >+ > 2019-05-12 Youenn Fablet <youenn@apple.com> > > Add support for webkit-test-runner options to WPT importer >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm >index 3dd4d7bcc26724a721158b4b5fd3b7faaf79626d..6891bf12c2c1022c98cb3f80e49efadadde25be5 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm >@@ -27,6 +27,8 @@ > > #import "PlatformUtilities.h" > #import "Test.h" >+#import "TestNavigationDelegate.h" >+#import "TestWKWebView.h" > #import <WebKit/WKPreferencesPrivate.h> > #import <WebKit/WKProcessPoolPrivate.h> > #import <WebKit/WKURLSchemeHandler.h> >@@ -52,6 +54,7 @@ struct ResourceInfo { > }; > > static bool done; >+static bool didFinishNavigation; > > static String expectedMessage; > static String retrievedString; >@@ -1619,6 +1622,70 @@ TEST(ServiceWorkers, ProcessPerSite) > EXPECT_EQ(0U, processPool._serviceWorkerProcessCount); > } > >+TEST(ServiceWorkers, ThrottleCrash) >+{ >+ ASSERT(mainBytes); >+ ASSERT(scriptBytes); >+ >+ [WKWebsiteDataStore _allowWebsiteDataRecordsForAllOrigins]; >+ >+ // Start with a clean slate data store >+ [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] modifiedSince:[NSDate distantPast] completionHandler:^() { >+ done = true; >+ }]; >+ TestWebKitAPI::Util::run(&done); >+ done = false; >+ >+ auto messageHandler = adoptNS([[SWMessageHandler alloc] init]); >+ >+ auto handler = adoptNS([[SWSchemes alloc] init]); >+ handler->resources.set("sw1://host/main.html", ResourceInfo { @"text/html", mainBytes }); >+ handler->resources.set("sw1://host/sw.js", ResourceInfo { @"application/javascript", scriptBytes }); >+ >+ auto navigationDelegate = adoptNS([[TestNavigationDelegate alloc] init]); >+ [navigationDelegate setDidFinishNavigation:^(WKWebView *, WKNavigation *) { >+ didFinishNavigation = true; >+ }]; >+ >+ auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]); >+#if PLATFORM(MAC) >+ [[configuration preferences] _setAppNapEnabled:YES]; >+#endif >+ [[configuration userContentController] addScriptMessageHandler:messageHandler.get() name:@"sw"]; >+ [configuration setURLSchemeHandler:handler.get() forURLScheme:@"sw1"]; >+ >+ auto *processPool = configuration.get().processPool; >+ [processPool _registerURLSchemeServiceWorkersCanHandle:@"sw1"]; >+ >+ auto webView1 = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get() addToWindow: YES]); >+ [webView1.get().window resignKeyWindow]; >+ [webView1.get().window orderOut:nil]; >+ >+ auto *request1 = [NSURLRequest requestWithURL:[NSURL URLWithString:@"sw1://host/main.html"]]; >+ [webView1 setNavigationDelegate:navigationDelegate.get()]; >+ [webView1 loadRequest:request1]; >+ >+ didFinishNavigation = false; >+ TestWebKitAPI::Util::run(&didFinishNavigation); >+ >+ auto webView2Configuration = adoptNS([[WKWebViewConfiguration alloc] init]); >+#if PLATFORM(MAC) >+ [[webView2Configuration preferences] _setAppNapEnabled:NO]; >+#endif >+ [webView2Configuration setProcessPool:processPool]; >+ [[webView2Configuration userContentController] addScriptMessageHandler:messageHandler.get() name:@"sw"]; >+ [webView2Configuration setURLSchemeHandler:handler.get() forURLScheme:@"sw1"]; >+ webView2Configuration.get()._relatedWebView = webView1.get(); >+ >+ auto webView2 = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webView2Configuration.get()]); >+ [webView2 setNavigationDelegate:navigationDelegate.get()]; >+ >+ [webView2 loadRequest:request1]; >+ >+ didFinishNavigation = false; >+ TestWebKitAPI::Util::run(&didFinishNavigation); >+} >+ > TEST(ServiceWorkers, LoadData) > { > ASSERT(mainBytes);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 197902
:
369924
|
369951
|
369956