Skip to content

Commit

Permalink
Implement URLSearchParams size getter
Browse files Browse the repository at this point in the history
In preparation for whatwg/url#734

(this shouldn't land until that spec change lands)
  • Loading branch information
jasnell committed Jan 22, 2023
1 parent fe84260 commit 90b39f2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/workerd/api/url-standard.h
Expand Up @@ -126,7 +126,10 @@ class URLSearchParams: public jsg::Object {

jsg::UsvString toString();

inline uint getSize() { return list.size(); }

JSG_RESOURCE_TYPE(URLSearchParams) {
JSG_READONLY_PROTOTYPE_PROPERTY(size, getSize);
JSG_METHOD(append);
JSG_METHOD_NAMED(delete, delete_);
JSG_METHOD(get);
Expand Down
3 changes: 3 additions & 0 deletions src/workerd/api/url.h
Expand Up @@ -174,7 +174,10 @@ class URLSearchParams: public jsg::Object {

kj::String toString();

inline uint getSize() { return url->query.size(); }

JSG_RESOURCE_TYPE(URLSearchParams, CompatibilityFlags::Reader flags) {
JSG_READONLY_PROTOTYPE_PROPERTY(size, getSize);
JSG_METHOD(append);
JSG_METHOD_NAMED(delete, delete_);
JSG_METHOD(get);
Expand Down

0 comments on commit 90b39f2

Please sign in to comment.