diff --git a/Tests/LibWeb/Text/expected/HTML/Navigation-object-properties.txt b/Tests/LibWeb/Text/expected/HTML/Navigation-object-properties.txt new file mode 100644 index 0000000000..364ff8ecae --- /dev/null +++ b/Tests/LibWeb/Text/expected/HTML/Navigation-object-properties.txt @@ -0,0 +1,5 @@ +entries is empty: true +currentEntry is null: true +transition is null: true +canGoBack: false +canGoForward: false diff --git a/Tests/LibWeb/Text/input/HTML/Navigation-object-properties.html b/Tests/LibWeb/Text/input/HTML/Navigation-object-properties.html new file mode 100644 index 0000000000..e037fa2ac6 --- /dev/null +++ b/Tests/LibWeb/Text/input/HTML/Navigation-object-properties.html @@ -0,0 +1,15 @@ + + diff --git a/Userland/Libraries/LibWeb/HTML/Navigation.cpp b/Userland/Libraries/LibWeb/HTML/Navigation.cpp index d0ac6aab45..41b80c8da0 100644 --- a/Userland/Libraries/LibWeb/HTML/Navigation.cpp +++ b/Userland/Libraries/LibWeb/HTML/Navigation.cpp @@ -105,8 +105,10 @@ JS::GCPtr Navigation::current_entry() const if (has_entries_and_events_disabled()) return nullptr; - // 2. Assert: navigation's current entry index is not −1. - VERIFY(m_current_entry_index != -1); + // FIXME 2. Assert: navigation's current entry index is not −1. + // FIXME: This should not happen once Navigable's algorithms properly set up NHEs. + if (m_current_entry_index == -1) + return nullptr; // 3. Return navigation's entry list[navigation's current entry index]. return m_entry_list[m_current_entry_index]; @@ -149,8 +151,10 @@ bool Navigation::can_go_back() const if (has_entries_and_events_disabled()) return false; - // 2. Assert: this's current entry index is not −1. - VERIFY(m_current_entry_index != -1); + // FIXME 2. Assert: navigation's current entry index is not −1. + // FIXME: This should not happen once Navigable's algorithms properly set up NHEs. + if (m_current_entry_index == -1) + return false; // 3. If this's current entry index is 0, then return false. // 4. Return true. @@ -166,8 +170,10 @@ bool Navigation::can_go_forward() const if (has_entries_and_events_disabled()) return false; - // 2. Assert: this's current entry index is not −1. - VERIFY(m_current_entry_index != -1); + // FIXME 2. Assert: navigation's current entry index is not −1. + // FIXME: This should not happen once Navigable's algorithms properly set up NHEs. + if (m_current_entry_index == -1) + return false; // 3. If this's current entry index is equal to this's entry list's size, then return false. // 4. Return true.