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 Feb 23, 2023
1 parent c336d40 commit 27b4215
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
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,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
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,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 27b4215

Please sign in to comment.