WebKit Bugzilla
Attachment 370954 Details for
Bug 198359
: [iOS] Third-party extensions using WKWebView are unable to render anything
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-198359-20190530104631.patch (text/plain), 5.66 KB, created by
Chris Dumez
on 2019-05-30 10:46:32 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Chris Dumez
Created:
2019-05-30 10:46:32 PDT
Size:
5.66 KB
patch
obsolete
>Subversion Revision: 245892 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 9eb299bb2e40cc78cf028df7a14269553885b317..c3933a2eec3a7997d2286accdff3b54a8683fb67 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,27 @@ >+2019-05-30 Chris Dumez <cdumez@apple.com> >+ >+ [iOS] Third-party extensions using WKWebView are unable to render anything >+ https://bugs.webkit.org/show_bug.cgi?id=198359 >+ <rdar://problem/51105015> >+ >+ Reviewed by Brent Fulgham and Geoff Garen. >+ >+ Third-party extensions using WKWebView are unable to render anything because we do not get notified >+ when the extension's visibility changes. Because we do not recognize the extension showing the >+ WebView to be foreground, we do not take a process assertion on behalf of the child processes and >+ they get suspended before they get a chance to render anything. >+ >+ The root of the issue is that WebKit was relying on BKSApplicationStateMonitor.handler to get >+ notified when the extension's state switches between foreground and background. However, the handler >+ never gets called unless the extension has an appropriate entitlement. >+ >+ To address the issue, we now use the same logic for extensions and we do for view services. >+ I have verified that the _UIViewServiceHostDidEnterBackgroundNotification / _UIViewServiceHostWillEnterForegroundNotification >+ notifications get sent to the extensions (even third-party). We also properly detect MobileSafari as >+ host application and are able to get MobileSafari's foreground state accurately. >+ >+ * UIProcess/ApplicationStateTracker.mm: >+ > 2019-05-30 Truitt Savell <tsavell@apple.com> > > Unreviewed, rolling out r245881. >diff --git a/Source/WebKit/UIProcess/ApplicationStateTracker.mm b/Source/WebKit/UIProcess/ApplicationStateTracker.mm >index a23d4bf8bf14ecd7c25e0345a27f06439e5ecfde..507922faaf880b5ba2aecaad827fe911208d29f4 100644 >--- a/Source/WebKit/UIProcess/ApplicationStateTracker.mm >+++ b/Source/WebKit/UIProcess/ApplicationStateTracker.mm >@@ -29,6 +29,7 @@ > #if PLATFORM(IOS_FAMILY) > > #import "AssertionServicesSPI.h" >+#import "Logging.h" > #import "SandboxUtilities.h" > #import "UIKitSPI.h" > #import <wtf/ObjCRuntimeExtras.h> >@@ -123,6 +124,7 @@ ApplicationStateTracker::ApplicationStateTracker(UIView *view, SEL didEnterBackg > break; > } > >+ case ApplicationType::Extension: > case ApplicationType::ViewService: { > UIViewController *serviceViewController = nil; > >@@ -150,41 +152,19 @@ ApplicationStateTracker::ApplicationStateTracker(UIView *view, SEL didEnterBackg > if ([serviceViewController._hostApplicationBundleIdentifier isEqualToString:@"com.apple.ios.StoreKitUIService"]) > m_isInBackground = false; > >- m_didEnterBackgroundObserver = [notificationCenter addObserverForName:@"_UIViewServiceHostDidEnterBackgroundNotification" object:serviceViewController queue:nil usingBlock:[this](NSNotification *) { >+ RELEASE_LOG(ProcessSuspension, "%{public}s has PID %d, host application PID: %d, isInBackground: %d", _UIApplicationIsExtension() ? "Extension" : "ViewService", getpid(), applicationPID, m_isInBackground); >+ >+ m_didEnterBackgroundObserver = [notificationCenter addObserverForName:@"_UIViewServiceHostDidEnterBackgroundNotification" object:serviceViewController queue:nil usingBlock:[this, applicationPID](NSNotification *) { >+ RELEASE_LOG(ProcessSuspension, "%{public}s has PID %d, host application PID: %d, didEnterBackground", _UIApplicationIsExtension() ? "Extension" : "ViewService", getpid(), applicationPID); > applicationDidEnterBackground(); > }]; >- m_willEnterForegroundObserver = [notificationCenter addObserverForName:@"_UIViewServiceHostWillEnterForegroundNotification" object:serviceViewController queue:nil usingBlock:[this](NSNotification *) { >+ m_willEnterForegroundObserver = [notificationCenter addObserverForName:@"_UIViewServiceHostWillEnterForegroundNotification" object:serviceViewController queue:nil usingBlock:[this, applicationPID](NSNotification *) { >+ RELEASE_LOG(ProcessSuspension, "%{public}s has PID %d, host application PID: %d, willEnterForeground", _UIApplicationIsExtension() ? "Extension" : "ViewService", getpid(), applicationPID); > applicationWillEnterForeground(); > }]; > > break; > } >- >- case ApplicationType::Extension: { >- m_applicationStateMonitor = adoptNS([[BKSApplicationStateMonitor alloc] init]); >- >- m_isInBackground = isBackgroundState([m_applicationStateMonitor mostElevatedApplicationStateForPID:getpid()]); >- >- [m_applicationStateMonitor setHandler:[weakThis](NSDictionary *userInfo) { >- pid_t pid = [userInfo[BKSApplicationStateProcessIDKey] integerValue]; >- if (pid != getpid()) >- return; >- >- BKSApplicationState newState = (BKSApplicationState)[userInfo[BKSApplicationStateMostElevatedStateForProcessIDKey] unsignedIntValue]; >- bool newInBackground = isBackgroundState(newState); >- >- dispatch_async(dispatch_get_main_queue(), [weakThis, newInBackground] { >- auto applicationStateTracker = weakThis.get(); >- if (!applicationStateTracker) >- return; >- >- if (!applicationStateTracker->m_isInBackground && newInBackground) >- applicationStateTracker->applicationDidEnterBackground(); >- else if (applicationStateTracker->m_isInBackground && !newInBackground) >- applicationStateTracker->applicationWillEnterForeground(); >- }); >- }]; >- } > } > } >
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 198359
:
370908
| 370954