Bug 237451 - Home link on weather.gov is not working
Summary: Home link on weather.gov is not working
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL: https://github.com/web-platform-tests...
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-03-03 15:34 PST by Chris Dumez
Modified: 2022-08-03 16:12 PDT (History)
8 users (show)

See Also:


Attachments
WIP patch (2.25 KB, patch)
2022-03-03 15:39 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (13.00 KB, patch)
2022-03-03 17:24 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (13.40 KB, patch)
2022-03-03 17:41 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (13.58 KB, patch)
2022-03-03 21:14 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (23.07 KB, patch)
2022-03-04 10:34 PST, Chris Dumez
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (23.03 KB, patch)
2022-03-04 11:43 PST, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2022-03-03 15:34:24 PST
Home link on weather.gov is not working in WebKit but works in Chrome & Firefox.
Comment 1 Chris Dumez 2022-03-03 15:34:40 PST
<rdar://60409277>
Comment 2 Chris Dumez 2022-03-03 15:39:20 PST
Created attachment 453790 [details]
WIP patch

Causes WPT failures that need investigation.
Comment 3 Chris Dumez 2022-03-03 17:24:26 PST
Created attachment 453800 [details]
Patch
Comment 4 EWS Watchlist 2022-03-03 17:26:42 PST
This patch modifies the imported WPT tests. Please ensure that any changes on the tests (not coming from a WPT import) are exported to WPT. Please see https://trac.webkit.org/wiki/WPTExportProcess
Comment 5 Chris Dumez 2022-03-03 17:41:45 PST
Created attachment 453805 [details]
Patch
Comment 6 Chris Dumez 2022-03-03 17:48:31 PST
WPT test upstreaming: https://github.com/web-platform-tests/wpt/pull/33053
Comment 7 Chris Dumez 2022-03-03 21:14:54 PST
Created attachment 453809 [details]
Patch
Comment 8 Geoffrey Garen 2022-03-04 09:42:51 PST
Comment on attachment 453809 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=453809&action=review

Looks good!

Comment below about WeakPtr. I guess I am parroting years of Darin explaining to me that basing behaviors on destructors is not a good pattern.

> Source/WebCore/ChangeLog:14
> +        We only only resolve the target history entry once the scheduled task runs asynchronously.

only only

> Source/WebCore/loader/NavigationScheduler.cpp:276
> +        if (!m_historyItem)
> +            return;

I suppose that we could just make the HistoryItem a RefPtr and guarantee that the navigation succeeds.

Is the goal here that the navigation should fail if the history item has been removed from the back-forward list? (Is that required by spec or WPT?)

If that's the goal, I wonder if we should use a RefPtr and an explicit "isInList" boolean, or an explicit scan of the list, rather than a weak pointer. In theory, object lifetime is allowed to do whatever it wants, and a lambda or GC or tree of objects or whatever might change lifetime in unexpected ways, causing a navigation to succeed or fail in surprising ways.

> LayoutTests/TestExpectations:346
> +# This test is timing out in both WebKit in Blink (one of the subtests is timing out in Gecko).

WebKit and Blink
Comment 9 Chris Dumez 2022-03-04 09:46:27 PST
(In reply to Geoffrey Garen from comment #8)
> Comment on attachment 453809 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=453809&action=review
> 
> Looks good!
> 
> Comment below about WeakPtr. I guess I am parroting years of Darin
> explaining to me that basing behaviors on destructors is not a good pattern.
> 
> > Source/WebCore/ChangeLog:14
> > +        We only only resolve the target history entry once the scheduled task runs asynchronously.
> 
> only only
> 
> > Source/WebCore/loader/NavigationScheduler.cpp:276
> > +        if (!m_historyItem)
> > +            return;
> 
> I suppose that we could just make the HistoryItem a RefPtr and guarantee
> that the navigation succeeds.
> 
> Is the goal here that the navigation should fail if the history item has
> been removed from the back-forward list? (Is that required by spec or WPT?)

Yes, that's the goal. I made this change to keep one WPT test passing as it was expecting this behavior.

> If that's the goal, I wonder if we should use a RefPtr and an explicit
> "isInList" boolean, or an explicit scan of the list, rather than a weak
> pointer. In theory, object lifetime is allowed to do whatever it wants, and
> a lambda or GC or tree of objects or whatever might change lifetime in
> unexpected ways, causing a navigation to succeed or fail in surprising ways.

I will look into this but scanning the list for example is not a viable solution because the list is only on the UIProcess side and I wouldn't want to introduce new sync IPC to check. I agree that relying on the WeakPtr is a bit fragile though and hopefully I can find something better. Even though the WebProcess doesn't actually have the list, it does maintain a set of all HistoryItems and it removes from that set whenever the UIProcess sends it IPC to tell it the HistoryItem is no longer needed. I can likely set the boolean you suggest then.

> > LayoutTests/TestExpectations:346
> > +# This test is timing out in both WebKit in Blink (one of the subtests is timing out in Gecko).
> 
> WebKit and Blink
Comment 10 Chris Dumez 2022-03-04 10:34:04 PST
Created attachment 453855 [details]
Patch
Comment 11 Chris Dumez 2022-03-04 11:43:59 PST
Created attachment 453861 [details]
Patch
Comment 12 Darin Adler 2022-03-04 14:05:35 PST
(In reply to Geoffrey Garen from comment #8)
> I guess I am parroting years of Darin
> explaining to me that basing behaviors on destructors is not a good pattern.

My comments on this are specifically: behaviors based on the timing of destruction of objects with *shared* ownership (which typically means reference counting or garbage collection). For such shared objects we really want to be as close as possible to "just free memory in the destructor".

If an object has simpler lifetime and is not shared, then work in a destructor *could* be OK, but even in that case it can be tricky to write correct code. Inside destructors an object is typically already partly destroyed, for example if the object is has a polymorphic class, and was an instance of a derived class from this base class.

Since so many of our objects are reference counted, it’s easy to see how my advice could be perceived as applying to all destructors.
Comment 13 EWS 2022-03-04 14:59:12 PST
Committed r290849 (248082@main): <https://commits.webkit.org/248082@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 453861 [details].