LibWeb: Add allowPOST param in populate_session_history_entry_document
This commit is contained in:
parent
b05bd889e1
commit
38c7703fe8
Notes:
sideshowbarker
2024-07-17 18:23:22 +09:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/SerenityOS/serenity/commit/38c7703fe8 Pull-request: https://github.com/SerenityOS/serenity/pull/20575
3 changed files with 8 additions and 7 deletions
|
@ -649,7 +649,7 @@ static WebIDL::ExceptionOr<Optional<NavigationParams>> create_navigation_params_
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#attempt-to-populate-the-history-entry's-document
|
||||
WebIDL::ExceptionOr<void> Navigable::populate_session_history_entry_document(JS::GCPtr<SessionHistoryEntry> entry, Optional<NavigationParams> navigation_params, Optional<String> navigation_id, SourceSnapshotParams const& source_snapshot_params, Function<void()> completion_steps)
|
||||
WebIDL::ExceptionOr<void> Navigable::populate_session_history_entry_document(JS::GCPtr<SessionHistoryEntry> entry, Optional<NavigationParams> navigation_params, Optional<String> navigation_id, SourceSnapshotParams const& source_snapshot_params, bool allow_POST, Function<void()> completion_steps)
|
||||
{
|
||||
// FIXME: 1. Assert: this is running in parallel.
|
||||
|
||||
|
@ -673,8 +673,8 @@ WebIDL::ExceptionOr<void> Navigable::populate_session_history_entry_document(JS:
|
|||
}
|
||||
// 2. Otherwise, if both of the following are true:
|
||||
// - entry's URL's scheme is a fetch scheme; and
|
||||
// - documentResource is null, FIXME: or allowPOST is true and documentResource's request body is not failure
|
||||
else if (Fetch::Infrastructure::is_fetch_scheme(entry->url.scheme()) && document_resource.has<Empty>()) {
|
||||
// - documentResource is null, or allowPOST is true and documentResource's request body is not failure (FIXME: check if request body is not failure)
|
||||
else if (Fetch::Infrastructure::is_fetch_scheme(entry->url.scheme()) && (document_resource.has<Empty>() || allow_POST)) {
|
||||
navigation_params = create_navigation_params_by_fetching(entry, this, source_snapshot_params, navigation_id).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
// FIXME: 3. Otherwise, if entry's URL's scheme is not a fetch scheme, then set navigationParams to a new non-fetch scheme navigation params, with
|
||||
|
@ -939,7 +939,7 @@ WebIDL::ExceptionOr<void> Navigable::navigate(
|
|||
// for historyEntry, given navigable, "navigate", sourceSnapshotParams,
|
||||
// targetSnapshotParams, navigationId, navigationParams, cspNavigationType, with allowPOST
|
||||
// set to true and completionSteps set to the following step:
|
||||
populate_session_history_entry_document(history_entry, navigation_params, navigation_id, source_snapshot_params, [this, history_entry, history_handling, navigation_id] {
|
||||
populate_session_history_entry_document(history_entry, navigation_params, navigation_id, source_snapshot_params, true, [this, history_entry, history_handling, navigation_id] {
|
||||
traversable_navigable()->append_session_history_traversal_steps([this, history_entry, history_handling, navigation_id] {
|
||||
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#finalize-a-cross-document-navigation
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ public:
|
|||
|
||||
Variant<Empty, Traversal, String> ongoing_navigation() const { return m_ongoing_navigation; }
|
||||
|
||||
WebIDL::ExceptionOr<void> populate_session_history_entry_document(JS::GCPtr<SessionHistoryEntry>, Optional<NavigationParams>, Optional<String> navigation_id, SourceSnapshotParams const&, Function<void()>);
|
||||
WebIDL::ExceptionOr<void> populate_session_history_entry_document(JS::GCPtr<SessionHistoryEntry>, Optional<NavigationParams>, Optional<String> navigation_id, SourceSnapshotParams const&, bool allow_POST, Function<void()>);
|
||||
|
||||
WebIDL::ExceptionOr<void> navigate(
|
||||
AK::URL const&,
|
||||
|
|
|
@ -341,12 +341,13 @@ void TraversableNavigable::apply_the_history_step(int step, Optional<SourceSnaps
|
|||
// 5. Set targetEntry's document state's reload pending to false.
|
||||
target_entry->document_state->set_reload_pending(false);
|
||||
|
||||
// FIXME: 6. Let allowPOST be targetEntry's document state's reload pending.
|
||||
// 6. Let allowPOST be targetEntry's document state's reload pending.
|
||||
auto allow_POST = target_entry->document_state->reload_pending();
|
||||
|
||||
// 7. In parallel, attempt to populate the history entry's document for targetEntry, given navigable, potentiallyTargetSpecificSourceSnapshotParams,
|
||||
// targetSnapshotParams, with allowPOST set to allowPOST and completionSteps set to queue a global task on the navigation and traversal task source given
|
||||
// navigable's active window to run afterDocumentPopulated.
|
||||
navigable->populate_session_history_entry_document(target_entry, {}, {}, *potentially_target_specific_source_snapshot_params, [this, after_document_populated]() mutable {
|
||||
navigable->populate_session_history_entry_document(target_entry, {}, {}, *potentially_target_specific_source_snapshot_params, allow_POST, [this, after_document_populated]() mutable {
|
||||
queue_global_task(Task::Source::NavigationAndTraversal, *active_window(), [after_document_populated]() mutable {
|
||||
after_document_populated();
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue