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

Failing to parse a URL in the UWP app causes a panic #24589

Closed
jdm opened this issue Oct 30, 2019 · 3 comments
Closed

Failing to parse a URL in the UWP app causes a panic #24589

jdm opened this issue Oct 30, 2019 · 3 comments

Comments

@jdm
Copy link
Member

@jdm jdm commented Oct 30, 2019

Try to load an invalid URL in the UWP app and watch it panic. We should pop up an alert dialog or something, but it should really be ignored rather than bring down the browser.

@jdm jdm added this to To do in UWP port via automation Oct 30, 2019
@paulrouget
Copy link
Contributor

@paulrouget paulrouget commented Oct 31, 2019

I can't reproduce. An invalid URL should load duckduckgo or show an error message.
Can you share an example of an invalid URL?
Do you just type it in the url bar?

@jdm
Copy link
Member Author

@jdm jdm commented Oct 31, 2019

Hmm. I know that a panic was caught in

catch_any_panic(|| {
debug!("load_url");
let url = unsafe { CStr::from_ptr(url) };
let url = url.to_str().expect("Can't read string");
call(|s| s.load_uri(url));
});
when I tried to paste a URL. I assumed what had happened was that I ended up with something like https://mrdoob.neocities.org/018/https://mrdoob.neocities.org/019/, but I didn't see the actual URL that I tried to load.

@paulrouget
Copy link
Contributor

@paulrouget paulrouget commented Oct 31, 2019

Right. It's better if this would not panic. But I don't see how we could end up with a non-valid URL there.

I'll investigate, and at least handle invalid URL better.

bors-servo added a commit that referenced this issue Nov 6, 2019
Do not assume UWP and Servo agree on URL validity

This should address #24589.

Note: to check that a URL is valid, we try to parse the url and if an exception is raised, we assume the url is not valid. Even though we catch the exception, Visual Studio might "force" the crash + break here: https://github.com/servo/servo/compare/master...paulrouget:url?expand=1#diff-4e059561062fe024a35522f60f7f14c1R116 - I'm not sure why. In VS, in the Exception Setting, we need to uncheck the Break When Thrown option to avoid that crash. It only happens for few urls and I'm unclear why.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #24589 (GitHub issue number if applicable)

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
@bors-servo bors-servo closed this in 7474b30 Nov 6, 2019
UWP port automation moved this from To do to Done Nov 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
UWP port
  
Done
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.