Skip to content

Commit

Permalink
chore: support relative URL
Browse files Browse the repository at this point in the history
  • Loading branch information
YiniXu9506 committed Dec 3, 2021
1 parent 213b9d7 commit 413a495
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/views/application.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -411,16 +411,17 @@ export class Application extends StatelessComponent<ApplicationProps> {
}

async maybeLoadHashParamProfile() {
if (this.props.hashParams.profileURL) {
const { profileURL } = this.props.hashParams
if (profileURL) {
if (!canUseXHR) {
alert(
`Cannot load a profile URL when loading from "${window.location.protocol}" URL protocol`,
)
return
}
this.loadProfile(async () => {
const response: Response = await fetch(this.props.hashParams.profileURL!)
let filename = new URL(this.props.hashParams.profileURL!).pathname
const response: Response = await fetch(profileURL)
let filename = new URL(profileURL, window.location.href).pathname
if (filename.includes('/')) {
filename = filename.slice(filename.lastIndexOf('/') + 1)
}
Expand Down

2 comments on commit 413a495

@breezewish
Copy link

Choose a reason for hiding this comment

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

I think this can contribute to the upstream as well. It can be really helpful when speedscope's release file is used elsewhere.

@YiniXu9506
Copy link
Owner

@YiniXu9506 YiniXu9506 commented on 413a495 Dec 6, 2021

Choose a reason for hiding this comment

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

I think this can contribute to the upstream as well. It can be really helpful when speedscope's release file is used elsewhere.

Actually, this improvement has been raised and contributed to upstream, but still not been approved. Details can see here.

Please sign in to comment.