New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return Option for Window's layout channel #27163
Return Option for Window's layout channel #27163
Conversation
Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @jdm (or someone else) soon. |
Heads up! This PR modifies the following files:
|
Opened new PR for upstreamable changes. Completed upstream sync of web-platform-test changes at web-platform-tests/wpt#24436. |
8768532
to
9483686
Compare
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at web-platform-tests/wpt#24436. |
@@ -0,0 +1,23 @@ | |||
<!doctype html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test can be moved to tests/wpt/mozilla/tests/mozilla. These are WPT tests that we don't upstream and are used for checking regressions in specific cases in our engine, rather than conformance tests for all engines.
components/script/script_thread.rs
Outdated
@@ -2472,7 +2473,7 @@ impl ScriptThread { | |||
.borrow() | |||
.iter() | |||
.next() | |||
.map(|(_, document)| document.window().layout_chan().clone()) | |||
.map(|(_, document)| document.window().layout_chan().unwrap().clone()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This map can become and_then and we can remove the unwrap.
components/script/dom/window.rs
Outdated
@@ -1553,7 +1556,8 @@ impl Window { | |||
// TODO Step 1 | |||
// TODO(mrobinson, #18709): Add smooth scrolling support to WebRender so that we can | |||
// properly process ScrollBehavior here. | |||
self.layout_chan | |||
self.layout_chan() | |||
.unwrap() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll want to replace these unwraps in this PR with warn! statements and return from the code as soon as possible.
9483686
to
d6ba755
Compare
No upstreamable changes; closed existing PR. Completed upstream sync of web-platform-test changes at web-platform-tests/wpt#24436. |
d6ba755
to
36fbbea
Compare
let _ = window | ||
.layout_chan() | ||
.send(Msg::RegisterPaint(name, properties, painter)); | ||
|
||
match window.layout_chan() { | ||
Some(chan) => chan | ||
.send(Msg::RegisterPaint(name, properties, painter)) | ||
.unwrap(), | ||
None => warn!("Layout channel unavailable"), | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why the Result
was ignored here and not unwrapped like everywhere else, I've changed it to match with other uses of this channel
@bors-servo try=wpt |
…es-panic, r=<try> Return Option for Window's layout channel <!-- Please describe your changes on the following line: --> --- <!-- 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 #23053 <!-- Either: --> - [x] There are tests for these changes <!-- 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. --> This is my first contribution, I'm trying to figure things out! This fix passes the test case shown in #23053, however I don't know what the behavior should be in `Document` and `ScriptThread` if `Window::is_alive()` is false : simply ignore it, don't do anything ? Or is this something that should not happen now that we return false in `Window::force_reflow()` ? I'm not sure about the directory where the test case should go, any advice?
|
I think we can make this PR also close all the open issues mentioned at #22507 (comment) While leaving #22507 itself open, since we still have the underlying problem of perhaps closing the layout thread too early(or in other words exiting the pipeline, while the related browsing context is still alive even though not fully active), which requires some further investigation, such as what happens if a disconnected iframe is re-connected into the document. |
Have I done this right? :) |
Looks like it, Github as added them to list of closing issues on the right panel.. Great work, thanks! @bors-servo r=jdm |
|
…es-panic, r=jdm Return Option for Window's layout channel <!-- Please describe your changes on the following line: --> `Window::layout_chan()` now returns an `Option<Sender<Msg>>`, returning `None` if the window is dead. FIX #26969 FIX #26429 FIX #21208 FIX #19092 FIX #22559 FIX #22584 FIX #22652 --- <!-- 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 #23053 <!-- Either: --> - [x] There are tests for these changes <!-- 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. --> This is my first contribution, I'm trying to figure things out! This fix passes the test case shown in #23053, however I don't know what the behavior should be in `Document` and `ScriptThread` if `Window::is_alive()` is false : simply ignore it, don't do anything ? Or is this something that should not happen now that we return false in `Window::force_reflow()` ? I'm not sure about the directory where the test case should go, any advice?
|
|
Window::layout_chan()
now returns anOption<Sender<Msg>>
, returningNone
if the window is dead.FIX #26969
FIX #26429
FIX #21208
FIX #19092
FIX #22559
FIX #22584
FIX #22652
./mach build -d
does not report any errors./mach test-tidy
does not report any errorsThis is my first contribution, I'm trying to figure things out!
This fix passes the test case shown in #23053, however I don't know what the behavior should be in
Document
andScriptThread
ifWindow::is_alive()
is false : simply ignore it, don't do anything ? Or is this something that should not happen now that we return false inWindow::force_reflow()
?I'm not sure about the directory where the test case should go, any advice?