Skip to content

Commit ae143ed

Browse files
committed
Safari Technology Preview 226 breaks espn.com title bar
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
1 parent 5849cd2 commit ae143ed

File tree

4 files changed

+25
-2
lines changed

4 files changed

+25
-2
lines changed

LayoutTests/imported/w3c/web-platform-tests/interfaces/html.idl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1817,7 +1817,7 @@ interface Window : EventTarget {
18171817
attribute DOMString name;
18181818
[PutForwards=href, LegacyUnforgeable] readonly attribute Location location;
18191819
readonly attribute History history;
1820-
readonly attribute Navigation navigation;
1820+
[Replaceable] readonly attribute Navigation navigation;
18211821
readonly attribute CustomElementRegistry customElements;
18221822
[Replaceable] readonly attribute BarProp locationbar;
18231823
[Replaceable] readonly attribute BarProp menubar;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
This tests that the Navigation object is replaceable
2+
3+
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4+
5+
6+
PASS navigation is not "foo"
7+
PASS navigation is "foo"
8+
PASS successfullyParsed is true
9+
10+
TEST COMPLETE
11+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<script src="../resources/js-test.js"></script>
2+
3+
<script>
4+
description("This tests that the Navigation object is replaceable");
5+
6+
window.onload = () => {
7+
shouldNotBe("navigation", "\"foo\"");
8+
navigation = "foo";
9+
shouldBe("navigation", "\"foo\"");
10+
}
11+
12+
</script>

Source/WebCore/page/DOMWindow.idl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
[LegacyUnforgeable] readonly attribute Document document;
6767
attribute [AtomString] DOMString name;
6868
readonly attribute History history;
69-
[EnabledBySetting=NavigationAPIEnabled] readonly attribute Navigation navigation;
69+
[EnabledBySetting=NavigationAPIEnabled, Replaceable] readonly attribute Navigation navigation;
7070
[ImplementedAs=ensureCustomElementRegistry] readonly attribute CustomElementRegistry customElements;
7171
[Replaceable] readonly attribute BarProp locationbar;
7272
[Replaceable] readonly attribute BarProp menubar;

0 commit comments

Comments
 (0)