[webkit-changes] [WebKit/WebKit] 4016aa: [Navigation API] NavigationHistoryEntry JS wrapper...

Chris Dumez noreply at github.com
Sat Dec 14 10:04:57 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4016aa647924537a988fe198b589aceeb71add23
      https://github.com/WebKit/WebKit/commit/4016aa647924537a988fe198b589aceeb71add23
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2024-12-14 (Sat, 14 Dec 2024)

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/intercept-handler-throws-expected.txt
    M Source/WebCore/page/NavigateEvent.cpp
    M Source/WebCore/page/Navigation.cpp
    M Source/WebCore/page/Navigation.h
    M Source/WebCore/page/NavigationHistoryEntry.cpp
    M Source/WebCore/page/NavigationHistoryEntry.h
    M Source/WebCore/page/NavigationHistoryEntry.idl

  Log Message:
  -----------
  [Navigation API] NavigationHistoryEntry JS wrapper is not kept alive until the dispose event is fired
https://bugs.webkit.org/show_bug.cgi?id=284663

Reviewed by Ryosuke Niwa.

When a NavigationHistoryEntry object gets removed from a Navigation object, a `dispose` event is
dispatched on the NavigationHistoryEntry. However, NavigationHistoryEntry was not an ActiveDOMObject
and therefore nothing was keeping its JS wrapper alive alive as long as a `dispose` event could get
dispatched. This would lead to flaky crashes in the tests, when dispatching the event.

To address the issue, make NavigationHistoryEntry an ActiveDOMObject and provide an implementation
for virtualHasPendingActivity() so that its JS wrapper is kept alive as long as we haven't dispatched
the `dispose` event on it.

Also add a couple of missing JSLocks to address debug assertions I was seeing on the tests locally.

* LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigate-event/intercept-handler-throws-expected.txt:
Rebaseline the test. While the output looks a bit worse, I do not believe this is a regression from my
change but rather a timing change on a flaky test.

* Source/WebCore/page/NavigateEvent.cpp:
(WebCore::NavigateEvent::NavigateEvent):
* Source/WebCore/page/Navigation.cpp:
(WebCore::Navigation::initializeForNewWindow):
(WebCore::Navigation::updateForActivation):
(WebCore::Navigation::createForPageswapEvent):
(WebCore::createDOMPromise):
(WebCore::Navigation::updateForNavigation):
(WebCore::Navigation::updateForReactivation):
* Source/WebCore/page/Navigation.h:
* Source/WebCore/page/NavigationHistoryEntry.cpp:
(WebCore::NavigationHistoryEntry::NavigationHistoryEntry):
(WebCore::NavigationHistoryEntry::create):
(WebCore::NavigationHistoryEntry::eventListenersDidChange):
(WebCore::NavigationHistoryEntry::virtualHasPendingActivity const):
(WebCore::NavigationHistoryEntry::dispatchDisposeEvent):
* Source/WebCore/page/NavigationHistoryEntry.h:
* Source/WebCore/page/NavigationHistoryEntry.idl:

Canonical link: https://commits.webkit.org/287839@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list