Bug 170058 - [SOUP] URI Fragment is lost after redirect
Summary: [SOUP] URI Fragment is lost after redirect
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-24 10:36 PDT by Paul Ogris
Modified: 2017-04-07 10:22 PDT (History)
5 users (show)

See Also:


Attachments
Patch (15.96 KB, patch)
2017-04-03 03:03 PDT, Carlos Garcia Campos
no flags Details | Formatted Diff | Diff
Patch (16.63 KB, patch)
2017-04-03 03:59 PDT, Carlos Garcia Campos
mcatanzaro: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Ogris 2017-03-24 10:36:27 PDT
When using webkit_web_view_load_uri with the URI "https://hackage.haskell.org/package/bytestring/docs/Data-ByteString.html#v:map", the jump to the specified anchor is never performed. The page itself redirects to the current version of the documentation hosted there, currently  https://hackage.haskell.org/package/bytestring-0.10.8.1/docs/Data-ByteString.html#v:map. Loading this URI directly works as intended. The problem also exists when testing with MiniBrowser. 

How to reproduce:
./MiniBrowser "https://hackage.haskell.org/package/bytestring/docs/Data-ByteString.html#v:map"

Actual Results:
The page is displayed, but not at the anchor point specified

Expected Results:
The page should be scrolled down to the specified anchor. E.g. Firefox preserves the fragment through the redirect.

Tested on Fedora 25, the WebkitGtk version used is 2.14.1.
Comment 1 Alexey Proskuryakov 2017-03-24 12:59:20 PDT

*** This bug has been marked as a duplicate of bug 158420 ***
Comment 2 Brady Eidson 2017-03-24 16:56:25 PDT
(In reply to Alexey Proskuryakov from comment #1)
> 
> *** This bug has been marked as a duplicate of bug 158420 ***

I don't think this is a duplicate of 158420, since 158420 is about a very specific case that occurs on Apple's platforms, whereas this bug is about the original use case mentioned in https://bugs.webkit.org/show_bug.cgi?id=24175 and on non-Apple platforms.

WebKit itself makes no effort to preserve these anchors - It relies on the platform networking library beneath it.

It seems that the curl networking port doesn't do this correctly.
Comment 3 Michael Catanzaro 2017-03-25 07:58:28 PDT
We use the soup backend, not curl.
Comment 4 Brady Eidson 2017-03-26 23:22:22 PDT
(In reply to Michael Catanzaro from comment #3)
> We use the soup backend, not curl.

Yup sorry, misremembered that.
Comment 5 Carlos Garcia Campos 2017-04-03 03:03:54 PDT
Created attachment 306068 [details]
Patch
Comment 6 Carlos Garcia Campos 2017-04-03 03:59:33 PDT
Created attachment 306070 [details]
Patch

Update test expectations of iOS too.
Comment 7 Michael Catanzaro 2017-04-03 07:29:59 PDT
Comment on attachment 306070 [details]
Patch

LGTM, thanks! I'll let Sergio do final review. My only comment is to please file bugs for Mac WK1 and iOS.
Comment 8 Michael Catanzaro 2017-04-03 07:30:37 PDT
Comment on attachment 306070 [details]
Patch

Oh, I thought Sergio had commented in this bug, but I had it mixed up with another. r+ then.
Comment 9 Carlos Garcia Campos 2017-04-03 08:35:40 PDT
See the TestExpectations changes in mac an iOS, bug already exists.
Comment 10 Carlos Garcia Campos 2017-04-03 10:08:26 PDT
Committed r214807: <http://trac.webkit.org/changeset/214807>
Comment 11 Sergio Villar Senin 2017-04-04 01:00:05 PDT
Comment on attachment 306070 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=306070&action=review

> LayoutTests/http/tests/navigation/redirect-preserves-fragment.html:3
> +<head>

No need for <html>, <head> and <body> tags when specifying the DOCTYPE. Same for the other tests.

> Source/WebKit2/NetworkProcess/soup/NetworkDataTaskSoup.cpp:107
> +    m_currentRequest = WTFMove(request);

Not a big fan of adding another element to the internal state of the object.

Also we're doing additional changes of behaviour here in case of multiple redirections because you are no longer using the first request for several checks.
Comment 12 Carlos Garcia Campos 2017-04-04 01:05:17 PDT
(In reply to Sergio Villar Senin from comment #11)
> Comment on attachment 306070 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=306070&action=review
> 
> > LayoutTests/http/tests/navigation/redirect-preserves-fragment.html:3
> > +<head>
> 
> No need for <html>, <head> and <body> tags when specifying the DOCTYPE. Same
> for the other tests.

I copy-pasted it from existing tests, that what I usually do, since I don't know html, css, js :-P

> > Source/WebKit2/NetworkProcess/soup/NetworkDataTaskSoup.cpp:107
> > +    m_currentRequest = WTFMove(request);
> 
> Not a big fan of adding another element to the internal state of the object.

Do you have a better proposal? This is done by NetworkLoad, which could be our client, we could add currentRequest() to the client interface, but I'm not sure it's worth it, TBH.

> Also we're doing additional changes of behaviour here in case of multiple
> redirections because you are no longer using the first request for several
> checks.

That's what fixes bug #158420 for us.
Comment 13 Brady Eidson 2017-04-07 10:22:05 PDT
As I commented over in https://bugs.webkit.org/show_bug.cgi?id=158420#c8, I'm not sure that *always* applying this behavior is correct.

If the investigation in 158420 shows that there's some cases we shouldn't do this, the lib soup implementation should adapt to what we learn.