aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmliframeelement.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-10-21 03:31:21 -0500
committerGitHub <noreply@github.com>2017-10-21 03:31:21 -0500
commit2b03a9974c61d1481d4b40351ff1305ad0b26588 (patch)
treea9101c4f23bba203bea997c730edbe5a1783716a /components/script/dom/htmliframeelement.rs
parent48c715c1c86301d0f25e70d3e690d04d8303c58f (diff)
parent2d45e9d2da571e70deef137f9022de87cc1126f3 (diff)
downloadservo-2b03a9974c61d1481d4b40351ff1305ad0b26588.tar.gz
servo-2b03a9974c61d1481d4b40351ff1305ad0b26588.zip
Auto merge of #18968 - mbrubeck:try, r=emilio
Use try syntax for Option where appropriate - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes do not require tests because they are refactoring only <!-- 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/18968) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/htmliframeelement.rs')
-rw-r--r--components/script/dom/htmliframeelement.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs
index 697e32636b1..ca6a504ef3e 100644
--- a/components/script/dom/htmliframeelement.rs
+++ b/components/script/dom/htmliframeelement.rs
@@ -588,17 +588,13 @@ impl HTMLIFrameElementMethods for HTMLIFrameElement {
// https://html.spec.whatwg.org/multipage/#concept-bcc-content-document
fn GetContentDocument(&self) -> Option<DomRoot<Document>> {
// Step 1.
- let pipeline_id = match self.pipeline_id.get() {
- None => return None,
- Some(pipeline_id) => pipeline_id,
- };
+ let pipeline_id = self.pipeline_id.get()?;
+
// Step 2-3.
// Note that this lookup will fail if the document is dissimilar-origin,
// so we should return None in that case.
- let document = match ScriptThread::find_document(pipeline_id) {
- None => return None,
- Some(document) => document,
- };
+ let document = ScriptThread::find_document(pipeline_id)?;
+
// Step 4.
let current = GlobalScope::current().expect("No current global object").as_window().Document();
if !current.origin().same_origin_domain(document.origin()) {