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 upClean-up "new pipeline" flow in constellation - match with correct event-loop #23885
Comments
|
Ok so what I wrote above is completely wrong, since the first arm is Leaving this open just in case, I find it somewhat hairy. One thing that is perhaps still wrong is that we don't seem to deal with the "about:blank" newly created auxiliary in the right way, since it will fall through to the Also, the I think this function can use a few more pair of eyes from time to time... |
|
Ok, learning something new, although I should have known it already: Both "about:blank" new iframes and auxiliaries do not get a new event-loop assigned via The message sent to the constellation is just to tell it: "hey they're a new pipeline in this existing event-loop". So by the time we get to Then the question remains, why does reloading a page that contains a cross-site iframe, make script crash when the initial nested BC is created? The reason is because |
I was just looking at
servo/components/constellation/constellation.rs
Line 906 in 447ae1e
trying to follow the flow of how we go about loading a cross-site iframe.
Couple of things to note:
if load_data.url.as_str() != "about:blank"seems wrong, since it doesget_event_loopwhich will look at thehostto determine a match re event-loop. I think in the case of "about:blank" iframes or auxiliary you would want to run it in the event-loop of the creator, which isnt' running at "about:blank"if let Some(parent), here we always get the event-loop of the parent. That means a cross-site iframe will run in the same event-loop as the parent. We want to run it in it's own event-loop.else if let Some(creator)This is only set in the case of an "about:blank" iframe, and it takes the event-loop of the creator. The logic is right, but I think it would be preempted by 1.So to fix this we want:
parentoropenerbe some. So we should really just either take the event-loop of the parent, or of the opener.self.get_event_loop, which will either select a matching event-loop in the browsing context group of the opener, or the top-level, or create a new one.The idea is that an auxiliary should initially be "about:blank", and share an event-loop with it's opener, and an iframe should share the event-loop of it's parent.
Then, when either are loaded to a different site, they would still remain part of the same browsing context group, but instead of automatically sharing the event-loop of the parent or opener, they would either share an existing event-loop, or get a new one, based on their host.