Changeset 278318 in webkit
- Timestamp:
- Jun 1, 2021, 12:02:38 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/UIProcess/WebBackForwardCache.cpp (modified) (1 diff)
-
Source/WebKit/UIProcess/WebBackForwardCache.h (modified) (1 diff)
-
Source/WebKit/UIProcess/WebPageProxy.cpp (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r278317 r278318 1 2021-06-01 Chris Dumez <cdumez@apple.com> 2 3 REGRESSION (iOS 14.5): Can't go back and render previous page properly after "location.href" 4 https://bugs.webkit.org/show_bug.cgi?id=226323 5 <rdar://problem/78623536> 6 7 Reviewed by Alex Christensen. 8 9 A while back, we did an optimization to allow several WebPage objects associated with the 10 same WebPageProxy to live in the same WebProcess. This allowed us to reuse a process from 11 a SuspendedPageProxy for a forward navigation, without destroying the SuspendedPageProxy. 12 However, this added quite a bit of complexity and this broke some same-process back/forward 13 navigations like in this bug. In particular, it is really hard to get do our history 14 management right (with the current model) if there is more than more WebPage in a process 15 for the same WebPageProxy. 16 17 To address issues, we go back to the older model with one WebPage per WebProcess for a 18 given WebPageProxy. To achieve this, we make sure to destroy of SuspendedPageProxy objects 19 for the current page and destination process before we process-swap (like we used to do). 20 21 * UIProcess/WebBackForwardCache.cpp: 22 (WebKit::WebBackForwardCache::removeEntriesForPageAndProcess): 23 * UIProcess/WebBackForwardCache.h: 24 * UIProcess/WebPageProxy.cpp: 25 (WebKit::WebPageProxy::receivedNavigationPolicyDecision): 26 1 27 2021-06-01 Sihui Liu <sihui_liu@apple.com> 2 28 -
trunk/Source/WebKit/UIProcess/WebBackForwardCache.cpp
r273183 r278318 146 146 } 147 147 148 void WebBackForwardCache::removeEntriesForPageAndProcess(WebPageProxy& page, WebProcessProxy& process) 149 { 150 removeEntriesMatching([pageID = page.identifier(), processIdentifier = process.coreProcessIdentifier()](auto& item) { 151 ASSERT(item.backForwardCacheEntry()); 152 return item.pageID() == pageID && item.backForwardCacheEntry()->processIdentifier() == processIdentifier; 153 }); 154 } 155 148 156 void WebBackForwardCache::removeEntriesMatching(const Function<bool(WebBackForwardListItem&)>& matches) 149 157 { -
trunk/Source/WebKit/UIProcess/WebBackForwardCache.h
r251174 r278318 54 54 void removeEntriesForProcess(WebProcessProxy&); 55 55 void removeEntriesForPage(WebPageProxy&); 56 void removeEntriesForPageAndProcess(WebPageProxy&, WebProcessProxy&); 56 57 void removeEntriesForSession(PAL::SessionID); 57 58 -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r278315 r278318 3425 3425 ASSERT(!destinationSuspendedPage || navigation->targetItem()); 3426 3426 auto suspendedPage = destinationSuspendedPage ? backForwardCache().takeSuspendedPage(*navigation->targetItem()) : nullptr; 3427 3428 // It is difficult to get history right if we have several WebPage objects inside a single WebProcess for the same WebPageProxy. As a result, if we make sure to 3429 // clear any SuspendedPageProxy for the current page that are backed by the destination process before we proceed with the navigation. This makes sure the WebPage 3430 // we are about to create in the destination process will be the only one associated with this WebPageProxy. 3431 if (!destinationSuspendedPage) 3432 backForwardCache().removeEntriesForPageAndProcess(*this, processForNavigation); 3433 3427 3434 ASSERT(suspendedPage.get() == destinationSuspendedPage); 3428 3435 if (suspendedPage && suspendedPage->pageIsClosedOrClosing()) -
trunk/Tools/ChangeLog
r278310 r278318 1 2021-06-01 Chris Dumez <cdumez@apple.com> 2 3 REGRESSION (iOS 14.5): Can't go back and render previous page properly after "location.href" 4 https://bugs.webkit.org/show_bug.cgi?id=226323 5 <rdar://problem/78623536> 6 7 Reviewed by Alex Christensen. 8 9 New API test written by Alex Christensen to cover this case. 10 11 * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: 12 1 13 2021-06-01 Aakash Jain <aakash_jain@apple.com> 2 14 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm
r273891 r278318 3352 3352 } 3353 3353 3354 TEST(ProcessSwap, NavigateBackAfterCrossOriginClientRedirect) 3355 { 3356 auto processPoolConfiguration = psonProcessPoolConfiguration(); 3357 auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]); 3358 3359 auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]); 3360 [webViewConfiguration setProcessPool:processPool.get()]; 3361 auto handler = adoptNS([[PSONScheme alloc] init]); 3362 [handler addMappingFromURLString:@"pson://webkit.org/navigated_from" toData:"<a href='pson://apple.com/'>hello</a>"]; 3363 [handler addMappingFromURLString:@"pson://apple.com/" toData:"<script>window.location.href='pson://webkit.org/redirected_to'</script>redirecting..."]; 3364 [handler addMappingFromURLString:@"pson://webkit.org/redirected_to" toData:"<p>hello again</p>"]; 3365 [webViewConfiguration setURLSchemeHandler:handler.get() forURLScheme:@"PSON"]; 3366 3367 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]); 3368 3369 [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://webkit.org/navigated_from"]]]; 3370 [webView _test_waitForDidFinishNavigation]; 3371 3372 [webView evaluateJavaScript:@"document.querySelector('a').click()" completionHandler:nil]; 3373 [webView _test_waitForDidFinishNavigation]; 3374 [webView _test_waitForDidFinishNavigation]; 3375 EXPECT_WK_STREQ([webView objectByEvaluatingJavaScript:@"window.location.href"], "pson://webkit.org/redirected_to"); 3376 [webView goBack]; 3377 [webView _test_waitForDidFinishNavigation]; 3378 EXPECT_WK_STREQ([webView objectByEvaluatingJavaScript:@"window.location.href"], "pson://webkit.org/navigated_from"); 3379 } 3380 3354 3381 TEST(ProcessSwap, BackForwardCacheSkipBackForwardListItem) 3355 3382 {
Note:
See TracChangeset
for help on using the changeset viewer.