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

Support relative URLs #357

Merged
merged 1 commit into from
May 17, 2022
Merged

Support relative URLs #357

merged 1 commit into from
May 17, 2022

Conversation

danvk
Copy link
Contributor

@danvk danvk commented Jul 2, 2021

Fixes #312

This turns out not to be very deep: you have to pass an optional second parameter to the URL constructor to resolve relative URLs.

> new URL('/path/to/file#hashcode').pathnaem
VM252:1 Uncaught TypeError: Failed to construct 'URL': Invalid URL
    at <anonymous>:1:1
(anonymous) @ VM252:1
> new URL('/path/to/file#hashcode', 'http://example.com/').pathname
"/path/to/file"

YiniXu9506 referenced this pull request in YiniXu9506/speedscope Dec 6, 2021
@jlfwong jlfwong merged commit 63f3bc0 into jlfwong:main May 17, 2022
jackerghan pushed a commit to jackerghan/speedscope that referenced this pull request Jul 28, 2023
Fixes jlfwong#312 

This turns out not to be very deep: you have to pass an optional second parameter to the [`URL` constructor](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) to resolve relative URLs.

```
> new URL('/path/to/file#hashcode').pathnaem
VM252:1 Uncaught TypeError: Failed to construct 'URL': Invalid URL
    at <anonymous>:1:1
(anonymous) @ VM252:1
> new URL('/path/to/file#hashcode', 'http://example.com/').pathname
"/path/to/file"
```
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.

profileURL refers to the same host
2 participants