Skip to content

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

Merged
bors-servo merged 1 commit into
servo:masterfrom
vimpunk:pipeline-fields-to-browsingcontext
Sep 13, 2018
Merged

bors-servo merged 1 commit into
servo:masterfrom
vimpunk:pipeline-fields-to-browsingcontext

Conversation

@vimpunk

@vimpunk vimpunk commented Aug 31, 2018 •

Copy link
Copy Markdown
Contributor

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: vimpunk@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!


  • These changes do not require tests because no new features or behaviour were introduced.

This change is Reviewable

@highfive

Copy link
Copy Markdown

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
Copy Markdown

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

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Aug 31, 2018
@jdm

jdm commented Aug 31, 2018

Copy link
Copy Markdown
Member

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

@cbrewster cbrewster left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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!(...),
};

warn!("Sending reply to get browsing context failed ({:?}).", e);
}
},
// TODO(mandreyel): maybe change semantics of this message to

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This message looks good.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

}
}

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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 :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sounds good!

};

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, this would be a good solution

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That would be fine.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

history_states: HashSet::new(),
};

pipeline.notify_visibility();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 cbrewster added 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 Aug 31, 2018
@cbrewster

Copy link
Copy Markdown
Contributor

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

@vimpunk

vimpunk commented Aug 31, 2018

Copy link
Copy Markdown
Contributor Author

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

@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 Sep 1, 2018
@vimpunk

vimpunk commented Sep 1, 2018 •

Copy link
Copy Markdown
Contributor Author

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!

@vimpunk

vimpunk commented Sep 1, 2018 •

Copy link
Copy Markdown
Contributor Author

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

EDIT: OK, done.

@vimpunk
vimpunk force-pushed the pipeline-fields-to-browsingcontext branch from 195f2ba to 2acc818 Compare September 1, 2018 09:21

@cbrewster cbrewster left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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).

history_states: HashSet::new(),
};

pipeline.notify_visibility();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

warn!("Sending reply to get browsing context failed ({:?}).", e);
}
},
// TODO(mandreyel): maybe change semantics of this message to

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Exactly, this would be great as a followup.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please remove the TODO: message comments

}
}

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sounds good!

};

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That would be fine.

@cbrewster cbrewster added 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 Sep 1, 2018

@cbrewster cbrewster left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, it must exist here.

use std::collections::{HashMap, HashSet};
use style_traits::CSSPixel;

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sounds good.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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
Copy Markdown
Contributor

@bors-servo try

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit 2acc818 with merge 511004c...

bors-servo pushed 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: vimpunk@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
Copy Markdown
Contributor

💔 Test failed - linux-rel-css

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-tests-failed The changes caused existing tests to fail. S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Sep 1, 2018
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit b051df7 with merge 7b93d08...

bors-servo pushed 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: vimpunk@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 -->
@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-tests-failed The changes caused existing tests to fail. labels Sep 13, 2018
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - mac-rel-wpt2

@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 Sep 13, 2018
@jdm

jdm commented Sep 13, 2018

Copy link
Copy Markdown
Member

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

@vimpunk

vimpunk commented Sep 13, 2018 •

Copy link
Copy Markdown
Contributor Author

@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?

@vimpunk

vimpunk commented Sep 13, 2018

Copy link
Copy Markdown
Contributor Author

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

jdm commented Sep 13, 2018

Copy link
Copy Markdown
Member

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
Copy Markdown
Contributor

⌛ Testing commit b051df7 with merge fcdcd3d...

bors-servo pushed 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: vimpunk@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 -->
@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-tests-failed The changes caused existing tests to fail. labels Sep 13, 2018
@nox

nox commented Sep 13, 2018

Copy link
Copy Markdown
Contributor

@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
Copy Markdown
Contributor

💔 Test failed - linux-rel-css

@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 Sep 13, 2018
@jdm

jdm commented Sep 13, 2018

Copy link
Copy Markdown
Member

@bors-servo retry

bors-servo pushed 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: vimpunk@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
Copy Markdown
Contributor

⌛ Testing commit b051df7 with merge 7b3feb7...

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-tests-failed The changes caused existing tests to fail. labels Sep 13, 2018
@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - android, android-x86, 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 7b3feb7 to master...

@bors-servo
bors-servo merged commit b051df7 into servo:master Sep 13, 2018
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Sep 13, 2018
@vimpunk vimpunk mentioned this pull request Sep 13, 2018
4 of 5 tasks
bors-servo pushed 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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

8 participants