mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-24 09:52:31 +00:00
LibURL/Pattern: Complete the implementation of the constructor
This commit is contained in:
parent
c9e6ad562c
commit
e35555f00e
Notes:
github-actions[bot]
2025-04-06 12:27:22 +00:00
Author: https://github.com/shannonbooth
Commit: e35555f00e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3847
Reviewed-by: https://github.com/trflynn89
4 changed files with 208 additions and 135 deletions
|
@ -8,9 +8,28 @@
|
|||
#include <LibURL/Pattern/Component.h>
|
||||
#include <LibURL/Pattern/PatternParser.h>
|
||||
#include <LibURL/Pattern/String.h>
|
||||
#include <LibURL/URL.h>
|
||||
|
||||
namespace URL::Pattern {
|
||||
|
||||
// https://urlpattern.spec.whatwg.org/#protocol-component-matches-a-special-scheme
|
||||
bool protocol_component_matches_a_special_scheme(Component const& protocol_component)
|
||||
{
|
||||
// 1. Let special scheme list be a list populated with all of the special schemes.
|
||||
// 2. For each scheme of special scheme list:
|
||||
for (StringView scheme : special_schemes()) {
|
||||
// 1. Let test result be RegExpBuiltinExec(protocol component’s regular expression, scheme).
|
||||
auto test_result = protocol_component.regular_expression->match(scheme);
|
||||
|
||||
// 2. If test result is not null, then return true.
|
||||
if (test_result.success)
|
||||
return true;
|
||||
}
|
||||
|
||||
// 3. Return false.
|
||||
return false;
|
||||
}
|
||||
|
||||
// https://urlpattern.spec.whatwg.org/#generate-a-regular-expression-and-name-list
|
||||
struct RegularExpressionAndNameList {
|
||||
String regular_expression;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue