Implement Missing Methods in URL Class to Handle Base URL and Relative Path Combinations
Summary:
close #45030
The window.URL object is available in Hermes but was previously unimplemented, with all accessors throwing TODO Errors. This pull request implements the missing methods to ensure correct handling of base URLs and relative paths.
Changelog:
[ANDROID] [FIXED] - Implemented missing methods in the URL class to handle base URL and relative path combinations.
Test Plan:
Hi @sossost!
Thank you for your pull request and welcome to our community.
Action Required
In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.
Process
In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.
Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.
If you have received this in error or have any questions, please contact us at [email protected]. Thanks!
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!
Thanks for sneding this over @sossost Can we make the CI green before we can review/import this?
@cortinico oh! sorry I've updated the CI to green.
@cortinico has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
The parsing behavior of URL global is pretty decently specced out: E.g. https://url.spec.whatwg.org/#concept-basic-url-parser
The reference implementation is pretty different from how functions are implemented in this PR. At a glance, I can see we're doing a lot of splitting, and regexing against specific patterns. Spec seems to rely on a lot more context.
One of the core differences, is that, we parse during construction (I see we already have a validation step), and the parsing steps themselves will determine the value for different URL fields. So, we don't do separate string manipulation when trying to access a URL field. We have already set these during parsing.
@sossost would it be possible to base the implementation of these new fields, derived from behavior prescribed in parsing spec?
@NickGerleman I'll take a look at that and fix it, thanks for the nice feedback.
@sossost can you make the CI green before we can import/merge this one?
I apologize. I have some additional fixes to make, but I've been so busy I haven't had time to work on them. I'll update them soon, thank you.
I apologize. I have some additional fixes to make, but I've been so busy I haven't had time to work on them. I'll update them soon, thank you.
Great 👍 Please ping me when you're ready
@sossost Friendly ping.
Any progress? Anything I can help?
Hi Guys any updates ? @sossost ?
This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This PR was closed because it has been stalled for 7 days with no activity.