mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-02 22:30:31 +00:00
LibWeb: Return OptionalNone from DOMURL::parse on failure
This ports one more function away from needing to use the awkward valid state of the URL class.
This commit is contained in:
parent
b81d6945dc
commit
fd27eef0d1
Notes:
github-actions[bot]
2025-01-22 12:34:57 +00:00
Author: https://github.com/shannonbooth
Commit: fd27eef0d1
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3339
Reviewed-by: https://github.com/AtkinsSJ ✅
18 changed files with 63 additions and 65 deletions
|
@ -302,7 +302,7 @@ static void update(JS::VM& vm, GC::Ref<Job> job)
|
|||
auto resolved_scope = DOMURL::parse("./"sv, job->script_url);
|
||||
|
||||
// 2. Set maxScopeString to "/", followed by the strings in resolvedScope’s path (including empty strings), separated from each other by "/".
|
||||
max_scope_string = join_paths_with_slash(resolved_scope);
|
||||
max_scope_string = join_paths_with_slash(*resolved_scope);
|
||||
}
|
||||
// 14. Else:
|
||||
else {
|
||||
|
@ -310,9 +310,9 @@ static void update(JS::VM& vm, GC::Ref<Job> job)
|
|||
auto max_scope = DOMURL::parse(service_worker_allowed.get<Vector<ByteBuffer>>()[0], job->script_url);
|
||||
|
||||
// 2. If maxScope’s origin is job’s script url's origin, then:
|
||||
if (max_scope.origin().is_same_origin(job->script_url.origin())) {
|
||||
if (max_scope->origin().is_same_origin(job->script_url.origin())) {
|
||||
// 1. Set maxScopeString to "/", followed by the strings in maxScope’s path (including empty strings), separated from each other by "/".
|
||||
max_scope_string = join_paths_with_slash(max_scope);
|
||||
max_scope_string = join_paths_with_slash(*max_scope);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue