You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Frame should store some of the data that is currently in Pipeline #14692
A-constellationInvolves the constellationC-assignedThere is someone working on resolving the issueI-refactorNo impact; the issue is one of maintainability or tidiness. Proposed solution requires refactoring.
I tried to look for Frame but didn't find it. Has it been renamed, removed, or did I just miss it? In case Frame no longer exists, is this issue still relevant (the mentioned fields are still in Pipeline)?
Okay, so I had some time to work on this and I'm mostly done, but there is one pesky bit that I cannot seem to figure out on which I need your input.
After creating an iframe and loading a document in it for the first time, Constellation::change_session_history is eventually called, which in this case needs to set up a new BrowsingContext for the iframe as it does not have one yet, and insert this new browsing context into its containing parent Pipeline's children: Vec<BrowsingContext> field.
Previously it was solved like this, but now that BrowsingContext instead of Pipeline keeps track of its containing parent Pipeline, a conundrum arises in that we cannot add this new browsing context to its would-be parent pipeline, since the context has just been created and thus its (optional) field for keeping track of its parent pipeline has not yet been set, nor does its parent pipeline's children field contain this browsing context (and thus we cannot find the pertaining pipeline starting from iframe's top level browsing context). So I'm not sure what the best way would be to "attach" a new iframe's browsing context to its parent pipeline.
I see one possible solution: Constellation::handle_script_new_iframe is invoked when script notifies constellation of a new iframe with an IFrameLoadInfo object, which does contain the ID of its parent pipeline. So the new iframe's browsing_context_id could simply be inserted in its parent pipeline's children field in this function?
However, I'm not sure if this were to break any behaviour since this change would mean that the parent pipeline's children field would contain a browsing context whose document hasn't been loaded yet, while previously it was only inserted once the document had become active.
What do you think? Do you see another solution?
Please note, though, that I may just have misunderstood some (or many) things since I'm not yet fully familiar with Servo's code :)
Another option would be to store a parent_pipeline_id: Option<PipelineId> field in SessionHistoryChange, so that when the iframe's document is done loading and becomes active we can access the parent pipeline and attach iframe's browsing context to it. I think either could work, though perhaps the previously proposed solution is a bit cleaner--unless that won't work due to the described slight change in behaviour.
The second approach (adding a new field to SessionHistoryChange) sounds like the right way to go about this. The first approach would end up being a behavior change which may cause some test failures (I believe I tried a change similar to that a while back with that result).
@cbrewster Thanks for chiming in! Having thought about it some more, I would now go with the second approach as well.
In fact, I had initially overlooked that the same difficulty exists when passing is_private to a new BrowsingContext and probably when passing visible--though I don't fully understand the role of the latter yet, so I'm not sure if this could be set at a later point. [edit] Are new browsing contexts visible by default? Or how does this work? Knowing this could simplify the code a bit.
I suppose I could just stuff all fields in SesssionHistoryChange for now, and see if there is a better solution.
A-constellationInvolves the constellationC-assignedThere is someone working on resolving the issueI-refactorNo impact; the issue is one of maintainability or tidiness. Proposed solution requires refactoring.
Activity
nox commentedon Oct 7, 2017
If you wrote some more details, this issue could probably be E-Easy or E-Mentored.
asajeffrey commentedon Oct 9, 2017
Not sure about E-easy, this refactoring touches a lot of code. Might be doable as E-Mentored. cc @cbrewster
vimpunk commentedon Aug 15, 2018
I tried to look for
Framebut didn't find it. Has it been renamed, removed, or did I just miss it? In caseFrameno longer exists, is this issue still relevant (the mentioned fields are still inPipeline)?jdm commentedon Aug 15, 2018
According to 607e011#diff-7397386a198b1fdaf83ca2eb01eab35b Frame was renamed to BrowsingContext. Presumably this is still relevant!
vimpunk commentedon Aug 16, 2018
Ah, that makes sense, I recall seeing a few TODOs sprinkled in
Pipelineto move some fields toBrowsingContext.In that case I'd like to try my hand at this! I can probably start working on it Friday!
jdm commentedon Aug 16, 2018
Please do!
vimpunk commentedon Aug 20, 2018
Okay, so I had some time to work on this and I'm mostly done, but there is one pesky bit that I cannot seem to figure out on which I need your input.
After creating an iframe and loading a document in it for the first time,
Constellation::change_session_historyis eventually called, which in this case needs to set up a newBrowsingContextfor the iframe as it does not have one yet, and insert this new browsing context into its containing parentPipeline'schildren: Vec<BrowsingContext>field.Previously it was solved like this, but now that
BrowsingContextinstead ofPipelinekeeps track of its containing parentPipeline, a conundrum arises in that we cannot add this new browsing context to its would-be parent pipeline, since the context has just been created and thus its (optional) field for keeping track of its parent pipeline has not yet been set, nor does its parent pipeline'schildrenfield contain this browsing context (and thus we cannot find the pertaining pipeline starting from iframe's top level browsing context). So I'm not sure what the best way would be to "attach" a new iframe's browsing context to its parent pipeline.I see one possible solution:
Constellation::handle_script_new_iframeis invoked when script notifies constellation of a new iframe with anIFrameLoadInfoobject, which does contain the ID of its parent pipeline. So the new iframe'sbrowsing_context_idcould simply be inserted in its parent pipeline'schildrenfield in this function?However, I'm not sure if this were to break any behaviour since this change would mean that the parent pipeline's
childrenfield would contain a browsing context whose document hasn't been loaded yet, while previously it was only inserted once the document had become active.What do you think? Do you see another solution?
Please note, though, that I may just have misunderstood some (or many) things since I'm not yet fully familiar with Servo's code :)
vimpunk commentedon Aug 20, 2018
Another option would be to store a
parent_pipeline_id: Option<PipelineId>field inSessionHistoryChange, so that when the iframe's document is done loading and becomes active we can access the parent pipeline and attach iframe's browsing context to it. I think either could work, though perhaps the previously proposed solution is a bit cleaner--unless that won't work due to the described slight change in behaviour.cbrewster commentedon Aug 20, 2018
The second approach (adding a new field to
SessionHistoryChange) sounds like the right way to go about this. The first approach would end up being a behavior change which may cause some test failures (I believe I tried a change similar to that a while back with that result).vimpunk commentedon Aug 20, 2018
@cbrewster Thanks for chiming in! Having thought about it some more, I would now go with the second approach as well.
In fact, I had initially overlooked that the same difficulty exists when passing
is_privateto a newBrowsingContextand probably when passingvisible--though I don't fully understand the role of the latter yet, so I'm not sure if this could be set at a later point. [edit] Are new browsing contexts visible by default? Or how does this work? Knowing this could simplify the code a bit.I suppose I could just stuff all fields in
SesssionHistoryChangefor now, and see if there is a better solution.vimpunk commentedon Aug 31, 2018
Landed PR #21559.
Auto merge of #21559 - mandreyel:pipeline-fields-to-browsingcontext, …
Auto merge of #21559 - mandreyel:pipeline-fields-to-browsingcontext, …
Auto merge of #21559 - mandreyel:pipeline-fields-to-browsingcontext, …
Auto merge of #21559 - mandreyel:pipeline-fields-to-browsingcontext, …
Auto merge of #21559 - mandreyel:pipeline-fields-to-browsingcontext, …
Auto merge of #21559 - mandreyel:pipeline-fields-to-browsingcontext, …
Auto merge of #21559 - mandreyel:pipeline-fields-to-browsingcontext, …
Auto merge of #21559 - mandreyel:pipeline-fields-to-browsingcontext, …