Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upShare script threads by tab and by eTLD+1 #14211
Conversation
highfive
commented
Nov 14, 2016
|
Heads up! This PR modifies the following files:
|
|
There's two commits in this PR. The first one is #14173, the second one is the subject of this PR. |
|
|
8db72d1
to
0f92143
|
|
0f92143
to
daaf77a
daaf77a
to
4ef42c1
|
This is now ready for review, since #14173 landed. @bors-servo r? @jdm |
4ef42c1
to
5c472e9
|
Excellent work! This feels like a sensible design, and it's nice that |
| @@ -162,19 +162,20 @@ impl LoadData { | |||
| } | |||
| } | |||
|
|
|||
| /// The initial data associated with a newly-created framed pipeline. | |||
| /// The initial data associated to create a new layout attached to an existing script thread. | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| match self.documents.borrow().iter().next() { | ||
| None => panic!("Layout attached to empty script thread."), | ||
| // Tell the layout thread factory to actually spawn the thread. | ||
| Some((_, document)) => document.window().layout_chan().send(msg).unwrap(), |
This comment has been minimized.
This comment has been minimized.
jdm
Nov 22, 2016
Member
We could keep trying other threads if sending to the first one fails. Maybe file as a followup?
This comment has been minimized.
This comment has been minimized.
asajeffrey
Nov 22, 2016
Author
Member
Really we should provide the script thread with a factory method for building layout threads, this would also deal with the corner case where a pipeline is asked to create a layout thread despite not having any current layout threads.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| is_private: bool) { | ||
| if self.shutting_down { return; } | ||
|
|
||
| // TODO: think about the case where the child pipeline is created | ||
| // before the parent is part of the frame tree. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
asajeffrey
Nov 22, 2016
Author
Member
I made this comment into a question. You're right, I don't think this can happen, but I'm not sure we should be relying on that.
| let pipeline_url = pipeline_id.and_then(|id| self.pipelines.get(&id).map(|pipeline| pipeline.url.clone())); | ||
| let parent_info = pipeline_id.and_then(|id| self.pipelines.get(&id).and_then(|pipeline| pipeline.parent_info)); | ||
| let window_size = pipeline_id.and_then(|id| self.pipelines.get(&id).and_then(|pipeline| pipeline.size)); | ||
|
|
||
| self.close_frame_children(frame_id, ExitPipelineMode::Force); | ||
| self.close_frame_children(top_level_frame_id, ExitPipelineMode::Force); |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
asajeffrey
Nov 22, 2016
Author
Member
Once we've got document discarding, that should all happen automatically, because the old page will be discarded, which will remove the script channel map entry.
| /// Returns None if the URL has no host name. | ||
| /// Returns the registered suffix for the host name if it is a domain. | ||
| /// Leaves the host name alone if it is an IP address. | ||
| fn reg_host<'a>(&self, url: &'a ServoUrl) -> Option<&'a str> { |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| @@ -133,6 +134,9 @@ pub struct Constellation<Message, LTF, STF> { | |||
| /// to receive sw manager message | |||
| swmanager_receiver: Receiver<SWManagerMsg>, | |||
|
|
|||
| /// A map from top-level frame id and registered domain name to script channels. | |||
This comment has been minimized.
This comment has been minimized.
jdm
Nov 22, 2016
Member
Let's add a comment to the effect of "This double indirection ensures that separate tabs do not share script threads, even if the same domain is loaded in each."
This comment has been minimized.
This comment has been minimized.
5ab118f
to
7ae19c0
|
@bors-servo r=jdm |
|
|
…eads, r=jdm Share script threads by tab and by eTLD+1 <!-- Please describe your changes on the following line: --> This PR shares script threads among all similar-origin documents in the same tab. This allows DOM object to be shared among same-origin same-tab documents. --- <!-- 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 #633. - [X] These changes do not require tests because refactoring. <!-- 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/14211) <!-- Reviewable:end -->
|
|
asajeffrey commentedNov 14, 2016
•
edited
This PR shares script threads among all similar-origin documents in the same tab. This allows DOM object to be shared among same-origin same-tab documents.
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is