Auto merge of #29455 - 2shiori17:issue-29425, r=mukilan

Implement URLSearchParams's size

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #29425

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
bors-servo 2023-03-02 06:21:24 +01:00 committed by GitHub
commit a516281d7d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 26 deletions

View file

@ -91,6 +91,11 @@ impl URLSearchParams {
}
impl URLSearchParamsMethods for URLSearchParams {
// https://url.spec.whatwg.org/#dom-urlsearchparams-size
fn Size(&self) -> u32 {
self.list.borrow().len() as u32
}
// https://url.spec.whatwg.org/#dom-urlsearchparams-append
fn Append(&self, name: USVString, value: USVString) {
// Step 1.

View file

@ -9,6 +9,7 @@
[Exposed=(Window,Worker)]
interface URLSearchParams {
[Throws] constructor(optional (sequence<sequence<USVString>> or record<USVString, USVString> or USVString) init = "");
readonly attribute unsigned long size;
undefined append(USVString name, USVString value);
undefined delete(USVString name);
USVString? get(USVString name);

View file

@ -1,26 +0,0 @@
[urlsearchparams-size.any.html]
[URLSearchParams's size and deletion]
expected: FAIL
[URLSearchParams's size and addition]
expected: FAIL
[URLSearchParams's size when obtained from a URL]
expected: FAIL
[URLSearchParams's size when obtained from a URL and using .search]
expected: FAIL
[urlsearchparams-size.any.worker.html]
[URLSearchParams's size and deletion]
expected: FAIL
[URLSearchParams's size and addition]
expected: FAIL
[URLSearchParams's size when obtained from a URL]
expected: FAIL
[URLSearchParams's size when obtained from a URL and using .search]
expected: FAIL