-
Notifications
You must be signed in to change notification settings - Fork 340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use ada-url's url_pattern implementation #3529
base: main
Are you sure you want to change the base?
Conversation
The generated output of Full Type Diffdiff -r bazel-bin/types/definitions/2021-11-03/index.d.ts types/generated-snapshot/2021-11-03/index.d.ts
2639d2638
< get hasRegExpGroups(): boolean;
diff -r bazel-bin/types/definitions/2021-11-03/index.ts types/generated-snapshot/2021-11-03/index.ts
2651d2650
< get hasRegExpGroups(): boolean;
diff -r bazel-bin/types/definitions/2022-01-31/index.d.ts types/generated-snapshot/2022-01-31/index.d.ts
2665d2664
< get hasRegExpGroups(): boolean;
diff -r bazel-bin/types/definitions/2022-01-31/index.ts types/generated-snapshot/2022-01-31/index.ts
2677d2676
< get hasRegExpGroups(): boolean;
diff -r bazel-bin/types/definitions/2022-03-21/index.d.ts types/generated-snapshot/2022-03-21/index.d.ts
2683d2682
< get hasRegExpGroups(): boolean;
diff -r bazel-bin/types/definitions/2022-03-21/index.ts types/generated-snapshot/2022-03-21/index.ts
2695d2694
< get hasRegExpGroups(): boolean;
diff -r bazel-bin/types/definitions/2022-08-04/index.d.ts types/generated-snapshot/2022-08-04/index.d.ts
2684d2683
< get hasRegExpGroups(): boolean;
diff -r bazel-bin/types/definitions/2022-08-04/index.ts types/generated-snapshot/2022-08-04/index.ts
2696d2695
< get hasRegExpGroups(): boolean;
diff -r bazel-bin/types/definitions/2022-10-31/index.d.ts types/generated-snapshot/2022-10-31/index.d.ts
2687d2686
< get hasRegExpGroups(): boolean;
diff -r bazel-bin/types/definitions/2022-10-31/index.ts types/generated-snapshot/2022-10-31/index.ts
2699d2698
< get hasRegExpGroups(): boolean;
diff -r bazel-bin/types/definitions/2022-11-30/index.d.ts types/generated-snapshot/2022-11-30/index.d.ts
2692d2691
< get hasRegExpGroups(): boolean;
diff -r bazel-bin/types/definitions/2022-11-30/index.ts types/generated-snapshot/2022-11-30/index.ts
2704d2703
< get hasRegExpGroups(): boolean;
diff -r bazel-bin/types/definitions/2023-03-01/index.d.ts types/generated-snapshot/2023-03-01/index.d.ts
2694d2693
< get hasRegExpGroups(): boolean;
diff -r bazel-bin/types/definitions/2023-03-01/index.ts types/generated-snapshot/2023-03-01/index.ts
2706d2705
< get hasRegExpGroups(): boolean;
diff -r bazel-bin/types/definitions/2023-07-01/index.d.ts types/generated-snapshot/2023-07-01/index.d.ts
2694d2693
< get hasRegExpGroups(): boolean;
diff -r bazel-bin/types/definitions/2023-07-01/index.ts types/generated-snapshot/2023-07-01/index.ts
2706d2705
< get hasRegExpGroups(): boolean;
diff -r bazel-bin/types/definitions/experimental/index.d.ts types/generated-snapshot/experimental/index.d.ts
2766d2765
< get hasRegExpGroups(): boolean;
diff -r bazel-bin/types/definitions/experimental/index.ts types/generated-snapshot/experimental/index.ts
2778d2777
< get hasRegExpGroups(): boolean;
diff -r bazel-bin/types/definitions/oldest/index.d.ts types/generated-snapshot/oldest/index.d.ts
2639d2638
< get hasRegExpGroups(): boolean;
diff -r bazel-bin/types/definitions/oldest/index.ts types/generated-snapshot/oldest/index.ts
2651d2650
< get hasRegExpGroups(): boolean; |
d75b95c
to
5764de6
Compare
449ffb5
to
e2ea03b
Compare
69d0045
to
7b67ff7
Compare
7b67ff7
to
16322b2
Compare
Other than putting this behind a flag like @jasnell recommended, this is ready to review. |
expectedFailures: [ | ||
// Each of these *ought* to pass. They are included here because we |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume that this comment is no longer needed since the tests themselves are invalid here.
@@ -4,8 +4,12 @@ | |||
|
|||
#pragma once | |||
|
|||
#include "ada.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per KJ style, this should be <ada.h> (some people on the team have strong opinions about this).
@@ -249,6 +249,7 @@ wd_cc_library( | |||
kj_test( | |||
src = f, | |||
deps = [ | |||
":urlpattern", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no such target; it should be worthwhile to create one by isolating it from io as noted in the TODO at the top of this file. It is not necessary to do so in this PR though as doing so may require downstream changes. Furthermore, urlpattern.h is not used by any of these tests (it is needed for api-rtti-test so it would be correct to add it there).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created urlpattern target on a different PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It exists: #3546
@@ -21,7 +21,7 @@ build *args="//...": | |||
bazel build {{args}} | |||
|
|||
build-asan *args="//...": | |||
just build {{args}} --config=asan --sandbox_debug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes to this file are already in #3551, let's avoid duplicating them here
#include <workerd/jsg/url.h> | ||
|
||
#include <optional> | ||
#include <string_view> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#include <string_view> | |
#include <kj/array.h> | |
#include <kj/one-of.h> | |
#include <kj/string.h> | |
#include <string> | |
#include <string_view> | |
#include <utility> // For std::move | |
#include <vector> |
For include-what-you-use reasons.
ada::url_pattern_options options{}; | ||
options.ignore_case = ignoreCase.orDefault(false); | ||
return options; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ada::url_pattern_options options{}; | |
options.ignore_case = ignoreCase.orDefault(false); | |
return options; | |
return {.ignore_case = ignoreCase.orDefault(false)}; |
jsg::Lock& js = jsg::Lock::from(v8::Isolate::GetCurrent()); | ||
KJ_IF_SOME(matches, pattern.getHandle(js)(js, kj::StringPtr(input.data(), input.size()))) { | ||
std::vector<std::optional<std::string>> results; | ||
results.reserve(matches.size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we are reserving one more slot than we need here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes but adding -1 adds a branch (checking if size is bigger than 0), which reduces the impact of this optimization
} | ||
|
||
#define V(uppercase, lowercase) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code like this is clearer if you give V a meaningful name like DEFINE_GETTER.
Since we moved URLPattern implementation to Ada and shared it with Node.js, we can now use it as a dependency and get rid of our implementation. This will allow us to have higher compatibility with the web-platform tests and spec, and reduce our codebase by 3800 lines...
Additionally with the help of @npaun, we now run web-platform tests and can get rid of our custom URLPattern tests for better web compatibility and maintenance, since WPT is always changing!