diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2019-04-16 11:18:09 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-16 11:18:09 -0400 |
commit | a14b952fa3eedec86e6308213c525538bcb20827 (patch) | |
tree | 6ac4cb30e107ecc30bf47eb51e6f09cde92c8dbb /components/script/dom/htmlscriptelement.rs | |
parent | b9d625f16e31be71eb493f0cb38c07a713b4fe86 (diff) | |
parent | 73cb8b9ea6baba38c8a815b93c390c6f0df84c41 (diff) | |
download | servo-a14b952fa3eedec86e6308213c525538bcb20827.tar.gz servo-a14b952fa3eedec86e6308213c525538bcb20827.zip |
Auto merge of #23187 - krk:nopanic-unminifyjs, r=jdm
Do not unwrap empty unminified_js_dir in HTMLScriptElement.unminify_js.
Calling unwrap caused a panic when a directory could not be created.
---
<!-- 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 #23031
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23187)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/htmlscriptelement.rs')
-rw-r--r-- | components/script/dom/htmlscriptelement.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs index d1ab54afbc2..bf6dbe5b30a 100644 --- a/components/script/dom/htmlscriptelement.rs +++ b/components/script/dom/htmlscriptelement.rs @@ -555,7 +555,15 @@ impl HTMLScriptElement { }, } - let path = PathBuf::from(window_from_node(self).unminified_js_dir().unwrap()); + let path; + match window_from_node(self).unminified_js_dir() { + Some(unminified_js_dir) => path = PathBuf::from(unminified_js_dir), + None => { + warn!("Unminified script directory not found"); + return; + }, + } + let path = if script.external { // External script. let path_parts = script.url.path_segments().unwrap(); |