RESOLVED FIXED Bug 194924
REGRESSION(PSON) Scroll position is sometimes not restored on history navigation
https://bugs.webkit.org/show_bug.cgi?id=194924
Summary REGRESSION(PSON) Scroll position is sometimes not restored on history navigation
Chris Dumez
Reported 2019-02-21 16:38:50 PST
Scroll position is sometimes not restored on history navigation when PSON is enabled.
Attachments
Patch (6.88 KB, patch)
2019-02-21 16:45 PST, Chris Dumez
no flags
Patch (6.73 KB, patch)
2019-02-21 18:28 PST, Chris Dumez
no flags
Patch (6.57 KB, patch)
2019-02-21 19:45 PST, Chris Dumez
no flags
Patch (8.49 KB, patch)
2019-02-21 20:40 PST, Chris Dumez
ggaren: review+
Chris Dumez
Comment 1 2019-02-21 16:39:06 PST
Chris Dumez
Comment 2 2019-02-21 16:45:01 PST
Alex Christensen
Comment 3 2019-02-21 16:56:07 PST
Comment on attachment 362671 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=362671&action=review > Source/WebKit/WebProcess/WebPage/WebPage.cpp:2710 > + SetForScope<void (*)(WebCore::HistoryItem&)> bypassHistoryItemUpdateNotifications(WebCore::notifyHistoryItemChanged, ignoreHistoryItemUpdates); ignoreHistoryItemUpdates could be replaced by my favorite lambda [](auto){} > Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:4837 > TEST(ProcessSwap, ScrollPositionRestoration) This test passes for me in debug before the change. Is that expected?
Alex Christensen
Comment 4 2019-02-21 17:22:18 PST
Comment on attachment 362671 [details] Patch A release build also shows the test doesn't exercise the fix.
Chris Dumez
Comment 5 2019-02-21 18:20:28 PST
(In reply to Alex Christensen from comment #4) > Comment on attachment 362671 [details] > Patch > > A release build also shows the test doesn't exercise the fix. Did you try on iOS? It definitely reproduced the bug for me with the iOS simulator.
Chris Dumez
Comment 6 2019-02-21 18:21:54 PST
Comment on attachment 362671 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=362671&action=review Not sure why the r- >> Source/WebKit/WebProcess/WebPage/WebPage.cpp:2710 >> + SetForScope<void (*)(WebCore::HistoryItem&)> bypassHistoryItemUpdateNotifications(WebCore::notifyHistoryItemChanged, ignoreHistoryItemUpdates); > > ignoreHistoryItemUpdates could be replaced by my favorite lambda [](auto){} Will this work even though it expects a function pointer?
Chris Dumez
Comment 7 2019-02-21 18:28:46 PST
EWS Watchlist
Comment 8 2019-02-21 18:30:59 PST
Attachment 362681 [details] did not pass style-queue: ERROR: Source/WebKit/WebProcess/WebPage/WebPage.cpp:2708: Missing space before { [whitespace/braces] [5] ERROR: Source/WebKit/WebProcess/WebPage/WebPage.cpp:2708: Missing space inside { }. [whitespace/braces] [5] Total errors found: 2 in 4 files If any of these errors are false positives, please file a bug against check-webkit-style.
Ryosuke Niwa
Comment 9 2019-02-21 19:00:58 PST
Comment on attachment 362681 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=362681&action=review This seems sensible but I'd like someone familiar with the relevant code review it.W > Source/WebKit/ChangeLog:14 > + wuch as the scroll position. Nit: wuch. > Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:4863 > + TestWebKitAPI::Util::sleep(0.5); What's up with all these sleeps?
Chris Dumez
Comment 10 2019-02-21 19:38:37 PST
(In reply to Ryosuke Niwa from comment #9) > Comment on attachment 362681 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=362681&action=review > > This seems sensible but I'd like someone familiar with the relevant code > review it.W > > > Source/WebKit/ChangeLog:14 > > + wuch as the scroll position. > > Nit: wuch. > Whoops. > > Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:4863 > > + TestWebKitAPI::Util::sleep(0.5); > > What's up with all these sleeps? Need to give some time for the ipc to get received by the uiprocess.
Chris Dumez
Comment 11 2019-02-21 19:45:03 PST
EWS Watchlist
Comment 12 2019-02-21 19:47:10 PST
Attachment 362687 [details] did not pass style-queue: ERROR: Source/WebKit/WebProcess/WebPage/WebPage.cpp:2708: Missing space before { [whitespace/braces] [5] ERROR: Source/WebKit/WebProcess/WebPage/WebPage.cpp:2708: Missing space inside { }. [whitespace/braces] [5] Total errors found: 2 in 4 files If any of these errors are false positives, please file a bug against check-webkit-style.
Ryosuke Niwa
Comment 13 2019-02-21 20:01:29 PST
(In reply to Chris Dumez from comment #10) > > > > Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:4863 > > > + TestWebKitAPI::Util::sleep(0.5); > > > > What's up with all these sleeps? > > Need to give some time for the ipc to get received by the uiprocess. There's no way to round-trip IPC to web content process to ensure such a state? Relying on a sleep makes me worry that this test might become flaky in the future...
Chris Dumez
Comment 14 2019-02-21 20:11:09 PST
(In reply to Ryosuke Niwa from comment #13) > (In reply to Chris Dumez from comment #10) > > > > > > Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:4863 > > > > + TestWebKitAPI::Util::sleep(0.5); > > > > > > What's up with all these sleeps? > > > > Need to give some time for the ipc to get received by the uiprocess. > > There's no way to round-trip IPC to web content process to ensure such a > state? Relying on a sleep makes me worry that this test might become flaky > in the future... I agree it is not ideal but I was already happy to be able to write a test for this. I will try to find a more robust way tomorrow.
Chris Dumez
Comment 15 2019-02-21 20:40:45 PST
Chris Dumez
Comment 16 2019-02-21 20:41:43 PST
Comment on attachment 362671 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=362671&action=review >>> Source/WebKit/WebProcess/WebPage/WebPage.cpp:2710 >>> + SetForScope<void (*)(WebCore::HistoryItem&)> bypassHistoryItemUpdateNotifications(WebCore::notifyHistoryItemChanged, ignoreHistoryItemUpdates); >> >> ignoreHistoryItemUpdates could be replaced by my favorite lambda [](auto){} > > Will this work even though it expects a function pointer? Your proposal did not build with WPE.
EWS Watchlist
Comment 17 2019-02-21 20:43:13 PST
Attachment 362689 [details] did not pass style-queue: ERROR: Source/WebKit/WebProcess/WebPage/WebPage.cpp:2708: Missing space before { [whitespace/braces] [5] ERROR: Source/WebKit/WebProcess/WebPage/WebPage.cpp:2708: Missing space inside { }. [whitespace/braces] [5] Total errors found: 2 in 6 files If any of these errors are false positives, please file a bug against check-webkit-style.
Chris Dumez
Comment 18 2019-02-21 20:51:02 PST
Woohoo found something that builds on WPE.
Geoffrey Garen
Comment 19 2019-02-22 10:15:54 PST
Comment on attachment 362689 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=362689&action=review r=me > Source/WebKit/ChangeLog:10 > + call restoreSessionInternal() to restore the HistoryItems based on the UIProcess' UIProcess's > Source/WebKit/ChangeLog:12 > + updates back to the UIProcess. Without PSON, this would be unnecessary but harmless. When did this ever happen without PSON? (I think only PSON creates a new WebPage for backforward navigation.) > Source/WebKit/WebProcess/WebPage/WebPage.cpp:2705 > + // Since we're merely restoring HistoryItems from the UIProcess, there is no need to send HistoryItem update notifications back to the UIProcess. I would comment more strongly: Avoid sending HistoryItem updates to the UIProcess because we may overwrite important in-flight state from the UI process (like scroll position). > Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:4816 > +// Pages with dedicated workers do not go into page cache. > +var myWorker = new Worker('worker.js'); Seems like it would be nice to add window.internals.disablePageCache() for cases like this.
Alex Christensen
Comment 20 2019-02-22 10:19:32 PST
(In reply to Chris Dumez from comment #6) > Will this work even though it expects a function pointer? Lambdas with no captures can be used as function pointers. Lambdas with auto parameters are kind of like templates, which was probably what was causing problems with WPE.
Chris Dumez
Comment 21 2019-02-22 10:21:35 PST
Comment on attachment 362689 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=362689&action=review >> Source/WebKit/ChangeLog:12 >> + updates back to the UIProcess. Without PSON, this would be unnecessary but harmless. > > When did this ever happen without PSON? (I think only PSON creates a new WebPage for backforward navigation.) After a crash.
Chris Dumez
Comment 22 2019-02-22 10:25:06 PST
Note You need to log in before you can comment on or make changes to this bug.