Bug 257849 - Inconsistent firing of onBeforeNavigate event in webNavigation API in Safari
Summary: Inconsistent firing of onBeforeNavigate event in webNavigation API in Safari
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Extensions (show other bugs)
Version: Safari 16
Hardware: Mac (Apple Silicon) macOS 13
: P2 Major
Assignee: Nobody
URL:
Keywords: BrowserCompat, InRadar
Depends on:
Blocks:
 
Reported: 2023-06-08 02:47 PDT by Mykola
Modified: 2023-06-15 02:47 PDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mykola 2023-06-08 02:47:02 PDT
The webNavigation API in Safari exhibits inconsistent behavior in firing the onBeforeNavigate event compared to Chrome.

Steps to Reproduce:
1. Navigate from a website using a URL (the onBeforeNavigate event fires correctly).
2. Open a URL in a new tab (via context menu or command) (the onBeforeNavigate event fires correctly).
3. Open a URL in a new window (via context menu) (the onBeforeNavigate event fires correctly).
4. Manually enter a URL in the search field (it does not fire the onBeforeNavigate event, unlike Chrome).

Expected Behavior:
The onBeforeNavigate event should consistently fire in all navigation scenarios, including manually entering a URL in the search field.

Actual Behavior:
In Safari, the onBeforeNavigate event does not fire when manually entering a URL in the search field.

Additional Details:
Safari version: 16.5 (18615.2.9.11.4)
macOS version: 13.4 (22F66)

Please consider the provided information to address the inconsistency in the firing of the onBeforeNavigate event in Safari.
Comment 1 Brian Weinstein 2023-06-12 16:13:39 PDT
Do you have "Preload Top Hit in Background" checked in your Safari Search Settings?

If you have that checked, we defer firing those onBeforeNavigate events. Can you try turning that off and seeing if the bug still reproduces?
Comment 2 Mykola 2023-06-14 05:08:28 PDT
(In reply to Brian Weinstein from comment #1)
> Do you have "Preload Top Hit in Background" checked in your Safari Search
> Settings?
> 
> If you have that checked, we defer firing those onBeforeNavigate events. Can
> you try turning that off and seeing if the bug still reproduces?

Yes, "Preload Top Hit in Background" was enabled by default.
I turned it off, but unfortunately, the situation didn't change for me. 
I still have the issue that Safari does not fire the onBeforeNavigate event.
Comment 3 Radar WebKit Bug Importer 2023-06-15 02:47:16 PDT
<rdar://problem/110828492>