RESOLVED FIXED 184142
Process swapping on navigation needs to handle server redirects
https://bugs.webkit.org/show_bug.cgi?id=184142
Summary Process swapping on navigation needs to handle server redirects
Brady Eidson
Reported 2018-03-29 11:56:32 PDT
Process swapping on navigation needs to handle server redirects <rdar://problem/38690465>
Attachments
Patch (36.86 KB, patch)
2018-03-30 22:18 PDT, Brady Eidson
no flags
Patch (36.24 KB, patch)
2018-03-31 11:40 PDT, Brady Eidson
no flags
Patch (36.96 KB, patch)
2018-04-02 10:35 PDT, Brady Eidson
no flags
Patch (36.97 KB, patch)
2018-04-02 11:05 PDT, Brady Eidson
no flags
Patch (36.90 KB, patch)
2018-04-02 17:24 PDT, Brady Eidson
no flags
Brady Eidson
Comment 1 2018-03-30 22:18:08 PDT Comment hidden (obsolete)
Brady Eidson
Comment 2 2018-03-31 11:40:18 PDT
Alex Christensen
Comment 3 2018-04-02 10:16:23 PDT
Comment on attachment 336927 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=336927&action=review > Source/WebKit/ChangeLog:14 > + 3 - A WKWebView is showing content from a.com, we start a load to a.com, that that redirects to b.com. Will future work will make it so a redirect from a to b then back to a will reuse the same process? > Source/WebKit/UIProcess/WebPageProxy.cpp:2397 > + m_mainFrameSetHandler = [this, protectedThis = makeRef(*this), navigation = makeRef(navigation), request = ResourceRequest { navigation.currentRequest() }]() mutable { I think the explicit call to the constructor might be unnecessary. > Source/WebKit/UIProcess/WebPageProxy.cpp:3212 > + if (m_mainFrameSetHandler) { m_mainFrameCreationHandler? > Source/WebKit/UIProcess/WebPageProxy.cpp:3855 > + Ref<WebFramePolicyListenerProxy> listener = frame->setUpPolicyListenerProxy(listenerID, PolicyListenerType::NavigationAction); auto? > Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:162 > + [(id<WKURLSchemeTaskPrivate>)task _didPerformRedirection:redirectResponse.get() newRequest:request.get()]; Wow, this SPI seems really useful! I'm glad we have it. > Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:568 > + RetainPtr<PSONScheme> handler1 = adoptNS([[PSONScheme alloc] init]); You have inconsistent use of auto in your tests.
youenn fablet
Comment 4 2018-04-02 10:30:12 PDT
> > Source/WebKit/ChangeLog:14 > > + 3 - A WKWebView is showing content from a.com, we start a load to a.com, that that redirects to b.com. > > Will future work will make it so a redirect from a to b then back to a will > reuse the same process? Ideally, future work will enable us to do full loading in NetworkProcess without going through WebProcess, including navigations. That would handle this point automatically, although we might want to get to it before having the full loading stuff.
Brady Eidson
Comment 5 2018-04-02 10:32:32 PDT
(In reply to Alex Christensen from comment #3) > Comment on attachment 336927 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=336927&action=review > > > Source/WebKit/ChangeLog:14 > > + 3 - A WKWebView is showing content from a.com, we start a load to a.com, that that redirects to b.com. > > Will future work will make it so a redirect from a to b then back to a will > reuse the same process? Maybe. Not necessarily worth it though - At the a.com to b.com redirect we have to fire up a second process, but then reverting back to the a.com process is more work... CPU/Battery tradeoff... I'll file a bug tracking the idea, definitely not convinced it's a slam dunk. > > Source/WebKit/UIProcess/WebPageProxy.cpp:2397 > > + m_mainFrameSetHandler = [this, protectedThis = makeRef(*this), navigation = makeRef(navigation), request = ResourceRequest { navigation.currentRequest() }]() mutable { > > I think the explicit call to the constructor might be unnecessary. Yah it was in some places, maybe not here, will 2x check. > > > Source/WebKit/UIProcess/WebPageProxy.cpp:3212 > > + if (m_mainFrameSetHandler) { > > m_mainFrameCreationHandler? > Sure. > > Source/WebKit/UIProcess/WebPageProxy.cpp:3855 > > + Ref<WebFramePolicyListenerProxy> listener = frame->setUpPolicyListenerProxy(listenerID, PolicyListenerType::NavigationAction); > > auto? Sure. > > > Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:162 > > + [(id<WKURLSchemeTaskPrivate>)task _didPerformRedirection:redirectResponse.get() newRequest:request.get()]; > > Wow, this SPI seems really useful! I'm glad we have it. Nice! I'll CC you on the bugs I file for how it does weird things... :) > > Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:568 > > + RetainPtr<PSONScheme> handler1 = adoptNS([[PSONScheme alloc] init]); > > You have inconsistent use of auto in your tests. Tests tests shmests
Brady Eidson
Comment 6 2018-04-02 10:32:46 PDT
(In reply to youenn fablet from comment #4) > > > Source/WebKit/ChangeLog:14 > > > + 3 - A WKWebView is showing content from a.com, we start a load to a.com, that that redirects to b.com. > > > > Will future work will make it so a redirect from a to b then back to a will > > reuse the same process? > > Ideally, future work will enable us to do full loading in NetworkProcess > without going through WebProcess, including navigations. That would handle > this point automatically, although we might want to get to it before having > the full loading stuff. ^^^^ 👍
Brady Eidson
Comment 7 2018-04-02 10:35:41 PDT
Brady Eidson
Comment 8 2018-04-02 11:05:10 PDT
WebKit Commit Bot
Comment 9 2018-04-02 13:05:53 PDT
Comment on attachment 337002 [details] Patch Clearing flags on attachment: 337002 Committed r230174: <https://trac.webkit.org/changeset/230174>
WebKit Commit Bot
Comment 10 2018-04-02 13:05:54 PDT
All reviewed patches have been landed. Closing bug.
Ryan Haddad
Comment 11 2018-04-02 15:14:45 PDT
iOS and macOS Debug WK2 tests are exiting early due to crashes after this change. ASSERTION FAILED: navigation->originalRequest().url() == originalRequest.url() /Volumes/Data/slave/highsierra-debug/build/Source/WebKit/UIProcess/WebPageProxy.cpp(3845) : void WebKit::WebPageProxy::decidePolicyForNavigationAction(uint64_t, const WebCore::SecurityOriginData &, uint64_t, WebKit::NavigationActionData &&, const WebKit::FrameInfoData &, uint64_t, const WebCore::ResourceRequest &, WebCore::ResourceRequest &&, uint64_t, const WebKit::UserData &) See:https://build.webkit.org/results/Apple%20High%20Sierra%20Debug%20WK2%20(Tests)/r230176%20(2692)/results.html
Ryan Haddad
Comment 12 2018-04-02 16:09:23 PDT
Reverted r230174 for reason: Caused LayoutTests to exit early with assertion failures. Committed r230191: <https://trac.webkit.org/changeset/230191>
Brady Eidson
Comment 13 2018-04-02 16:38:30 PDT
(In reply to Ryan Haddad from comment #11) > iOS and macOS Debug WK2 tests are exiting early due to crashes after this > change. Annnnnnnnnnnd we don't have EWS for either of them. Still. To this day.
Brady Eidson
Comment 14 2018-04-02 17:24:45 PDT
WebKit Commit Bot
Comment 15 2018-04-02 18:03:51 PDT
Comment on attachment 337046 [details] Patch Clearing flags on attachment: 337046 Committed r230195: <https://trac.webkit.org/changeset/230195>
WebKit Commit Bot
Comment 16 2018-04-02 18:03:53 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.