react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Implement Missing Methods in URL Class to Handle Base URL and Relative Path Combinations

Open sossost opened this issue 1 year ago • 10 comments

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:

sossost avatar Jun 19 '24 01:06 sossost

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!

facebook-github-bot avatar Jun 19 '24 01:06 facebook-github-bot

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

facebook-github-bot avatar Jun 19 '24 02:06 facebook-github-bot

Thanks for sneding this over @sossost Can we make the CI green before we can review/import this?

cortinico avatar Jun 19 '24 19:06 cortinico

@cortinico oh! sorry I've updated the CI to green.

sossost avatar Jun 19 '24 23:06 sossost

@cortinico has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot avatar Jun 20 '24 12:06 facebook-github-bot

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 avatar Jun 24 '24 15:06 NickGerleman

@NickGerleman I'll take a look at that and fix it, thanks for the nice feedback.

sossost avatar Jun 25 '24 10:06 sossost

@sossost can you make the CI green before we can import/merge this one?

cortinico avatar Jul 04 '24 13:07 cortinico

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.

sossost avatar Jul 04 '24 13:07 sossost

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

cortinico avatar Jul 05 '24 07:07 cortinico

@sossost Friendly ping.

Any progress? Anything I can help?

migueldaipre avatar Oct 15 '24 21:10 migueldaipre

Hi Guys any updates ? @sossost ?

ashxjs avatar Nov 20 '24 10:11 ashxjs

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.

react-native-bot avatar Aug 14 '25 05:08 react-native-bot

This PR was closed because it has been stalled for 7 days with no activity.

react-native-bot avatar Aug 21 '25 05:08 react-native-bot