Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to handle URL schemes that are not understood during navigation #1446

Closed
annevk opened this issue Jun 21, 2016 · 14 comments
Closed

How to handle URL schemes that are not understood during navigation #1446

annevk opened this issue Jun 21, 2016 · 14 comments

Comments

@annevk
Copy link
Member

annevk commented Jun 21, 2016

Chrome simply terminates navigation synchronously. Firefox displays the equivalent of a "network error". @mikewest, @smaug----?

HTML currently sides with Firefox, though does so in a way that does not delay the load event and such. I believe that also matches Firefox, but it seems rather silly to do that?

@mikewest
Copy link
Member

I think Chrome cancels the navigation synchronously, and tries to find an external handler for the scheme asynchronously. We could probably change that to navigate to an error page if no handler is found. What web-visible implications are you concerned about? Iframe load events?

@annevk
Copy link
Member Author

annevk commented Jun 21, 2016

I'm not really concerned either way. I just want a reasonable model in the specification that everyone implements the same way.

I think what Chrome does might actually be more reasonable, as the Firefox way requires knowing supported protocols in advance.

@bzbarsky thoughts?

@bzbarsky
Copy link
Contributor

Why does the Firefox way (that is, treating it as a network error) require knowing supported protocols in advance? I don't think it does. Note that Firefox does NOT show a network error if we find an external application to handle the protocol, and I'm 99% sure we do that async. Certainly nothing prevents it being done async in theory.

The Chrome way has the drawback that given <a href="foopy:stuff">click me</a> the user clicks the link ... and nothing happens. And there's no feedback as to why nothing happened.

@annevk
Copy link
Member Author

annevk commented Jun 21, 2016

Navigate synchronously invokes "abort the active document" at the moment and also decides synchronously whether to delay the load event and a couple of other things. It could be that all of those are wrong of course and are just as asynchronous as fetching the eventual resource.

@bzbarsky
Copy link
Contributor

I would expect that in Firefox clicking a link aborts the active document whether the protocol is "known" or not. It sounds like it's the Chrome behavior that requires knowing up front whether the protocol is "known"...

@mikewest
Copy link
Member

Note: I wasn't saying that Chrome's UX is perfect or even good. I think I agree with @bzbarsky that we should be showing an error page of some sort. I think we can either do that with our current implementation (e.g. if we don't find a handler, trigger a navigation to some benign endpoint) or by reworking the implementation to check first, then decide what to do with the request.

Note also that navigation in Chrome is undergoing a lot of refactoring to both move responsibility for navigation to the browser process, and to remove all the synchronousness that prevents us from moving frames out of process. Now's a reasonably good time to change things, if there's need for a change.

@annevk
Copy link
Member Author

annevk commented Jun 22, 2016

@mikewest if the folks working on that could communicate what is lacking in the current HTML Standard around navigation that would be great. I'm trying to refactor it while fixing issues in the process and the current state of things in the standard is rather messy.

@annevk
Copy link
Member Author

annevk commented Jun 24, 2016

Okay, so I think that means that step 9 and step 12 need to be taken out of synchronous navigation path.

Coupled with the fact that redirects do not actually jump back to the "fragments" step I think we can simplify navigation around those parts quite a bit.

@bzbarsky
Copy link
Contributor

Okay, so I think that means that step 9 and step 12 need to be taken out of synchronous navigation path.

Why, exactly?

@bzbarsky
Copy link
Contributor

Oh, I misremembered the step numbers. I think that's ok. We should check what UAs do in practice with things like clicking a mailto: link while a document is still loading and whether it stops the load or not.

@annevk
Copy link
Member Author

annevk commented Jun 24, 2016

That is the result I get in Chrome (hard to reproduce in Firefox since mailto: navigates to Gmail for me there): <iframe src=http://software.hixie.ch/utilities/cgi/test-tools/delayed-file?pause=5&mime=text/plain&text=HEY name=test></iframe><a href=mailto:a@a target=test>test</a> (in Live DOM Viewer, just hit "test" within 5 seconds).

@bzbarsky
Copy link
Contributor

Hmm. So Chrome stops the load on that testcase. Firefox does not, looks like.

From a user experience perspective not stopping is vastly better, of course... on the other hand your example of protocol handlers implemented via navigating away entirely means the user experience is kinda sucky in somewhat unpredictable ways already.

@annevk
Copy link
Member Author

annevk commented Jun 24, 2016

Note also that we could get that scheme as the result of a redirect. Arguably "aborting" shouldn't happen synchronously, but rather until we have enough information to make an informed decision, but it is probably too late for that.

@annevk annevk mentioned this issue Jun 28, 2016
6 tasks
annevk added a commit that referenced this issue Jun 30, 2016
Redirect handling had the following issues that are now fixed:

* /a navigating to /b which redirects to /a#test would not unload /a.
* Headers set on the initial request were not preserved.
* Redirects to javascript URLs would not result in an error.
  Fixes #314.
* Location header was not parsed, and HTTP method was not changed
  where needed. Fixes #461.

Another source of complexity was the "gone async" mechanism, which
was used for two steps that could just as easily be factored out and
had to be since they were run synchronously, but should not be.

Changing that fixes #1446 which discusses the issue around unknown
URL schemes in more detail.
annevk added a commit that referenced this issue Jun 30, 2016
Redirect handling had the following issues that are now fixed:

* /a navigating to /b which redirects to /a#test would not unload /a.
* Headers set on the initial request were not preserved.
* Redirects to javascript URLs would not result in an error.
  Fixes #314.
* Location header was not parsed, and HTTP method was not changed
  where needed. Fixes #461.

Another source of complexity was the "gone async" mechanism, which
was used for two steps that could just as easily be factored out and
had to be since they were run synchronously, but should not be.

Changing that fixes #1446 which discusses the issue around unknown
URL schemes in more detail.
@annevk
Copy link
Member Author

annevk commented Jun 30, 2016

#1476 attempts to fix this.

@annevk annevk closed this as completed in 8b630f5 Jul 4, 2016
alice pushed a commit to alice/html that referenced this issue Jan 8, 2019
Redirect handling had the following issues that are now fixed:

* /a navigating to /b which redirects to /a#test would not unload /a.
* Headers set on the initial request were not preserved.
* Redirects to javascript URLs would not result in an error.
  Fixes whatwg#314.
* Location header was not parsed, and HTTP method was not changed
  where needed. Fixes whatwg#461.

Another source of complexity was the "gone async" mechanism, which
was used for two steps that could just as easily be factored out and
had to be since they were run synchronously, but should not be.

Changing that fixes whatwg#1446 which discusses the issue around unknown
URL schemes in more detail.

multipart/x-mixed-replace no longer invokes the navigate algorithm 
halfway through, but instead invokes a dedicated algorithm.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants