diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-09-22 09:34:12 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-22 09:34:12 -0500 |
commit | c48ef50b7260df7f2e781e15bba37b08f0970062 (patch) | |
tree | 35a0807a0c15b27edd0685ee642660c3a810d9f9 /components/script/dom/node.rs | |
parent | 4af0d9acb3f5724cac9f40a46ee03ab364a053bc (diff) | |
parent | fbfb9a80b4f23854c984c7039c8dc30a8eb583b1 (diff) | |
download | servo-c48ef50b7260df7f2e781e15bba37b08f0970062.tar.gz servo-c48ef50b7260df7f2e781e15bba37b08f0970062.zip |
Auto merge of #18514 - asajeffrey:layout-dont-panic-if-no-iframe-bc, r=emilio
Remove sources of panic when laying out an iframe without a nested browsing context
<!-- Please describe your changes on the following line: -->
At the moment, layout panics if it discovers an iframe without a nested browsing context. Under normal circumstances, this is reasonable, but it requires very tight synchronization between script, layout, the constellation and the compositor. In particular, if a layout is in progress when an iframe's browsing context is discarded, this can trigger panic.
This PR fixes this in two ways:
1. Making the pipeline and browsing context ids optional in layout's representation of an iframe.
2. Shutting down layout before discarding a browsing context, rather than after.
This is belt and braces.
---
<!-- 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 #17482 and #18477
- [X] These changes do not require tests because the PR is fixing a panic caused by a race condition
<!-- 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. -->
<!-- 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/18514)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/node.rs')
-rw-r--r-- | components/script/dom/node.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 6b16cc242db..77e499a6f5a 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -1024,8 +1024,8 @@ pub trait LayoutNodeHelpers { fn image_url(&self) -> Option<ServoUrl>; fn canvas_data(&self) -> Option<HTMLCanvasData>; fn svg_data(&self) -> Option<SVGSVGData>; - fn iframe_browsing_context_id(&self) -> BrowsingContextId; - fn iframe_pipeline_id(&self) -> PipelineId; + fn iframe_browsing_context_id(&self) -> Option<BrowsingContextId>; + fn iframe_pipeline_id(&self) -> Option<PipelineId>; fn opaque(&self) -> OpaqueNode; } @@ -1175,16 +1175,16 @@ impl LayoutNodeHelpers for LayoutJS<Node> { .map(|svg| svg.data()) } - fn iframe_browsing_context_id(&self) -> BrowsingContextId { + fn iframe_browsing_context_id(&self) -> Option<BrowsingContextId> { let iframe_element = self.downcast::<HTMLIFrameElement>() .expect("not an iframe element!"); - iframe_element.browsing_context_id().unwrap() + iframe_element.browsing_context_id() } - fn iframe_pipeline_id(&self) -> PipelineId { + fn iframe_pipeline_id(&self) -> Option<PipelineId> { let iframe_element = self.downcast::<HTMLIFrameElement>() .expect("not an iframe element!"); - iframe_element.pipeline_id().unwrap() + iframe_element.pipeline_id() } #[allow(unsafe_code)] |