Skip to content

Conversation

annevk
Copy link
Member

@annevk annevk commented Oct 14, 2025

See https://bugs.webkit.org/show_bug.cgi?id=297721 for context.


I would love to know why this ended up in Chromium but not the HTML standard. (I couldn't figure out how to blame a deleted file using the web interface.)

Also ideally someone else more familiar with this space would take over for tests and such.

cc @jnjaeschke @natechapin

(See WHATWG Working Mode: Changes for more details.)


/nav-history-apis.html ( diff )

@annevk annevk requested a review from noamr October 14, 2025 14:28
@annevk annevk added compat Standard is not web compatible or proprietary feature needs standardizing topic: navigation labels Oct 14, 2025
@zcorpan
Copy link
Member

zcorpan commented Oct 14, 2025

This is tested in https://wpt.fyi/results/html/dom/idlharness.https.html%3Finclude%3D(Document%7CWindow)?label=experimental&label=master&aligned subtest Window interface: attribute navigation which currently fails in Chromium because of the Replaceable check.

Landing the spec change should update the IDL in wpt, so I think we can tick the "tests" checkbox.

RupinMittal added a commit to RupinMittal/WebKit that referenced this pull request Oct 14, 2025
https://bugs.webkit.org/show_bug.cgi?id=297721
rdar://158951219

Reviewed by NOBODY (OOPS!).

With the Navigation API enabled, the ESPN title bar is empty instead of
containing the tab buttons like it should.

The issue is that espn.com re-assigns the "navigation" variable to hold
these items in this function:

preRender: function(type, navCached, defaultNavData) {
    ...
    navigation = defaultNavData.navigation
    ...
    espn_ui.Helpers.nav.items = navigation.items
    ...
}

But with the Navigation API enabled, the "navigation" variable is reserved
for accessing that API and is not replaceable. So this re-assignment fails
and the title bar ends up empty.

The spec does not say that "navigation" should be replaceable. But this is
breaking a live site and Chrome does allow it to be replaceable, so we fix this
by making it replaceable in WebKit too. I have confirmed that this does fix
the ESPN title bar locally.

Associated spec issue: whatwg/html#11786

I've added a new layout test to check this:
navigation-api/navigation-object-is-replaceable.html

* LayoutTests/navigation-api/navigation-object-is-replaceable-expected.txt: Added.
* LayoutTests/navigation-api/navigation-object-is-replaceable.html: Added.
* Source/WebCore/page/DOMWindow.idl:
@annevk
Copy link
Member Author

annevk commented Oct 15, 2025

Thanks, I'll merge this then.

I'm still curious about the Chromium story.

@annevk annevk merged commit 24fcc03 into main Oct 15, 2025
2 checks passed
@annevk annevk deleted the annevk/navigation branch October 15, 2025 07:49
RupinMittal added a commit to RupinMittal/WebKit that referenced this pull request Oct 15, 2025
https://bugs.webkit.org/show_bug.cgi?id=297721
rdar://158951219

Reviewed by NOBODY (OOPS!).

With the Navigation API enabled, the ESPN title bar is empty instead of
containing the tab buttons like it should.

The issue is that espn.com re-assigns the "navigation" variable to hold
these items in this function:

preRender: function(type, navCached, defaultNavData) {
    ...
    navigation = defaultNavData.navigation
    ...
    espn_ui.Helpers.nav.items = navigation.items
    ...
}

But with the Navigation API enabled, the "navigation" variable is reserved
for accessing that API and is not replaceable. So this re-assignment fails
and the title bar ends up empty.

The spec does not say that "navigation" should be replaceable. But this is
breaking a live site and Chrome does allow it to be replaceable, so we fix this
by making it replaceable in WebKit too. I have confirmed that this does fix
the ESPN title bar locally.

Associated spec issue: whatwg/html#11786

I've added a new layout test to check this:
navigation-api/navigation-object-is-replaceable.html

* LayoutTests/imported/w3c/web-platform-tests/interfaces/html.idl:
* LayoutTests/imported/w3c/web-platform-tests/interfaces/html.idl:
* LayoutTests/navigation-api/navigation-object-is-replaceable-expected.txt: Added.
* LayoutTests/navigation-api/navigation-object-is-replaceable.html: Added.
* Source/WebCore/page/DOMWindow.idl:
webkit-commit-queue pushed a commit to RupinMittal/WebKit that referenced this pull request Oct 16, 2025
https://bugs.webkit.org/show_bug.cgi?id=297721
rdar://158951219

Reviewed by Chris Dumez and Anne van Kesteren.

With the Navigation API enabled, the ESPN title bar is empty instead of
containing the tab buttons like it should.

The issue is that espn.com re-assigns the "navigation" variable to hold
these items in this function:

preRender: function(type, navCached, defaultNavData) {
    ...
    navigation = defaultNavData.navigation
    ...
    espn_ui.Helpers.nav.items = navigation.items
    ...
}

But with the Navigation API enabled, the "navigation" variable is reserved
for accessing that API and is not replaceable. So this re-assignment fails
and the title bar ends up empty.

The spec does not say that "navigation" should be replaceable. But this is
breaking a live site and Chrome does allow it to be replaceable, so we fix this
by making it replaceable in WebKit too. I have confirmed that this does fix
the ESPN title bar locally.

Associated spec issue: whatwg/html#11786

I've added a new layout test to check this:
navigation-api/navigation-object-is-replaceable.html

* LayoutTests/imported/w3c/web-platform-tests/interfaces/html.idl:
* LayoutTests/imported/w3c/web-platform-tests/interfaces/html.idl:
* LayoutTests/navigation-api/navigation-object-is-replaceable-expected.txt: Added.
* LayoutTests/navigation-api/navigation-object-is-replaceable.html: Added.
* Source/WebCore/page/DOMWindow.idl:

Canonical link: https://commits.webkit.org/301607@main
@nt1m
Copy link
Member

nt1m commented Oct 16, 2025

@annevk This is the commit that made it Replaceable: https://chromium-review.googlesource.com/c/chromium/src/+/3510372

Notably, window.navigation has to be [Replaceable], as otherwise various internal tests that do var navigation = ... start failing.

@annevk
Copy link
Member Author

annevk commented Oct 16, 2025

Thanks, looks like an oversight during early development. Maybe we should double check IDL going forward, especially for new global members.

@noamr
Copy link
Collaborator

noamr commented Oct 16, 2025

Thanks, looks like an oversight during early development. Maybe we should double check IDL going forward, especially for new global members.

Yea definitely. We will do what we can to minimize this type of oversight, especially around IDLs.

@gsnedders
Copy link
Member

I know there was some work a decade or so ago diffing Blink's IDL definitions to specs, which would've caught this. Don't know whether that still exists at all?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compat Standard is not web compatible or proprietary feature needs standardizing topic: navigation

Development

Successfully merging this pull request may close these issues.

5 participants