mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Auto merge of #15906 - mchv:mchv-safe-browsing-context, r=asajeffrey
Access browsing context safely Current browsing context accessor in `Document` unwraps the browsing context `Option` which prevents document to handle correctly the case when there is no browsing context. This is the reason servo panics with `session-history.max-length=1` (https://github.com/servo/servo/issues/15877). As it is my first contribution, I added a `safe` method to retrieve the browsing context rather than change the existing method, but I am happy to change if you think this is the right approach. I did not as well replace all existing method call to the `safe` method, to focus on fixing the issue. If someone can give me a bit of guidance for the test, I will try to contribute one. --- <!-- 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 - [ ] `./mach test-tidy` does not report any errors - [X] These changes fix #15877. - [ ] There are tests for these changes <!-- 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/15906) <!-- Reviewable:end -->
This commit is contained in:
commit
e62d029ed6
2 changed files with 8 additions and 3 deletions
|
@ -398,7 +398,7 @@ impl Document {
|
|||
#[inline]
|
||||
pub fn browsing_context(&self) -> Option<Root<BrowsingContext>> {
|
||||
if self.has_browsing_context {
|
||||
Some(self.window.browsing_context())
|
||||
self.window.maybe_browsing_context()
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue