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

Frame should store some of the data that is currently in Pipeline #14692 #21559

Merged

Conversation

@mandreyel
Copy link
Contributor

mandreyel commented Aug 31, 2018

Apologies, meant to land it sooner but deadline at work got hectic.

So I moved the Pipeline::{visible, is_private, parent_info} fields (size was moved earlier) to BrowsingContext, and renamed them where appropriate (and did some minor refactoring on the side, hope that's alright).

This introduced some complications, because when a pipeline is spawned for a browsing context that does not yet exist, the browsing context won't be constructed until after pipeline has made its document active. Thus, values for the fields that used to be in Pipeline and are now in BrowsingContext could not be easily retrieved when constructing the BrowsingContext (since in most cases they were only available when spawning a pipeline).
For this reason, I've put these fields in SessionHistoryChange since one is always created and added to Constellation::pending_changes when a new pipeline is created, so it provides an easy way to forward the necessary values to new BrowsingContexts.

Though frankly I'm not sure I like expanding SessionHistoryChange's purpose to serve as a crutch to construct browsing contexts, so a way to uncouple purposes would be to separately store the values for a to-be-created BrowsingContext in a collection of structs in Constellation and consume them when a new BrowsingContext is created. Here's a PoC: mandreyel@6fa2160.
I didn't include this by default because it introduces a little overhead. Perhaps PendingBrowsingContextInfo could be stored as an Option<> next to a SessionHistoryChange in Constellation::pending_changes? That'd uncouple the two structs but not incur any overhead.

I don't think it's finished, so I've marked some areas where I need input on small matters with TODO(mandreyel), but the general idea is done. I'll be sure to squash commits when no further changes need be done!


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #14692.
  • These changes do not require tests because no new features or behaviour were introduced.

This change is Reviewable

@highfive
Copy link

highfive commented Aug 31, 2018

Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @gw3583 (or someone else) soon.

@highfive
Copy link

highfive commented Aug 31, 2018

Heads up! This PR modifies the following files:

  • @asajeffrey: components/constellation/session_history.rs, components/constellation/browsingcontext.rs, components/constellation/pipeline.rs, components/constellation/constellation.rs
  • @cbrewster: components/constellation/session_history.rs, components/constellation/browsingcontext.rs, components/constellation/pipeline.rs, components/constellation/constellation.rs
  • @paulrouget: components/constellation/session_history.rs, components/constellation/browsingcontext.rs, components/constellation/pipeline.rs, components/constellation/constellation.rs
@jdm
Copy link
Member

jdm commented Aug 31, 2018

r? @cbrewster
Connor, if you don't have time to review this, we can find someone else.

@highfive highfive assigned cbrewster and unassigned gw3583 Aug 31, 2018
Copy link
Member

cbrewster left a comment

Thank you for working on this, I think this is a good improvement.

There are quite a few times where we are now nesting lookups. pipeline ID -> pipeline -> BC ID -> BC.

I would prefer trying to keep things more flat that nesting.

Ex:

let browsing_context_id = self.pipelines.get(&pipeline_id) {
    Some(pipeline) => pipeline.browsing_context_id,
    None => warn!(...),
};

let (...) = match self.browsing_contexts.get(&browsing_context_id) {
    Some(browsing_context) => (...),
    None => warn!(...),
};
@@ -1244,13 +1239,17 @@ where
warn!("Sending reply to get browsing context failed ({:?}).", e);
}
},
// TODO(mandreyel): maybe change semantics of this message to

This comment has been minimized.

@cbrewster

cbrewster Aug 31, 2018

Member

This would be a good change and could remove some extra messages sent to the constellation.
See:

fn remote_window_proxy(&self,
global_to_clone: &GlobalScope,
top_level_browsing_context_id: TopLevelBrowsingContextId,
pipeline_id: PipelineId,
opener: Option<BrowsingContextId>)
-> Option<DomRoot<WindowProxy>>
{
let browsing_context_id = self.ask_constellation_for_browsing_context_id(pipeline_id)?;
if let Some(window_proxy) = self.window_proxies.borrow().get(&browsing_context_id) {
return Some(DomRoot::from_ref(window_proxy));
}
let parent = self.ask_constellation_for_parent_info(pipeline_id).and_then(|parent_id| {
self.remote_window_proxy(global_to_clone, top_level_browsing_context_id, parent_id, opener)
});
let window_proxy = WindowProxy::new_dissimilar_origin(global_to_clone,
browsing_context_id,
top_level_browsing_context_id,
parent.r(),
opener);
self.window_proxies.borrow_mut().insert(browsing_context_id, Dom::from_ref(&*window_proxy));
Some(window_proxy)
}

Specifically, we shouldn't need to have this line:

let browsing_context_id = self.ask_constellation_for_browsing_context_id(pipeline_id)?;

I'm not sure how involved this change would be, so it may be a good followup.

This comment has been minimized.

@mandreyel

mandreyel Aug 31, 2018

Author Contributor

I think I'll leave this to another PR (I'd like to do it!) to keep things neatly isolated, if that's alright.

This comment has been minimized.

@mandreyel

mandreyel Sep 1, 2018

Author Contributor

Hmm, yeah, this could actually be coalesced into a single message to constellation. Something like ScriptMsg::GetBrowsingContextInfo(PipelineId) that returns the most relevant fields (in this case browsing_context_id and parent_pipeline_id).

This comment has been minimized.

@cbrewster

cbrewster Sep 1, 2018

Member

Exactly, this would be great as a followup.

let pipeline_id = browsing_context.map(|browsing_context| browsing_context.pipeline_id);
(window_size, pipeline_id)
let window_size = browsing_context.and_then(|context| context.size);
// TODO(mandreyel): browsing_context_id was originally

This comment has been minimized.

@cbrewster

cbrewster Aug 31, 2018

Member

You are correct, the parent should always be None since we get the top level browsing context. You can remove the code that gets the parent pipeline id and change the call to self.new_pipeline to pass None as the parent info.

None => return debug!("Pipeline {} has no parent.", pipeline_id),
Some(pipeline) => match self.browsing_contexts.get(&pipeline.browsing_context_id) {
Some(browsing_context) => (browsing_context.id, browsing_context.parent_pipeline_id),
// TODO(mandreyel): message?

This comment has been minimized.

@cbrewster

cbrewster Aug 31, 2018

Member

This message looks good.

),
None => {
return warn!(
// TODO(mandreyel): message?

This comment has been minimized.

@cbrewster

cbrewster Aug 31, 2018

Member

This message looks good.

match self.browsing_contexts.get(&parent_browsing_context_id) {
Some(browsing_context) => (browsing_context.is_private, browsing_context.is_visible),
None => {
// TODO(mandreyel): message?

This comment has been minimized.

@cbrewster

cbrewster Aug 31, 2018

Member

"New iframe loaded in closed browsing context {}.", ...

pipeline.browsing_context_id,
browsing_context.parent_pipeline_id,
),
// TODO(mandreyel): message?

This comment has been minimized.

@cbrewster

cbrewster Aug 31, 2018

Member

Pipeline {} focused after browsing context {:?} was closed

@@ -2664,12 +2774,26 @@ where
}
}

fn handle_focus_msg(&mut self, pipeline_id: PipelineId) {

This comment has been minimized.

@cbrewster

cbrewster Aug 31, 2018

Member

Would you be willing to also change the constellation to track a focused BrowsingContext rather than a focused Pipeline? If not, that can be done as a followup.

This comment has been minimized.

@mandreyel

mandreyel Aug 31, 2018

Author Contributor

Yes, in fact that's the next issue I want to be working on but I thought I'd keep that as a separate PR :)

This comment has been minimized.

@cbrewster

cbrewster Sep 1, 2018

Member

Sounds good!

@@ -2717,24 +2834,41 @@ where
},
};

let child_pipeline_ids: Vec<PipelineId> = self
// TODO(mandreyel): can we make a mutable version of

This comment has been minimized.

@cbrewster

cbrewster Aug 31, 2018

Member

Yes, this would be a good solution

This comment has been minimized.

@mandreyel

mandreyel Aug 31, 2018

Author Contributor

I think this could be a separate PR since it's a minor optimization and not directly related to this PR. What do you think?

This comment has been minimized.

@cbrewster

cbrewster Sep 1, 2018

Member

That would be fine.

browsing_context.id,
browsing_context.parent_pipeline_id,
),
// TODO(mandreyel): is this warning message ok?

This comment has been minimized.

@cbrewster

cbrewster Aug 31, 2018

Member

I would have it be:

warn!("Visibility change for closed browsing context {:?}.", pipeline.browsing_context_id) 

It's good to include a little context in the warning message (like "visibility change") so we can quickly figure out where the warning was triggered.

load_data: load_data,
history_state_id: None,
history_states: HashSet::new(),
};

pipeline.notify_visibility();

This comment has been minimized.

@cbrewster

cbrewster Aug 31, 2018

Member

It may be good to keep this here and pass in the visibility to this function, I am worried that there may be times where Pipeline::new is called but notify_visibility is not.

This comment has been minimized.

@mandreyel

mandreyel Aug 31, 2018

Author Contributor

Yes, I was a bit torn on this. On the one hand, it seems to me that the "constructor" shoudn't do a lot of extra work apart from setting up the object, but on the other hand it is indeed error prone to let the user take care of always calling notify_visibility. I guess avoiding potential errors is a higher priority, so I'll change it back.

This comment has been minimized.

@cbrewster

cbrewster Sep 1, 2018

Member

Agreed, Ideally this would be inside of Constellation::new_pipeline and that would be the only way pipelines are constructed in the constellation, but multiple edge cases caused us to use Pipeline::new directly in multiple placed

@cbrewster
Copy link
Member

cbrewster commented Aug 31, 2018

I would prefer adding a PendingBrowsingContextInfo struct that is an optional on the SessionHistoryChange struct rather than adding another HashMap to the constellation.

@mandreyel
Copy link
Contributor Author

mandreyel commented Aug 31, 2018

Thanks a lot for taking time to look at this! I'll try to implement the fixes asap.

@mandreyel
Copy link
Contributor Author

mandreyel commented Sep 1, 2018

Okay, I did a few changes. Looking at it now, it does not seem like encapsulating the fields in SessionHistoryChange for new browsing contexts is as revolutionary an idea as I had thought, but I guess it adds some explicitness, which is always good! 🍻

Can you please double-check that the places I've added Some(NewBrowsingContextInfo) when creating a new SessionHistoryChange are correct? More specifically, I'm asking whether I'm correct that that's when new BrowsingContexts don't yet exist and are expected to be constructed. I think there are a few more TODO(mandreyel)s in there, too.

Thanks!

@mandreyel
Copy link
Contributor Author

mandreyel commented Sep 1, 2018

Oh, damn, I see I messed up the commit history and introduced a bug. Let me fix that real quick.

EDIT: OK, done.

@mandreyel mandreyel force-pushed the mandreyel:pipeline-fields-to-browsingcontext branch from 195f2ba to 2acc818 Sep 1, 2018
Copy link
Member

cbrewster left a comment

Nearly there! Make sure to remove the leftover TODO: message comments and then I think this should be ready.

It would be great if you could create issues for the followups you are planning to do (if one does not already exist).

load_data: load_data,
history_state_id: None,
history_states: HashSet::new(),
};

pipeline.notify_visibility();

This comment has been minimized.

@cbrewster

cbrewster Sep 1, 2018

Member

Agreed, Ideally this would be inside of Constellation::new_pipeline and that would be the only way pipelines are constructed in the constellation, but multiple edge cases caused us to use Pipeline::new directly in multiple placed

@@ -1244,13 +1239,17 @@ where
warn!("Sending reply to get browsing context failed ({:?}).", e);
}
},
// TODO(mandreyel): maybe change semantics of this message to

This comment has been minimized.

@cbrewster

cbrewster Sep 1, 2018

Member

Exactly, this would be great as a followup.

browsing_context.is_visible,
),
None => {
// TODO(mandreyel): message?

This comment has been minimized.

@cbrewster

cbrewster Sep 1, 2018

Member

Please remove the TODO: message comments

@@ -2664,12 +2774,26 @@ where
}
}

fn handle_focus_msg(&mut self, pipeline_id: PipelineId) {

This comment has been minimized.

@cbrewster

cbrewster Sep 1, 2018

Member

Sounds good!

@@ -2717,24 +2834,41 @@ where
},
};

let child_pipeline_ids: Vec<PipelineId> = self
// TODO(mandreyel): can we make a mutable version of

This comment has been minimized.

@cbrewster

cbrewster Sep 1, 2018

Member

That would be fine.

Copy link
Member

cbrewster left a comment

Sorry I missed the changes for the NewBrowsingContextInfo. This looks much nicer.

//
// If this browsing context didn't exist, insert a pending info
// entry so that we can construct it later.
new_browsing_context_info: Some(NewBrowsingContextInfo {

This comment has been minimized.

@cbrewster

cbrewster Sep 1, 2018

Member

This can be None since the browsing_context_id is from an already existing browsing context.

replace: Some(NeedsToReload::Yes(pipeline_id, load_data.clone())),
is_private: is_private,
is_visible: is_visible,
// TODO(mandreyel): browsing context must exist at this

This comment has been minimized.

@cbrewster

cbrewster Sep 1, 2018

Member

Yes, it must exist here.

@@ -8,6 +8,27 @@ use pipeline::Pipeline;
use std::collections::{HashMap, HashSet};
use style_traits::CSSPixel;

// TODO(mandreyel): is this explanation lucid enough?

This comment has been minimized.

@cbrewster

cbrewster Sep 1, 2018

Member

Sounds good.

let new_context_info = match change.new_browsing_context_info {
Some(new_context_info) => new_context_info,
None => {
return warn!(

This comment has been minimized.

@cbrewster

cbrewster Sep 1, 2018

Member

It's unfortunate that we have to add this check here, but I'm not sure of a way around it at the moment.

This comment has been minimized.

@mandreyel

mandreyel Sep 1, 2018

Author Contributor

Yeah, I agree. While overall the introduction of NewBrowsingContextInfo makes the code cleaner and more explicit, this is an unfortunate side effect.
It could be solved by moving parent_pipeline_id back to SessionHistoryChange and always setting it so that it's available in this function, but that kind of muddies the semantics, since most of the time the field isn't actually needed by whoever uses SessionHistoryChange.

@cbrewster
Copy link
Member

cbrewster commented Sep 1, 2018

@bors-servo
Copy link
Contributor

bors-servo commented Sep 1, 2018

Trying commit 2acc818 with merge 511004c...

bors-servo added a commit that referenced this pull request Sep 1, 2018
…r=<try>

Frame should store some of the data that is currently in Pipeline #14692

<!-- Please describe your changes on the following line: -->
Apologies, meant to land it sooner but deadline at work got hectic.

So I moved the `Pipeline::{visible, is_private, parent_info}` fields (`size` was moved earlier) to `BrowsingContext`, and renamed them where appropriate (and did some minor refactoring on the side, hope that's alright).

This introduced some complications, because when a pipeline is spawned for a browsing context that does not yet exist, the browsing context won't be constructed until after pipeline has made its document active. Thus, values for the fields that used to be in `Pipeline` and are now in `BrowsingContext` could not be easily retrieved when constructing the `BrowsingContext` (since in most cases they were only available when spawning a pipeline).
For this reason, I've put these fields in `SessionHistoryChange` since one is always created and added to `Constellation::pending_changes` when a new pipeline is created, so it provides an easy way to forward the necessary values to new `BrowsingContext`s.

Though frankly I'm not sure I like expanding `SessionHistoryChange`'s purpose to serve as a crutch to construct browsing contexts, so a way to uncouple purposes would be to separately store the values for a to-be-created `BrowsingContext` in a collection of structs in `Constellation` and consume them when a new `BrowsingContext` is created. Here's a PoC: mandreyel@6fa2160.
I didn't include this by default because it introduces a little overhead. Perhaps `PendingBrowsingContextInfo` could be stored as an `Option<>` next to a `SessionHistoryChange` in `Constellation::pending_changes`? That'd uncouple the two structs but not incur any overhead.

I don't think it's finished, so I've marked some areas where I need input on small matters with `TODO(mandreyel)`, but the general idea is done. I'll be sure to squash commits when no further changes need be done!

---
<!-- 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 #14692.

<!-- Either: -->
- [x] These changes do not require tests because no new features or behaviour were introduced.

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

bors-servo commented Sep 1, 2018

💔 Test failed - linux-rel-css

@bors-servo
Copy link
Contributor

bors-servo commented Sep 13, 2018

Testing commit b051df7 with merge 7b93d08...

bors-servo added a commit that referenced this pull request Sep 13, 2018
…r=cbrewster

Frame should store some of the data that is currently in Pipeline #14692

<!-- Please describe your changes on the following line: -->
Apologies, meant to land it sooner but deadline at work got hectic.

So I moved the `Pipeline::{visible, is_private, parent_info}` fields (`size` was moved earlier) to `BrowsingContext`, and renamed them where appropriate (and did some minor refactoring on the side, hope that's alright).

This introduced some complications, because when a pipeline is spawned for a browsing context that does not yet exist, the browsing context won't be constructed until after pipeline has made its document active. Thus, values for the fields that used to be in `Pipeline` and are now in `BrowsingContext` could not be easily retrieved when constructing the `BrowsingContext` (since in most cases they were only available when spawning a pipeline).
For this reason, I've put these fields in `SessionHistoryChange` since one is always created and added to `Constellation::pending_changes` when a new pipeline is created, so it provides an easy way to forward the necessary values to new `BrowsingContext`s.

Though frankly I'm not sure I like expanding `SessionHistoryChange`'s purpose to serve as a crutch to construct browsing contexts, so a way to uncouple purposes would be to separately store the values for a to-be-created `BrowsingContext` in a collection of structs in `Constellation` and consume them when a new `BrowsingContext` is created. Here's a PoC: mandreyel@6fa2160.
I didn't include this by default because it introduces a little overhead. Perhaps `PendingBrowsingContextInfo` could be stored as an `Option<>` next to a `SessionHistoryChange` in `Constellation::pending_changes`? That'd uncouple the two structs but not incur any overhead.

I don't think it's finished, so I've marked some areas where I need input on small matters with `TODO(mandreyel)`, but the general idea is done. I'll be sure to squash commits when no further changes need be done!

---
<!-- 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 #14692.

<!-- Either: -->
- [x] These changes do not require tests because no new features or behaviour were introduced.

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

bors-servo commented Sep 13, 2018

💔 Test failed - mac-rel-wpt2

@jdm
Copy link
Member

jdm commented Sep 13, 2018

I am not sure whether to be worried about this:

  ▶ OK [expected TIMEOUT] /html/browsers/history/the-history-interface/traverse_the_history_write_after_load_1.html

  ▶ Unexpected subtest result in /html/browsers/history/the-history-interface/traverse_the_history_write_after_load_1.html:
  │ FAIL [expected TIMEOUT] Traverse the history after document.write after the load event
  │   → assert_array_equals: Pages opened during history navigation property 2, expected 2 but got 3
  │ 
  │ start_test_wait</check_result<@http://web-platform.test:8000/html/browsers/history/the-history-interface/traverse_the_history_write_after_load_1.html:19:11
  │ Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:1558:20
  └ Test.prototype.step_func/<@http://web-platform.test:8000/resources/testharness.js:1582:20
@mandreyel
Copy link
Contributor Author

mandreyel commented Sep 13, 2018

@jdm Hmm :/ I ran the /html/browsers test suite tens of times on both master (to be more precise, the last upstream commit before mine) and my branch (after the above fix), and there were a few history traversal tests (along with a few others) that failed pretty consistently on both branches for me (/html/browsers/history/the-history-interface/traverse_the_history_{1,2,3,4,5}.html) and it was always the same tests on both (they didn't all fail at the same time though).
I must admit I have never seen this one fail on either branch and am trying to reproduce locally now.
Were there problems with history traversal before or is this new to you?

@mandreyel
Copy link
Contributor Author

mandreyel commented Sep 13, 2018

E.g. this is what I get on master (2351872) on a debug build:

./mach test-wpt tests/wpt/web-platform-tests/html/browsers/history
Running 92 tests in web-platform-tests

  ▶ Unexpected subtest result in /html/browsers/history/the-history-interface/traverse_the_history_3.html:
  └ PASS [expected FAIL] Multiple history traversals, last would be aborted

  ▶ Unexpected subtest result in /html/browsers/history/the-history-interface/traverse_the_history_5.html:
  └ PASS [expected FAIL] Multiple history traversals, last would be aborted

  ▶ Unexpected subtest result in /html/browsers/history/the-location-interface/location-protocol-setter-non-broken.html:
  │ FAIL [expected PASS] Set HTTP URL frame location.protocol to x
  │   → assert_equals: expected "http:" but got "x"
  │ 
  │ self.onload/</</frame.onload</<@http://web-platform.test:8000/html/browsers/history/the-location-interface/location-protocol-setter-non-broken.html:25:11
  │ Test.prototype.step_timeout/<@http://web-platform.test:8000/resources/testharness.js:1611:20
  │ Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:1553:20
  └ Test.prototype.step_func/<@http://web-platform.test:8000/resources/testharness.js:1577:20

Ran 92 tests finished in 36.0 seconds.
  • 89 ran as expected. 2 tests skipped.
  • 3 tests had unexpected subtest results
@jdm
Copy link
Member

jdm commented Sep 13, 2018

I'm willing to believe it's a latest intermittent failure that just hasn't hit us before.
@bors-servo retry

@bors-servo
Copy link
Contributor

bors-servo commented Sep 13, 2018

Testing commit b051df7 with merge fcdcd3d...

bors-servo added a commit that referenced this pull request Sep 13, 2018
…r=cbrewster

Frame should store some of the data that is currently in Pipeline #14692

<!-- Please describe your changes on the following line: -->
Apologies, meant to land it sooner but deadline at work got hectic.

So I moved the `Pipeline::{visible, is_private, parent_info}` fields (`size` was moved earlier) to `BrowsingContext`, and renamed them where appropriate (and did some minor refactoring on the side, hope that's alright).

This introduced some complications, because when a pipeline is spawned for a browsing context that does not yet exist, the browsing context won't be constructed until after pipeline has made its document active. Thus, values for the fields that used to be in `Pipeline` and are now in `BrowsingContext` could not be easily retrieved when constructing the `BrowsingContext` (since in most cases they were only available when spawning a pipeline).
For this reason, I've put these fields in `SessionHistoryChange` since one is always created and added to `Constellation::pending_changes` when a new pipeline is created, so it provides an easy way to forward the necessary values to new `BrowsingContext`s.

Though frankly I'm not sure I like expanding `SessionHistoryChange`'s purpose to serve as a crutch to construct browsing contexts, so a way to uncouple purposes would be to separately store the values for a to-be-created `BrowsingContext` in a collection of structs in `Constellation` and consume them when a new `BrowsingContext` is created. Here's a PoC: mandreyel@6fa2160.
I didn't include this by default because it introduces a little overhead. Perhaps `PendingBrowsingContextInfo` could be stored as an `Option<>` next to a `SessionHistoryChange` in `Constellation::pending_changes`? That'd uncouple the two structs but not incur any overhead.

I don't think it's finished, so I've marked some areas where I need input on small matters with `TODO(mandreyel)`, but the general idea is done. I'll be sure to squash commits when no further changes need be done!

---
<!-- 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 #14692.

<!-- Either: -->
- [x] These changes do not require tests because no new features or behaviour were introduced.

<!-- 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/21559)
<!-- Reviewable:end -->
@nox
Copy link
Member

nox commented Sep 13, 2018

@jdm There was a different PR which failed because of spurious failures (#21687) and I was waiting for its remaining builds to finish on Buildbot to retry it. :(

@bors-servo
Copy link
Contributor

bors-servo commented Sep 13, 2018

💔 Test failed - linux-rel-css

@jdm
Copy link
Member

jdm commented Sep 13, 2018

@bors-servo retry

bors-servo added a commit that referenced this pull request Sep 13, 2018
…r=cbrewster

Frame should store some of the data that is currently in Pipeline #14692

<!-- Please describe your changes on the following line: -->
Apologies, meant to land it sooner but deadline at work got hectic.

So I moved the `Pipeline::{visible, is_private, parent_info}` fields (`size` was moved earlier) to `BrowsingContext`, and renamed them where appropriate (and did some minor refactoring on the side, hope that's alright).

This introduced some complications, because when a pipeline is spawned for a browsing context that does not yet exist, the browsing context won't be constructed until after pipeline has made its document active. Thus, values for the fields that used to be in `Pipeline` and are now in `BrowsingContext` could not be easily retrieved when constructing the `BrowsingContext` (since in most cases they were only available when spawning a pipeline).
For this reason, I've put these fields in `SessionHistoryChange` since one is always created and added to `Constellation::pending_changes` when a new pipeline is created, so it provides an easy way to forward the necessary values to new `BrowsingContext`s.

Though frankly I'm not sure I like expanding `SessionHistoryChange`'s purpose to serve as a crutch to construct browsing contexts, so a way to uncouple purposes would be to separately store the values for a to-be-created `BrowsingContext` in a collection of structs in `Constellation` and consume them when a new `BrowsingContext` is created. Here's a PoC: mandreyel@6fa2160.
I didn't include this by default because it introduces a little overhead. Perhaps `PendingBrowsingContextInfo` could be stored as an `Option<>` next to a `SessionHistoryChange` in `Constellation::pending_changes`? That'd uncouple the two structs but not incur any overhead.

I don't think it's finished, so I've marked some areas where I need input on small matters with `TODO(mandreyel)`, but the general idea is done. I'll be sure to squash commits when no further changes need be done!

---
<!-- 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 #14692.

<!-- Either: -->
- [x] These changes do not require tests because no new features or behaviour were introduced.

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

bors-servo commented Sep 13, 2018

Testing commit b051df7 with merge 7b3feb7...

@bors-servo
Copy link
Contributor

bors-servo commented Sep 13, 2018

@bors-servo bors-servo merged commit b051df7 into servo:master Sep 13, 2018
3 of 4 checks passed
3 of 4 checks passed
Taskcluster (pull_request) TaskGroup: failure
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@mandreyel mandreyel mentioned this pull request Sep 13, 2018
4 of 5 tasks complete
bors-servo added a commit that referenced this pull request Sep 14, 2018
…s, r=paulrouget

Create ScriptMsg::GetBrowsingContextInfo

Script used to send two messages to constellation to first retrieve the id of the browsing context in which a pipeline resides and then its parent pipeline's id. This patch introduces a minor optimization to instead retrieve those fields in a single message.

Also, fixed a potential bug introduced in #21559 where if a browsing context wasn't found for a pipeline in response to `GetParentInfo` (which is now deleted), constellation sent nothing back, presumably causing the script thread to hang on the receiving channel.

---
<!-- 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 #21703 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because no new behaviour was introduced.

<!-- 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/21705)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

8 participants
You can’t perform that action at this time.