Skip to content

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

Closed

Description

@asajeffrey

There is some data we are currently storing in Pipeline that should really be in Frame: parent_info, size, is_private and visible.

Activity

  1. added
    A-constellation
    I-refactor
    on Dec 23, 2016
  2. self-assigned this
    on Dec 23, 2016
  3. nox commented on Oct 7, 2017

    @nox
    Contributor

    If you wrote some more details, this issue could probably be E-Easy or E-Mentored.

  4. removed their assignment
    on Oct 9, 2017
  5. asajeffrey commented on Oct 9, 2017

    @asajeffrey
    ContributorAuthor

    Not sure about E-easy, this refactoring touches a lot of code. Might be doable as E-Mentored. cc @cbrewster

  6. vimpunk commented on Aug 15, 2018

    @vimpunk
    Contributor

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

  7. jdm commented on Aug 15, 2018

    @jdm
    Member

    According to 607e011#diff-7397386a198b1fdaf83ca2eb01eab35b Frame was renamed to BrowsingContext. Presumably this is still relevant!

  8. vimpunk commented on Aug 16, 2018

    @vimpunk
    Contributor

    Ah, that makes sense, I recall seeing a few TODOs sprinkled in Pipeline to move some fields to BrowsingContext.

    In that case I'd like to try my hand at this! I can probably start working on it Friday!

  9. added
    C-assigned
    on Aug 16, 2018
  10. jdm commented on Aug 16, 2018

    @jdm
    Member

    Please do!

  11. vimpunk commented on Aug 20, 2018

    @vimpunk
    Contributor

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

  12. vimpunk commented on Aug 20, 2018

    @vimpunk
    Contributor

    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.

  13. cbrewster commented on Aug 20, 2018

    @cbrewster
    Contributor

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

  14. vimpunk commented on Aug 20, 2018

    @vimpunk
    Contributor

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

  15. vimpunk commented on Aug 31, 2018

    @vimpunk
    Contributor

    Landed PR #21559.

  16. added 8 commits that reference this issue on Sep 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-constellationC-assignedI-refactor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions