LibWeb: Add NullOrError to NavigationParamsVariant

To check whether a NavigationParams is null, we have to check whether
it's `Empty` or `NullWithError`. Instead, we can merge both of these
possible variants into an optional error. If `NullOrError` has no
value it's null, otherwise it contains an error message.
This commit is contained in:
Daniel La Rocque
2024-11-13 19:08:01 -05:00
committed by Andrew Kaster
parent 5deb2b4cad
commit e43e4d3a93
3 changed files with 14 additions and 14 deletions

View File

@@ -54,8 +54,8 @@ class Navigable : public JS::Cell {
public:
virtual ~Navigable() override;
using NullWithError = StringView;
using NavigationParamsVariant = Variant<Empty, NullWithError, GC::Ref<NavigationParams>, GC::Ref<NonFetchSchemeNavigationParams>>;
using NullOrError = Optional<StringView>;
using NavigationParamsVariant = Variant<NullOrError, GC::Ref<NavigationParams>, GC::Ref<NonFetchSchemeNavigationParams>>;
ErrorOr<void> initialize_navigable(GC::Ref<DocumentState> document_state, GC::Ptr<Navigable> parent);
@@ -132,7 +132,7 @@ public:
SourceSnapshotParams const& source_snapshot_params,
TargetSnapshotParams const& target_snapshot_params,
Optional<String> navigation_id = {},
NavigationParamsVariant navigation_params = Empty {},
NavigationParamsVariant navigation_params = Navigable::NullOrError {},
CSPNavigationType csp_navigation_type = CSPNavigationType::Other,
bool allow_POST = false,
GC::Ptr<GC::Function<void()>> completion_steps = {});