-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Implement Missing Methods in URL Class to Handle Base URL and Relative Path Combinations #45055
base: main
Are you sure you want to change the base?
Implement Missing Methods in URL Class to Handle Base URL and Relative Path Combinations #45055
Conversation
Hi @sossost! Thank you for your pull request and welcome to our community. Action RequiredIn 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. ProcessIn 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 If you have received this in error or have any questions, please contact us at cla@meta.com. 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 |
@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 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 @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. |
https://github.com/sossost/react-native into feat/facebook#45030-finish-implementing-URL-accessors
hash: string, | ||
origin: string, | ||
} { | ||
const urlPattern = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does this regex come from?
At a quick glance, I know we should be more permissive in allowing schemes that are not just http.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NickGerleman Oh I almost missed that, I'm not good enough to see that, thanks for the advice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we getting this regex from a source, or trying to derive it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NickGerleman No, I didn't get this regex from a source. I derived it myself.
@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. |
Great 👍 Please ping me when you're ready |
@sossost Friendly ping. Any progress? Anything I can help? |
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: