Skip to content
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

feat(llrt_core): update URL/URLSearchParams to pass more web-platform-tests #447

Merged
merged 22 commits into from
Jul 9, 2024

Conversation

stephencroberts
Copy link
Contributor

@stephencroberts stephencroberts commented Jul 1, 2024

Issue

#437

Description of changes

Updates the URL and URLSearchParams classes to pass a majority of the web-platform-tests.

  • Adds the web-platform-tests test harness
  • Adds web-platform-tests for url
  • Updates URL and URLSearchParams to pass most tests (using Url crate quirks), removing failing tests until the underlying issues in the Url crate are addressed

Design

The Url crate is mostly compliant with the WHATWG URL standard except for a number of test cases around file URLs, Windows edge cases, and a few other scattered edge cases, and they have an undocumented quirks module that provides compatibility with web standards for URL. To make it easy to leverage those features, and to avoid any derived state, both URL and URLSearchParams operate on a shared Url instance, effectively providing wrapper code around the Rust crate. This requires shared ownership of a Url with interior mutability and a little overhead with managing search params, but I think the benefits are worth it.

Reviewing

web-platform-tests was added as a git subtree with all files removed except the ones currently needed, and several of the files have been modified for what's currently supported by URL and URLSearchParams. It may be easier to look at commit diffs (ignoring the squash and merge commits of the subtree) than looking at the entire diff at once, at least to understand what's been changed about the web-platform tests.

Checklist

  • Created unit tests in tests/unit and/or in Rust for my feature if needed
  • Ran make fix to format JS and apply Clippy auto fixes
  • Made sure my code didn't add any additional warnings: make check
  • Updated documentation if needed (API.md/README.md/Other)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

git-subtree-dir: tests/unit/web-platform-tests
git-subtree-split: 39b61c36c99798acd2dddca5af76366f3ee7a36d
web-platform-tests contains a huge amount of files but we're only using a handful so let's not carry around the extra baggage
* origin/main:
  chore(deps-dev): bump the aws-cdk group with 2 updates (awslabs#444)
  chore(deps): bump quick-xml from 0.33.0 to 0.35.0 (awslabs#440)
  chore(deps): bump uuid from 1.9.0 to 1.9.1 (awslabs#441)
  chore(deps): bump aws-sdk from 2.1644.0 to 2.1651.0 (awslabs#446)
  chore(deps-dev): bump typescript from 5.4.5 to 5.5.2 (awslabs#445)
  Fix: Removed several module offerings (awslabs#439)
  feat: Implement of EventTarget (awslabs#436)
… null

Both `clearTimeout` and `clearInterval` may be called with `null` (or any other value for that matter) which should be a no-op and return `undefined` rather than throwing an exception.
…-tests

- Add the web-platformtests harness
- Add web-platformtests for url
- Update URL and URLSearchParams to pass mosts tests (using Url crate `quirks`), removing failing tests until the underlying issues in the Url crate are addressed
…e2b0119b

12e2b0119b [anchor] De-function <inset-area> within position-try-options
82f4f7d37c Correctly reject promise if failed to normalize algorithm
1edcc69f08 [WebDriverBiDi] Use JSON.stringify with fetch (#46892)
6a39784534 URL: add NFC normalization tests to toascii.json
e8e62a51e8 Sync interfaces/ with @webref/idl 3.49.0 (#46729)
d0e361adef compute pressure: Add WebPressureManager to Blink
bf631b23b6 Bump docker/build-push-action from 5.4.0 to 6.1.0
0971d237c3 Fix input type for forward delete input event
67f02dca27 [wptrunner] add "--enable-features=WebMachineLearningNeuralNetwork" (#46891)
74798b941e webnn: update validation_tests to use opSupportLimits
c267e5afc9 WebKit export of https://bugs.webkit.org/show_bug.cgi?id=275994 (#46944)
abbe205166 WebKit export of https://bugs.webkit.org/show_bug.cgi?id=275993 (#46932)
639fa53694 Add support for AV1 to the MP4 muxer for MediaRecorde
591117c249 Fix content property tests in css/css-page/margin-boxes/ for Mac.
f92d716815 Page margin at-rule CSSOM support.
e4cf05764e serve: Fix exception in logger usage
0f5db42262 Fix various issues with :nth-child(... of S) invalidation.
20963ceaa9 Trim leading letter-spacing at start of line.
c6273f7c68 Move tests to match the spec's move
b2dab79f18 IDB WPTs: Extend IDBCursor continue() index WPTs to run on workers
d8da9d4d1d Add support for data: blob: and blank to remote-content-helper. (#46893)
34c06943c2 Make SVG paths respect zoom.
bc3e8ae808 Remove `httpRequestStatusCode` from test (#46874)

git-subtree-dir: tests/unit/web-platform-tests
git-subtree-split: 12e2b0119b769644c621b10bb953d4d47f299850
…twg-url

* commit 'cef238d07ccdaf8663aa7ee4d9bc6a9fbc0269e0':
  Squashed 'tests/unit/web-platform-tests/' changes from 39b61c36c9..12e2b0119b
@stephencroberts stephencroberts marked this pull request as draft July 1, 2024 21:22
Copy link
Contributor

@richarddavison richarddavison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, thank you! 🎉 Most of the suggested edits are minor details, should be good to merge after.

llrt_core/src/modules/http/url.rs Outdated Show resolved Hide resolved
llrt_core/src/modules/http/url.rs Show resolved Hide resolved
llrt_core/src/modules/http/url.rs Show resolved Hide resolved
llrt_core/src/modules/http/url.rs Show resolved Hide resolved
llrt_core/src/modules/http/url.rs Show resolved Hide resolved
llrt_core/src/modules/http/url.rs Show resolved Hide resolved
llrt_core/src/modules/http/url.rs Show resolved Hide resolved
llrt_core/src/modules/http/url.rs Outdated Show resolved Hide resolved
llrt_core/src/modules/http/url.rs Show resolved Hide resolved
llrt_core/src/modules/http/url.rs Outdated Show resolved Hide resolved
@stephencroberts
Copy link
Contributor Author

@richarddavison Thanks so much for the review! I've added a few commits to:

  • revert auto-formatting on the web-platform-tests js files to avoid future merge conflicts
  • fix an issue with reporting test feedback for wpt synchronous tests
  • address some of your feedback

@stephencroberts stephencroberts marked this pull request as ready for review July 2, 2024 16:31
@stephencroberts stephencroberts mentioned this pull request Jul 8, 2024
Copy link
Contributor

@richarddavison richarddavison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost ready. Just some final questions then should be ready ! 👌

llrt_core/src/modules/http/url.rs Outdated Show resolved Hide resolved
llrt_core/src/modules/http/url_search_params.rs Outdated Show resolved Hide resolved
@richarddavison richarddavison merged commit 99d2f70 into awslabs:main Jul 9, 2024
5 checks passed
@stephencroberts stephencroberts deleted the feat/whatwg-url branch July 24, 2024 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants