Skip to content
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

Conversation

@alarsyo
Copy link
Contributor

alarsyo commented Jul 3, 2020

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


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #23053
  • There are tests for these changes

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?

@highfive
Copy link

highfive commented Jul 3, 2020

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.

@highfive
Copy link

highfive commented Jul 3, 2020

Heads up! This PR modifies the following files:

  • @asajeffrey: components/script/script_thread.rs, components/script/dom/document.rs, components/script/dom/window.rs
  • @KiChjang: components/script/script_thread.rs, components/script/dom/document.rs, components/script/dom/window.rs
@highfive
Copy link

highfive commented Jul 3, 2020

warning Warning warning

  • These commits include an empty title element (<title></title>). Consider adding appropriate metadata.
@servo-wpt-sync
Copy link
Collaborator

servo-wpt-sync commented Jul 3, 2020

Opened new PR for upstreamable changes.

Completed upstream sync of web-platform-test changes at web-platform-tests/wpt#24436.

@alarsyo alarsyo force-pushed the alarsyo:23053-layout-queries-disconnected-frames-panic branch from 8768532 to 9483686 Jul 3, 2020
@servo-wpt-sync
Copy link
Collaborator

servo-wpt-sync commented Jul 3, 2020

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>

This comment has been minimized.

Copy link
@jdm

jdm Jul 3, 2020

Member

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.

@@ -2472,7 +2473,7 @@ impl ScriptThread {
.borrow()
.iter()
.next()
.map(|(_, document)| document.window().layout_chan().clone())
.map(|(_, document)| document.window().layout_chan().unwrap().clone())

This comment has been minimized.

Copy link
@jdm

jdm Jul 3, 2020

Member

This map can become and_then and we can remove the unwrap.

@@ -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()

This comment has been minimized.

Copy link
@jdm

jdm Jul 3, 2020

Member

We'll want to replace these unwraps in this PR with warn! statements and return from the code as soon as possible.

@alarsyo alarsyo force-pushed the alarsyo:23053-layout-queries-disconnected-frames-panic branch from 9483686 to d6ba755 Jul 3, 2020
@servo-wpt-sync
Copy link
Collaborator

servo-wpt-sync commented Jul 3, 2020

No upstreamable changes; closed existing PR.

Completed upstream sync of web-platform-test changes at web-platform-tests/wpt#24436.

@alarsyo alarsyo force-pushed the alarsyo:23053-layout-queries-disconnected-frames-panic branch from d6ba755 to 36fbbea Jul 3, 2020
@alarsyo alarsyo marked this pull request as ready for review Jul 3, 2020
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"),
}
Comment on lines -1175 to +1181

This comment has been minimized.

Copy link
@alarsyo

alarsyo Jul 3, 2020

Author Contributor

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

@jdm
Copy link
Member

jdm commented Jul 3, 2020

@bors-servo try=wpt

bors-servo added a commit that referenced this pull request Jul 3, 2020
…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?
@bors-servo
Copy link
Contributor

bors-servo commented Jul 3, 2020

Trying commit 36fbbea with merge 9047dcf...

@bors-servo
Copy link
Contributor

bors-servo commented Jul 3, 2020

☀️ Test successful - status-taskcluster
State: approved= try=True

@gterzian
Copy link
Member

gterzian commented Jul 4, 2020

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.

@alarsyo
Copy link
Contributor Author

alarsyo commented Jul 4, 2020

Have I done this right? :)

@gterzian
Copy link
Member

gterzian commented Jul 4, 2020

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

@bors-servo
Copy link
Contributor

bors-servo commented Jul 4, 2020

📌 Commit 36fbbea has been approved by jdm

@bors-servo
Copy link
Contributor

bors-servo commented Jul 4, 2020

Testing commit 36fbbea with merge a8f9ab7...

bors-servo added a commit that referenced this pull request Jul 4, 2020
…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?
@bors-servo
Copy link
Contributor

bors-servo commented Jul 4, 2020

💔 Test failed - status-taskcluster

@CYBAI
Copy link
Collaborator

CYBAI commented Jul 4, 2020

@bors-servo
Copy link
Contributor

bors-servo commented Jul 4, 2020

Testing commit 36fbbea with merge 8916a42...

@bors-servo
Copy link
Contributor

bors-servo commented Jul 4, 2020

☀️ Test successful - status-taskcluster
Approved by: jdm
Pushing 8916a42 to master...

@bors-servo bors-servo merged commit 8916a42 into servo:master Jul 4, 2020
2 checks passed
2 checks passed
Community-TC (pull_request) TaskGroup: success
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.