Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 99285ff92cc38dad904802141efe17f2885ba157
https://github.com/WebKit/WebKit/commit/99285ff92cc38dad904802141efe17f2885ba157
Author: Ahmad Saleem <[email protected]>
Date: 2026-08-11 (Tue, 11 Aug 2026)
Changed paths:
M
LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigation-history-entry/entry-after-detach-expected.txt
M Source/WebCore/page/NavigationHistoryEntry.cpp
Log Message:
-----------
NavigationHistoryEntry url/key/id should return the empty string, not null,
when the document is not fully active
https://bugs.webkit.org/show_bug.cgi?id=321494
rdar://184590003
Reviewed by Rupin Mittal.
Each of the url [1], key [2] and ID [3] concepts opens with the same step:
If ... Document is not fully active, then return the empty string.
All three returned nullString() instead. Return emptyString() from each.
For url this is web-facing. It is declared `USVString?` [4], so a null String
marshals to JS null while an empty String marshals to "", and an entry whose
document had been detached reported `null` where "" is required.
key and ID are declared `DOMString`, and jsStringWithCache() maps any
zero-length
String - null included - onto jsEmptyString(), so those two already reached
script
as "". The distinction is not observable internally either: key()'s only callers
go through Navigation::entryIndexOfKey(), which rejects the lookup with
isEmpty()
before comparing anything, and that covers null and empty alike. So there is
nothing separately testable for them; entry-after-detach.html already asserts
key
and id are "" after detach and already passed those two assertions. Fix them
anyway, so the getters say what the spec says instead of leaning on a
binding-layer coincidence.
The index concept [5] already returned -1 as required and is unchanged. Cite the
spec algorithm inline in all four getters while here.
[1] https://html.spec.whatwg.org/#dom-navigationhistoryentry-url
[2] https://html.spec.whatwg.org/#concept-navigationhistoryentry-key
[3] https://html.spec.whatwg.org/#concept-navigationhistoryentry-id
[4] https://html.spec.whatwg.org/#the-navigationhistoryentry-interface
[5] https://html.spec.whatwg.org/#concept-navigationhistoryentry-index
*
LayoutTests/imported/w3c/web-platform-tests/navigation-api/navigation-history-entry/entry-after-detach-expected.txt:
Progression
* Source/WebCore/page/NavigationHistoryEntry.cpp:
(WebCore::NavigationHistoryEntry::url const):
(WebCore::NavigationHistoryEntry::key const):
(WebCore::NavigationHistoryEntry::id const):
(WebCore::NavigationHistoryEntry::index const):
Canonical link: https://commits.webkit.org/319007@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications