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

Removed root browsing context from constellation #17077

Merged

Conversation

asajeffrey
Copy link
Member

@asajeffrey asajeffrey commented May 29, 2017

Removed the special root browsing context from the constellation.



This change is Reviewable

@asajeffrey asajeffrey added the A-constellation Involves the constellation label May 29, 2017
@highfive
Copy link

Heads up! This PR modifies the following files:

  • @fitzgen: components/script/dom/document.rs, components/script_traits/script_msg.rs, components/script_traits/script_msg.rs
  • @KiChjang: components/script/dom/document.rs, components/script_traits/script_msg.rs, components/script_traits/script_msg.rs

@highfive
Copy link

warning Warning warning

  • These commits modify script code, but no tests are modified. Please consider adding a test!

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label May 29, 2017
@asajeffrey
Copy link
Member Author

r? @paulrouget
cc @cbrewster

@highfive highfive assigned paulrouget and unassigned Manishearth May 29, 2017
@paulrouget
Copy link
Contributor

I'm looking at this. It will take me a day or two. I'd like to see how close we are to support tabs with this.

@asajeffrey
Copy link
Member Author

Thanks! Let me know if there's anything else needed for a minimal one-window-but-multiple-tabs browser.

@paulrouget
Copy link
Contributor

So now, if I'm not mistaken, the compositor has a pipeline tree while the constellation has a pipeline forest. That means the compositor will get plenty of messages from or for pipeline it doesn't know about. I think it brings us back to #15934 (Create a dedicated channel for constellation -> embedder communication).

Can we land support for multiple browsing contexts without fixing #15934 first?

@paulrouget
Copy link
Contributor

@asajeffrey I managed to get tabs working. Thank you! The only issue is what I mentioned in my previous comment, but I will take care of that later.

r=me, but you need a proper review though (I'm not a reviewer).

Once this has landed, this is what I will work on:

  1. by-pass the compositor for non-compositor message. See my plan here: Create a dedicated channel for constellation -> embedder communication #15934 (comment)
  2. expose TopLevelBrowsingContext to embedder
  3. implement API to create and switch browsing context
  4. add a browsing context parameter to the WindowEvents (when it makes sense)
  5. update the visibility API status based on the active compositor pipeline tree

I got most of this working here: https://github.com/paulrouget/servo/tree/tabs (just prototyping, code is horrible).

@paulrouget
Copy link
Contributor

@asajeffrey don't you think we should clear IOCompositor::pipeline_details when the frame tree is set?

@asajeffrey
Copy link
Member Author

r? @cbrewster

@highfive highfive assigned cbrewster and unassigned paulrouget Jun 5, 2017
Copy link
Contributor

@cbrewster cbrewster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good other than a couple nits/questions!

self.close_browsing_context(root_browsing_context_id, ExitPipelineMode::Normal);
// Close the top-level browsing contexts
let top_level_browsing_context_ids: Vec<TopLevelBrowsingContextId> = self.browsing_contexts.values()
.filter(|browsing_context| browsing_context.is_top_level())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: .filter(BrowsingContext::is_top_level)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We wish. It's got the wrong type (&BrowsingContext vs BrowsingContext).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tis a shame

.collect();
for top_level_browsing_context_id in top_level_browsing_context_ids {
debug!("Removing top-level browsing context {}.", top_level_browsing_context_id);
let browsing_context_id = BrowsingContextId::from(top_level_browsing_context_id);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we know the browsing contexts are top level, can't we just get their id rather than the top_level_id to avoid this conversion?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@@ -1495,6 +1490,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
};

// Create the new pipeline, attached to the parent and push to pending changes
self.handle_load_start_msg(load_info.info.new_pipeline_id);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we need to be calling self.handle_load_start_msg before we push a pending change, it might make sense to add a new method for adding pending changes that way we don't forget to call self.handle_load_start_msg.

This could be saved for another PR since it isn't directly related to these changes. Possible E-Easy.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there's quite a bit of boilerplate we could DRY. This should be a separate PR though. Not sure anything in the constellation is E-Easy :)

@@ -1680,14 +1682,12 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
if let Err(e) = result {
self.handle_send_error(parent_pipeline_id, e);
}
Some(source_id)
None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not very familiar with webdriver, but its the only user of the pipeline id returned from this method. Does this change break anything there?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Er, I don't think so. webdriver isn't very tested though :/

return None;
}
};
let (top_level_id, window_size, timestamp) = match self.browsing_contexts.get(&browsing_context_id) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These values are only used in the None branch of the match, can we move them there?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

let (evicted_id, new_context, navigated, location_changed) = if let Some(instant) = change.replace_instant {
let url = change.load_data.url.clone();

let (evicted_id, new_context, navigated) = if let Some(instant) = change.replace_instant {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay one less item in this tuple!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay!

@cbrewster cbrewster added S-awaiting-answer Someone asked a question that requires an answer. S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Jun 5, 2017
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Jun 6, 2017
Copy link
Member Author

@asajeffrey asajeffrey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed changes.

self.close_browsing_context(root_browsing_context_id, ExitPipelineMode::Normal);
// Close the top-level browsing contexts
let top_level_browsing_context_ids: Vec<TopLevelBrowsingContextId> = self.browsing_contexts.values()
.filter(|browsing_context| browsing_context.is_top_level())
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We wish. It's got the wrong type (&BrowsingContext vs BrowsingContext).

.collect();
for top_level_browsing_context_id in top_level_browsing_context_ids {
debug!("Removing top-level browsing context {}.", top_level_browsing_context_id);
let browsing_context_id = BrowsingContextId::from(top_level_browsing_context_id);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@@ -1495,6 +1490,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
};

// Create the new pipeline, attached to the parent and push to pending changes
self.handle_load_start_msg(load_info.info.new_pipeline_id);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there's quite a bit of boilerplate we could DRY. This should be a separate PR though. Not sure anything in the constellation is E-Easy :)

return None;
}
};
let (top_level_id, window_size, timestamp) = match self.browsing_contexts.get(&browsing_context_id) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@@ -1680,14 +1682,12 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
if let Err(e) = result {
self.handle_send_error(parent_pipeline_id, e);
}
Some(source_id)
None
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Er, I don't think so. webdriver isn't very tested though :/

let (evicted_id, new_context, navigated, location_changed) = if let Some(instant) = change.replace_instant {
let url = change.load_data.url.clone();

let (evicted_id, new_context, navigated) = if let Some(instant) = change.replace_instant {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay!

@asajeffrey asajeffrey removed the S-awaiting-answer Someone asked a question that requires an answer. label Jun 6, 2017
Copy link
Contributor

@cbrewster cbrewster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. squash and r=me

@cbrewster cbrewster added S-needs-squash Some (or all) of the commits in the PR should be combined. and removed S-awaiting-review There is new code that needs to be reviewed. labels Jun 7, 2017
@asajeffrey asajeffrey force-pushed the constellation-no-root-browsing-context branch from 8047f6a to 293c157 Compare June 7, 2017 15:03
@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jun 7, 2017
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-tests-failed The changes caused existing tests to fail. labels Jun 7, 2017
@asajeffrey asajeffrey force-pushed the constellation-no-root-browsing-context branch from 11ad7cf to 86c09ac Compare June 7, 2017 20:24
@asajeffrey
Copy link
Member Author

@bors-servo
Copy link
Contributor

📌 Commit 86c09ac has been approved by cbrewster

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Jun 7, 2017
@bors-servo
Copy link
Contributor

⌛ Testing commit 86c09ac with merge abb6ce3...

bors-servo pushed a commit that referenced this pull request Jun 7, 2017
…ext, r=cbrewster

Removed root browsing context from constellation

<!-- Please describe your changes on the following line: -->

Removed the special root browsing context from the constellation.

---
<!-- 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 #13994
- [X] These changes do not require tests because this isn't visible from user code

<!-- 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/17077)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

💔 Test failed - linux-dev

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Jun 7, 2017
@cbrewster
Copy link
Contributor

Checking files for tidiness...

./components/constellation/constellation.rs:2891: Line is longer than 120 characters

@cbrewster cbrewster added S-fails-tidy `./mach test-tidy` reported errors. and removed S-tests-failed The changes caused existing tests to fail. labels Jun 7, 2017
@asajeffrey
Copy link
Member Author

asajeffrey commented Jun 7, 2017 via email

@asajeffrey asajeffrey force-pushed the constellation-no-root-browsing-context branch from 86c09ac to 2fd925b Compare June 8, 2017 03:59
@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jun 8, 2017
@asajeffrey
Copy link
Member Author

@bors-servo r=cbrewster

@bors-servo
Copy link
Contributor

📌 Commit 2fd925b has been approved by cbrewster

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Jun 8, 2017
@bors-servo
Copy link
Contributor

⌛ Testing commit 2fd925b with merge caa8343...

bors-servo pushed a commit that referenced this pull request Jun 8, 2017
…ext, r=cbrewster

Removed root browsing context from constellation

<!-- Please describe your changes on the following line: -->

Removed the special root browsing context from the constellation.

---
<!-- 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 #13994
- [X] These changes do not require tests because this isn't visible from user code

<!-- 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/17077)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev
Approved by: cbrewster
Pushing caa8343 to master...

@bors-servo bors-servo merged commit 2fd925b into servo:master Jun 8, 2017
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Jun 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-constellation Involves the constellation S-fails-tidy `./mach test-tidy` reported errors.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[multi window] Constellation should be able to handle multiple root frame
6 participants