Skip to content
This repository was archived by the owner on Jul 27, 2018. It is now read-only.
This repository was archived by the owner on Jul 27, 2018. It is now read-only.

mozbrowser should not navigate away but rather ask us to navigate away #553

Closed

Description

@Gozala

Currently mozbrowser iframe sends events for some things like (open window, close window, display context menu) but when user clicks link it just tells us I hey I've started loading and does not even tells what did it start loading.

That is not cool!

Instead it should tell us hey load this uri plz, and then we should decide how do we go about it. For example that would allow us to fully implement tab per domain idea that @gordonbrander had. So for instance if you try to navigate to a different domain we would just create new tab, if it's with in the same domain we will reuse the iframe.

Activity

  1. paulrouget commented on Aug 6, 2015

    @paulrouget
    Contributor

    This is wrong at many level.

    Spec: Page navigation and browsing contexts have a spec. See http://www.w3.org/TR/html5/browsers.html. This doesn't follow the spec.

    Performance: Handling page navigation at the browser level is likely to slow down page loading significantly. This would require IPC communication (slow), it will also require spawning a new process (slow), it will make prerendering impossible (slow). We could keep the navigation logic internal (in the child process), and create a new iframe within the same process and ask browser.html to append it somewhere in the UI (the same way window.open works). But creating a new iframe is slow too, even in the same process, it is not free.

    Memory: we don't open pages like we open apps. The user could literally open thousands of domain per day. Without trashing previous tabs, this will blow up.

    Multiprocess: We can't create one process per tab in this case, so we would need to keep the documents in the same process, ending up with one single process for many many tabs from different domains.

    We could imagine a system where we do not create iframes, but expose the history to the Browser API, and simulate this "tab per domain" mechanism (Browser API would tell us when a page is being navigated away, we would then open a fake tab for the old document and just show a screenshot). Clicking on the tab would just re-use the same iframe and go back in the bfcache. We would have "alive" tabs (iframes), and "dead" tabs (just a div). That might work, but this will require to put the most recent tabs to sleep (make them "dead"), otherwise we would blow up memory again. And this will be a terrible experience for the user (tabs would reload all the time).

    User experience: Even if this is thing we could technically build, I don't see how that will ever be a good experience for the user. How is that interesting for him? Is tab history so important that we want to keep past tabs? Wouldn't that add a lot of noise to the UI and make the tabs mental model too hard to understand? Wouldn't the user spend his time cleaning his tabs?

    I see very little benefits for the user, a lot of UI noise, a lot of technical issues (gecko and servo) and a violation of the spec.

  2. Gozala commented on Aug 7, 2015

    @Gozala
    ContributorAuthor

    This is wrong at many level.

    Spec: Page navigation and browsing contexts have a spec. See http://www.w3.org/TR/html5/browsers.html. This doesn't follow the spec.

    I don't see how this violates spec or how is it different from some of the features we already have in modern browsers:

    1. If you navigate to the page that is blacklisted instead you get to a warning page on firefox that later lets you proceed or abort. Is not that violation of the spec as well ?
    2. When you do ctrl click on a link we do basically what we are aiming for here. Think of it as we press control for a user if domain is different.

    Performance: Handling page navigation at the browser level is likely to slow down page loading significantly. This would require IPC communication (slow),

    Is it that slow, also are these assumptions true in servo ?

    it will also require spawning a new process (slow), it will make prerendering impossible (slow).

    That is invalid assumption, our code may or may not reuse the same iframe (same process) in fact giving more explicit control over process pools may make a lot of current problems go away. Maybe special browsing-group attribute can be created so that iframes could be marked as part of the same group that should signal backend that reuse of the same process is probably appropriate (although it still can decide to use a different one).

    I think huge issue with current API is that it deals with multi-process architecture while not giving any controls presumably to hide implementation details that leak through all over the place causing very limited and awkward API. I think it would be very reasonable to think how some grouping web views into same group (that maybe a process under the hood) to give some control will be a lot more reasonable than current state.

    We could keep the navigation logic internal (in the child process), and create a new iframe within the same process and ask browser.html to append it somewhere in the UI (the same way window.open works). But creating a new iframe is slow too, even in the same process, it is not free.

    window.open is a terrible terrible API last thing I want is to repeat the same mistake. It is really unfortunate artifact of current gecko implementation that caching or preloading is so tide to a specific iframe. It would make a lot more sense to have internal representation (something like a docshell) that can be assigned a unique id and passed via DOM event that when assigned to an iframe will change it's docshell pointer to one with a passed id.

    Again all of this assumptions are very tide to artifacts of current gecko implementation that was not designed for multiprocess or for anything but regular iframes, it would be terrible to limit API by decisions made decades ago for solving a different problem. I imagine a lot of the limitations of gecko may not be valid in servo and if we make compromises they should be driven by limitations of servo.

  3. paulrouget commented on Aug 7, 2015

    @paulrouget
    Contributor

    This is wrong at many level.

    Spec: Page navigation and browsing contexts have a spec. See http://www.w3.org/TR/html5/browsers.html. This doesn't follow the spec.
    I don't see how this violates spec or how is it different from some of the features we already have in modern browsers:

    1. If you navigate to the page that is blacklisted instead you get to a warning page on firefox that later lets you proceed or abort. Is not that violation of the spec as well ?
    2. When you do ctrl click on a link we do basically what we are aiming for here. Think of it as we press control for a user if domain is different.

    This is the responsibility of the page developer to decide to use a different browsing context, not to the user agent. How would you handle, let's say, unload event handlers and the session history in that case?

    These are things described in the spec, assumed by many developers and implemented the same way by all the vendors.

    Want to change that? Please describe how you would change the spec.
    Want to keep it? That means few tabs share a browsing context. But then, please describe how we would handle history, and all the things involved in navigating across the same context: http://www.w3.org/TR/html5/browsers.html#navigate

    Also describe how you make sure you don't break things like "3D secure"-type authentication.

    Performance: Handling page navigation at the browser level is likely to slow down page loading significantly. This would require IPC communication (slow),

    Is it that slow, also are these assumptions true in servo ?

    Spawning a process is slow. Even in servo. But we should really not spawn processes on navigation using the same context. That would severely impact day to day browsing performance.

    I think huge issue with current API is that it deals with multi-process architecture while not giving any controls presumably to hide implementation details that leak through all over the place causing very limited and awkward API. I think it would be very reasonable to think how some grouping web views into same group (that maybe a process under the hood) to give some control will be a lot more reasonable than current state.

    That's not an implementation things. It's how the spec has been designed. If you want grouping, we can use targets. But I'm not sure that would do all the things you want.

    We could keep the navigation logic internal (in the child process), and create a new iframe within the same process and ask browser.html to append it somewhere in the UI (the same way window.open works). But creating a new iframe is slow too, even in the same process, it is not free.

    window.open is a terrible terrible API last thing I want is to repeat the same mistake. It is really unfortunate artifact of current gecko implementation that caching or preloading is so tide to a specific iframe. It would make a lot more sense to have internal representation (something like a docshell) that can be assigned a unique id and passed via DOM event that when assigned to an iframe will change it's docshell pointer to one with a passed id.

    iframes come with their limitation. I agree.

    Again all of this assumptions are very tide to artifacts of current gecko implementation that was not designed for multiprocess or for anything but regular iframes, it would be terrible to limit API by decisions made decades ago for solving a different problem. I imagine a lot of the limitations of gecko may not be valid in servo and if we make compromises they should be driven by limitations of servo.

    I strongly disagree. You say it's a gecko implementation issue. It has nothing to do with Gecko. These are not just assumptions. This behavior has been designed carefully by the different vendors with performance, compatibility and user experience in mind.

    I think the best option is to have multiple tabs (not iframe) representing user's history and share the context across tabs (not iframes). We talked about that when we were in SFO. We could keep content viewers in different states (dead, asleep, alive) and simulate tabs, all sharing one single docshell. That would match the spec. But then we need to describe what happens when the user goes back to these non-alive content viewers. It is not impossible to do, but we need to carefully describe how it would work.

    But again:

    User experience: Even if this is thing we could technically build, I don't see how that will ever be a good experience for the user. How is that interesting for him? Is tab history so important that we want to keep past tabs? Wouldn't that add a lot of noise to the UI and make the tabs mental model too hard to understand? Wouldn't the user spend his time cleaning his tabs?
    I see very little benefits for the user, a lot of UI noise, a lot of technical issues (gecko and servo) and a violation of the spec.

  4. Gozala commented on Aug 7, 2015

    @Gozala
    ContributorAuthor
  5. Gozala commented on Aug 7, 2015

    @Gozala
    ContributorAuthor

    Spawning a process is slow. Even in servo. But we should really not spawn processes on navigation using the same context. That would severely impact day to day browsing performance.

    Who said anything about spawning a new process ? We were talking about sending a message.

    This is the responsibility of the page developer to decide to use a different browsing context, not to the user agent. How would you handle, let's say, unload event handlers and the session history in that case?

    Do you mean user ? Again simple way to think of that is we press ctrl for a user if link point to different domain nothing else changes.

  6. Gozala commented on Aug 7, 2015

    @Gozala
    ContributorAuthor

    I strongly disagree. You say it's a gecko implementation issue. It has nothing to do with Gecko. These are not just assumptions. This behavior has been designed carefully by the different vendors with performance, compatibility and user experience in mind.

    That is not true as I pointed out electron exposes much saner API for say window.open which some how seems to not run into all the issues you've described, there for those issues must be implementation specific.

  7. paulrouget commented on Aug 7, 2015

    @paulrouget
    Contributor

    Who said anything about spawning a new process ? We were talking about sending a message.

    Oops, you're right.

    Do you mean user ? Again simple way to think of that is we press ctrl for a user if link point to different domain nothing else changes.

    But that's a user action. I'm talking about the user agent.

  8. paulrouget commented on Aug 7, 2015

    @paulrouget
    Contributor

    That is not true as I pointed out electron exposes much saner API for say window.open which some how seems to not run into all the issues you've described, there for those issues must be implementation specific.

    Wait, sorry, are you talking about mozbrowseropentab and mozbrowseropebwindowonly?

  9. paulrouget commented on Aug 7, 2015

    @paulrouget
    Contributor

    if you try to navigate to a different domain we would just create new tab

    By "navigate", what do you mean? Because if you don't mean clicking on a link, all the things I said are totally irrelevant.

  10. Gozala commented on Aug 7, 2015

    @Gozala
    ContributorAuthor

    But that's a user action. I'm talking about the user agent.

    User agent also makes calls where to put new tab sometimes next to current sometimes to the end of list

    This is not much different to me. If we are merging notion of history and tabs into something new we would need user agent to do things differently too.

    Agents tend to act on users behalf :) I don't think anything wrong about assisting them in this way :) But anyway @gordonbrander is going to write up how he thinks things should work. As far as I know he want's to treat domains as apps are in android with the backbutton and friends.

  11. Gozala commented on Aug 7, 2015

    @Gozala
    ContributorAuthor

    By "navigate", what do you mean? Because if you don't mean clicking on a link, all the things I said are totally irrelevant.

    Yeah I meant clicking a link, I think browser should be able to decide where and how to load that link.

  12. 6 remaining items

  13. Gozala commented on Aug 7, 2015

    @Gozala
    ContributorAuthor

    As preloading for example chrome preloads when you just hover a link not even click it and when you click it just opens preloaded document. Is that against the spec ? Could we do something along these lines ?

  14. paulrouget commented on Aug 7, 2015

    @paulrouget
    Contributor

    As preloading for example chrome preloads when you just hover a link not even click it and when you click it just opens preloaded document. Is that against the spec

    No.

    Could we do something along these lines ?

    See https://bugzilla.mozilla.org/show_bug.cgi?id=730101

    @paulrouget let me clarify a little, you earlier suggested we could do something along the lines of mozbrowseropen event which I think would be reasonable solution.

    If you decide to switch context, no it is not.

    But than it would also make sense to change that API to be more in lines what electron does, meaning not pass an iframes that needs to be used in the same tick, but rather pass a serialized configuration as handle that embedder could attach to an appropriate iframe.

    That's when you will create a new browsing context.

    But that only happen when: ctrl click (user action), window.open or target attribute are used (dev action).

    If the browser decides to create a new context for other reasons, you will break things. Like online payment for example.

    If you think the browser could change context in certain condition, please look at the spec and see how that would fit in there.

  15. Gozala commented on Aug 7, 2015

    @Gozala
    ContributorAuthor

    @paulrouget so for example here is a scenario where only perf overhead will be IPC message:

    1. User clicks link twitter.com to go to twitter.com/gozala.
    2. We receive event mozbrowsernavigate that has event.detail.uri and event.detail.sessionID
    3. Because it's on the same domain we set iframe.src to event.detail.uri and iframe.sessionID to event.detail.sessionID (that is the same BTW).

    So technically that should do exactly what happens today with only difference that embedder was able to make a decision. In case if it's a different domain we will create new iframe (or maybe reuse one that has same domain) and maybe take some perf hit while doing it but that maybe ok.

  16. paulrouget commented on Aug 7, 2015

    @paulrouget
    Contributor

    But what if you decide to create a new iframe and that the web page expect an unload event?

  17. Gozala commented on Aug 7, 2015

    @Gozala
    ContributorAuthor

    But what if you decide to open a new tab and that the web page expect an unload event?

    Page should not make assumptions on weather user hit's ctrl key or not when clicking links. Also as far as I can tell context is kept with mozbrowseropen event if event.detail.frameElement is used is it not ? At least events seem to fire off.

  18. paulrouget commented on Aug 7, 2015

    @paulrouget
    Contributor

    Page should not make assumptions on weather user hit's ctrl key or not when clicking links

    Yes, it should. It's what written in the spec. And this is how many many website work.

  19. Gozala commented on Aug 7, 2015

    @Gozala
    ContributorAuthor

    Yes, it should. It's what written in the spec. And this is how many many website work.

    So you're saying hitting ctrl while clicking a link on some pages break them ? If so they seem to be broken already no ?

    I feel like you're misunderstanding, what I'm suggesting is that user agent could assist user in clicking ctrl based on some logic. That is it, I do not see how the speck is going to break by this or taking it further spec says nothing about new webview (a.k.a mozbrowser iframe) element and how it should behave. I also don't think that browsing context, tab, and webview are a same thing (even if they are today).

    Now if we really wanna be anal about specs, I don't believe not rendering ads is following current specs either, but that's ok user agent may serve users better and in some cases that may mean they don't blindly follow spec. That in turn will likely cause evolution of specs.

  20. gordonbrander commented on Aug 7, 2015

    @gordonbrander
    Contributor

    @Gozala @paulrouget it feels like we're missing each other in this conversation. I'm unfamiliar with the technical details, but I think the reality is complex. It sounds like Webkit takes one approach, we take another. Mobile Safari must also handle this differently, for example.

    I want to get un-stuck from the details and focus on the goal. Here's what we'll do:

    1. I'll document the design goals and requirements for this feature.
    2. We'll meet Monday and chat about the best way to accomplish those goals.
  21. paulrouget commented on Aug 7, 2015

    @paulrouget
    Contributor

    it feels like we're missing each other in this conversation

    No, I think I understand what's going on.

    It sounds like Webkit takes one approach, we take another. Mobile Safari must also handle this differently, for example.

    Do they? Please explain.

  22. gordonbrander commented on Aug 7, 2015

    @gordonbrander
    Contributor

    nvm "sounds like"... I have a passing familiarity. Anyway, point is, I'd like to refocus on the design goal and figure out the best technical way to accomplish, whatever that might be.

  23. paulrouget commented on Aug 7, 2015

    @paulrouget
    Contributor

    I feel like you're misunderstanding, what I'm suggesting is that user agent could assist user in clicking ctrl based on some logic. That is it, I do not see how the speck is going to break by this or taking it further spec says nothing about new webview (a.k.a mozbrowser iframe) element and how it should behave. I also don't think that browsing context, tab, and webview are a same thing (even if they are today).

    Do you agree that what you want to do is to change the browsing context when the user navigate to a different domain?

    Now if we really wanna be anal about specs

    I don't know what to add to that. I explained why it was designed that way and how things work. Please send a message to dev-platform explaining you want to create a new browsing context on domain change.

    Maybe people will agree with you.

    I just don't see how that could work.

  24. paulrouget commented on Aug 7, 2015

    @paulrouget
    Contributor

    The only solution I see is to have one tab per contentViewer. That would not involve iframe, and that would not go against how navigation works. But again, we'd need to define how navigation works.

    But that so much trouble for a thing that I don't even believe in at the UX level.

  25. Gozala commented on Jan 12, 2016

    @Gozala
    ContributorAuthor

    I don't think we're considering to fix this anytime soon so closing this until then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions