mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
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 -->
This commit is contained in:
commit
2b03a9974c
19 changed files with 65 additions and 180 deletions
|
@ -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()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue