Skip to content

ASSERTION FAILED: m_wrapper from WebCore::JSEventListener::ensureJSFunction in Navigation::innerDispatchNavigateEvent#64145

Closed
cdumez wants to merge 1 commit into
WebKit:mainfrom
cdumez:310813_navigation_api_no_dispatch_after_context_gone
Closed

ASSERTION FAILED: m_wrapper from WebCore::JSEventListener::ensureJSFunction in Navigation::innerDispatchNavigateEvent#64145
cdumez wants to merge 1 commit into
WebKit:mainfrom
cdumez:310813_navigation_api_no_dispatch_after_context_gone

Conversation

@cdumez
Copy link
Copy Markdown
Contributor

@cdumez cdumez commented May 4, 2026

12876cf

ASSERTION FAILED: m_wrapper from WebCore::JSEventListener::ensureJSFunction in Navigation::innerDispatchNavigateEvent
https://bugs.webkit.org/show_bug.cgi?id=310813
rdar://162816815

Reviewed by NOBODY (OOPS!).

Do not try to dispatch the navigate event if the script execution context
is gone or stopped, to avoid tripping assertions due to the JS wrapper
being gone.

Test: navigation-api/navigation-navigate-event-after-gc.html

* LayoutTests/navigation-api/navigation-navigate-event-after-gc-expected.txt: Added.
* LayoutTests/navigation-api/navigation-navigate-event-after-gc.html: Added.
* LayoutTests/navigation-api/resources/navigate-with-intercept.html: Added.
* Source/WebCore/page/Navigation.cpp:
(WebCore::Navigation::hasEntriesAndEventsDisabled const):

12876cf

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows Apple Internal
✅ 🧪 style 🛠 ios ✅ 🛠 mac 🛠 wpe 🛠 win ✅ 🛠 ios-apple
✅ 🧪 bindings ✅ 🛠 ios-sim 🛠 mac-AS-debug 🧪 wpe-wk2 🧪 win-tests ✅ 🛠 mac-apple
✅ 🧪 webkitperl 🧪 ios-wk2 🧪 api-mac 🧪 api-wpe ❌ 🛠 vision-apple
🧪 ios-wk2-wpt 🧪 api-mac-debug 🛠 gtk3-libwebrtc
🧪 api-ios 🧪 mac-wk1 🛠 gtk
🛠 ios-safer-cpp 🧪 mac-wk2 🧪 gtk-wk2
🛠 vision 🧪 mac-AS-debug-wk2 🧪 api-gtk
🛠 vision-sim 🧪 mac-wk2-stress 🛠 playstation
🧪 vision-wk2 🧪 mac-intel-wk2
🛠 tv 🛠 mac-safer-cpp
🛠 tv-sim
🛠 watch
🛠 watch-sim

@cdumez cdumez self-assigned this May 4, 2026
@cdumez cdumez added the WebCore Misc. For miscellaneous bugs in the WebCore framework (and not JavaScriptCore or WebKit). label May 4, 2026
@cdumez cdumez force-pushed the 310813_navigation_api_no_dispatch_after_context_gone branch from db10393 to 597dfc3 Compare May 5, 2026 00:55
@cdumez cdumez marked this pull request as ready for review May 5, 2026 00:56
@cdumez cdumez requested review from basuke and rniwa May 5, 2026 00:56
Comment thread Source/WebCore/page/Navigation.cpp Outdated
@@ -1310,7 +1310,8 @@ Navigation::DispatchResult Navigation::innerDispatchNavigateEvent(NavigationNavi
m_focusChangedDuringOngoingNavigation = FocusDidChange::No;
m_suppressNormalScrollRestorationDuringOngoingNavigation = false;

dispatchEvent(event);
if (document && !document->activeDOMObjectsAreStopped())
dispatchEvent(event);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to abort event and return Aborted as other failure cases?

…nction in Navigation::innerDispatchNavigateEvent

https://bugs.webkit.org/show_bug.cgi?id=310813
rdar://162816815

Reviewed by NOBODY (OOPS!).

Do not try to dispatch the navigate event if the script execution context
is gone or stopped, to avoid tripping assertions due to the JS wrapper
being gone.

Test: navigation-api/navigation-navigate-event-after-gc.html

* LayoutTests/navigation-api/navigation-navigate-event-after-gc-expected.txt: Added.
* LayoutTests/navigation-api/navigation-navigate-event-after-gc.html: Added.
* LayoutTests/navigation-api/resources/navigate-with-intercept.html: Added.
* Source/WebCore/page/Navigation.cpp:
(WebCore::Navigation::hasEntriesAndEventsDisabled const):
@cdumez cdumez force-pushed the 310813_navigation_api_no_dispatch_after_context_gone branch from 597dfc3 to 12876cf Compare May 5, 2026 01:28
@cdumez cdumez closed this May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

WebCore Misc. For miscellaneous bugs in the WebCore framework (and not JavaScriptCore or WebKit).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants