Commit graph

41 commits

Author SHA1 Message Date
Aliaksandr Kalenik
c437f16cc1 LibWeb: Early return navigation process if navigable has been destroyed
If a navigable has been destroyed during a navigation process, we
should early return from it. The introduced checks are not in
the spec because, as explained in
https://github.com/whatwg/html/issues/9690 the spec is not written
with such a level of detail.
2023-09-15 18:27:17 +02:00
Aliaksandr Kalenik
2445205e9d LibWeb: Align session history step application code with latest spec
Replaces direct "apply the history step" calls with new functions from
the spec:
- "update for navigable creation/destruction"
- "apply the push/replace history step"
- "apply the reload history step"
2023-09-15 18:27:17 +02:00
Aliaksandr Kalenik
799b465fac LibWeb: Compare urls excluding fragments in Navigable::navigate() 2023-09-15 18:27:17 +02:00
Aliaksandr Kalenik
fbc95440a4 LibWeb: Only return initialized navigables from child_navigables()
Fixes a crash in `get_session_history_entries()` that happens when
it attempts to find entries for a navigable that hasn't been fully
initialized and therefore doesn't have a nested history entry yet.
2023-09-15 18:27:17 +02:00
Aliaksandr Kalenik
15d265da65 LibWeb: Fix "stack-use-after-return" in navigate_to_a_fragmement()
Callback running on the session history queue should capture necessary
pointers by value instead of reference, because navigate_to_a_fragment
stack will have been destroyed by the time it will be executed.
2023-09-15 18:27:17 +02:00
Aliaksandr Kalenik
84139a10d2 LibWeb: Implement navigation to javascript: URLs for navigables
Implements following algorithms from the specification:
https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate-to-a-javascript:-url
https://html.spec.whatwg.org/multipage/browsing-the-web.html#evaluate-a-javascript:-url
2023-09-13 21:35:52 +02:00
Aliaksandr Kalenik
09013583f2 LibWeb: Add Navigable::set_ongoing_navigation() 2023-09-13 21:35:52 +02:00
Aliaksandr Kalenik
aa0d254fa3 LibWeb: Start fleshing out "URL and history update steps" 2023-09-13 21:35:52 +02:00
Shannon Booth
41928c2902 LibWeb: Port DOMException interface from DeprecatedString to String 2023-09-06 11:44:45 -04:00
Andrew Kaster
088af86c90 LibWeb: Implement Navigable::target_name() 2023-08-31 22:23:39 +01:00
Andrew Kaster
6cfe19e5be LibWeb: Update Navigable::navigate() to the current state of the spec
A few parameters and step renumberings have happened since we first
implemented this algorithm.
2023-08-29 09:39:57 +02:00
Andrew Kaster
d97b09693e LibWeb: Convert SandboxingFlagSet into a enum class
Instead of having a nested enum within a struct, use the macro
AK_ENUM_BITWISE_OPERATORS to add all the convienent has_flag free
functions and such for ease of use.
2023-08-29 09:39:57 +02:00
Andrew Kaster
03eae09619 LibWeb: Implement snapshotting source snapshot params per the spec 2023-08-28 09:47:11 +02:00
Andrew Kaster
34ea470d4f LibWeb: Add AO for navigation_must_be_a_replace to Navigable
This is used by both Navigable and Navigation, so let's put it in
Navigable. Also add a missing AK/String include to make clangd happier
with the Navigable file.
2023-08-25 19:51:13 +02:00
Aliaksandr Kalenik
48e9097aa4 LibWeb: Fix "stack-use-after-return" in "process_response" callback
Fixes stack-use-after-return bug found by ASAN that happens when
`response` reference captured by `process_response` is modified
after navigation has been canceled.
2023-08-23 19:49:26 +02:00
Aliaksandr Kalenik
c8271ac9e6 LibWeb: Start fleshing out "navigate to a fregment" for Navigables 2023-08-20 16:06:56 +02:00
Aliaksandr Kalenik
38c7703fe8 LibWeb: Add allowPOST param in populate_session_history_entry_document 2023-08-14 17:46:46 +02:00
Aliaksandr Kalenik
08788072c1 LibWeb: Add SessionHistoryTraversalQueue 2023-08-14 17:46:46 +02:00
Aliaksandr Kalenik
6d866dc5ba LibWeb: Take care of ongoing navigation in Navigable::navigate() 2023-08-14 17:46:46 +02:00
Shannon Booth
9d60f23abc AK: Port URL::m_fragment from DeprecatedString to String 2023-08-13 15:03:53 -06:00
Andreas Kling
406e3ed849 LibWeb: Implement getting the container document of a navigable
Co-authored-by: Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
2023-06-23 16:20:29 +02:00
Aliaksandr Kalenik
d85bdd3ac5 LibWeb: Add API for finding NavigableContainer by content navigable
This is only needed because currently spec doesn't explicitly define
that navigable should have a pointer to associated container and when
this pointer should be set.
2023-06-23 16:20:29 +02:00
Aliaksandr Kalenik
2cbc9a6642 LibWeb: Start fleshing out Navigable::choose_a_navigable()
Equivalent of `choose_a_browsing_context` for navigables.
2023-06-22 18:18:50 +02:00
Aliaksandr Kalenik
ffd5b3da16 LibWeb: Implement reload for navigables 2023-06-20 18:30:27 +02:00
Aliaksandr Kalenik
c90136d48d LibWeb: Start fleshing out "apply the history step" for traversables
Implements https://html.spec.whatwg.org/multipage/browsing-the-web.html#apply-the-history-step
2023-06-19 21:28:20 +02:00
Aliaksandr Kalenik
09cb266cb8 LibWeb: Implement "activate history entry" for navigables 2023-06-19 21:28:20 +02:00
Aliaksandr Kalenik
eb4db6057d LibWeb: Implement child_navigables() for navigables 2023-06-19 21:28:20 +02:00
Timothy Flynn
872e18f660 LibWeb: Convert Navigable::navigate's csp_navigation_type to an enum
Some versions of clang will have an issue using a consteval function to
set the optional parameter's default value. For example, see:
https://stackoverflow.com/questions/68789984/immediate-function-as-default-function-argument-initializer-in-clang

This doesn't need to be a String anyways, so let's make it an enum.
2023-05-08 20:54:31 -06:00
Aliaksandr Kalenik
5896f4c400 LibWeb: Implement "populate session history entry" step in navigate()
Implements
https://html.spec.whatwg.org/multipage/browsing-the-web.html#finalize-a-cross-document-navigation
2023-05-08 17:53:59 +02:00
Aliaksandr Kalenik
e1c1aaa956 LibWeb: Implement "create navigation params from a srcdoc resource"
Implements:
https://html.spec.whatwg.org/multipage/browsing-the-web.html#create-navigation-params-from-a-srcdoc-resource

This is supporting function for populating document in session history
entry.

This function populates navigation params response with HTML text
passed in document resource.
2023-05-03 09:39:49 +02:00
Aliaksandr Kalenik
c235ee380f LibWeb: Implement "create navigation params by fetching"
Implements:
https://html.spec.whatwg.org/multipage/browsing-the-web.html#create-navigation-params-by-fetching

This is supporting function for population of document in a session
history entry.

This function populates response in navigation params by fetching url
in navigation params and handling redirects if required.
2023-05-03 09:39:49 +02:00
Aliaksandr Kalenik
de2c016556 LibWeb: Implement "attempt to populate the history entry's document"
Implements:
https://html.spec.whatwg.org/multipage/browsing-the-web.html#attempt-to-populate-the-history-entry's-document

This is going to be a replacement for `FrameLoader::load()` after
switching to navigables.

Brief description of `populate_session_history_entry_document`:
- If navigation params have url with fetch scheme then DOM document
  will be populated by fetching url and parsing response. This
  is going to be a replacement for `FrameLoader::load(AK::URL&)`.
- If url in navigation params is abort:srcdoc then DOM document
  will be populated by parsing HTML text passed in document resource.
  This is going to be a replacement for `FrameLoader::load_html()`
2023-05-03 09:39:49 +02:00
Aliaksandr Kalenik
6ec88b36b9 LibWeb: Implement "get the target history entry" for navigables 2023-04-28 18:11:44 +02:00
Aliaksandr Kalenik
d9d8896380 LibWeb: Implement "get session history entries" for navigables
https://html.spec.whatwg.org/multipage/browsing-the-web.html#getting-session-history-entries
2023-04-28 18:11:44 +02:00
Aliaksandr Kalenik
c9c8f2413f LibWeb: Change Navigable::traversable_navigable() to be const 2023-04-28 18:11:44 +02:00
Aliaksandr Kalenik
9a19bdbfcf LibWeb: Implement Navigable::initialize_navigable() 2023-04-26 15:51:50 +02:00
Aliaksandr Kalenik
ce9d9a10b8 LibWeb: Start fleshing out Navigable::navigate()
Start implementation of https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate

Co-authored-by: Andreas Kling <kling@serenityos.org>
2023-04-25 12:54:01 +02:00
Andreas Kling
6e416284b9 LibWeb: Add API for finding Navigable with a given active document
This will be used to look up a document's node navigable. It might be
nice to have a direct pointer from Document to its Navigable, but at
the moment I don't understand the algorithms well enough to maintain
that linkage.
2023-04-23 15:41:05 +02:00
Andreas Kling
54e01824c7 LibWeb: Implement getting the top-level traversable of a navigable 2023-04-23 14:18:57 +02:00
Andreas Kling
05dc1da321 LibWeb: Implement getting the traversable navigable of a navigable 2023-04-23 14:18:57 +02:00
Andreas Kling
2d602dcb34 LibWeb: Add HTML::Navigable
This is the first step towards implementing the new "navigable" concept
from the HTML spec.

Co-authored-by: Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
2023-04-19 18:26:45 +02:00