Fix handling of cookies without a domain
ClosedPublic

Authored by stefanocrocco on Oct 11 2018, 7:08 PM.

Details

Summary

QWebEngineCookieStore and KCookieServer handle cookies with empty domain
differently:

  • QWebEngineCookieStore gives them a domain which doesn't start with a

dot

  • KCookieServer leave them with no domain and stores the host information

in the host field.

Previously, this difference wasn't taken into account. Now, when adding
a cookie from KCookieServer to QWebEngineCookieStore, the cookie's domain
is set according to the host information and, when adding a cookie to
KCookieServer from QWebEngineCookieStore, the domain is removed if not
starting with a dot.

Test Plan

run autotests

Diff Detail

Repository
R226 Konqueror
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
stefanocrocco requested review of this revision.Oct 11 2018, 7:08 PM
stefanocrocco created this revision.
dfaure requested changes to this revision.Oct 12 2018, 8:06 AM
dfaure added inline comments.
webenginepart/src/webenginepartcookiejar.cpp
135

'.' (a char instead of a string) would be enough here

136

prefer using QString() over "" (faster, simpler at runtime)

337

in case of special characters in the hostname, this concatenation might lead to an incorrect url. It's always better to use QUrl::setScheme and QUrl::setHost.

This revision now requires changes to proceed.Oct 12 2018, 8:06 AM

Made corrections as requested

Any news about this?

dfaure accepted this revision.Oct 22 2018, 7:47 AM
dfaure added inline comments.
webenginepart/autotests/webenginepartcookiejar_test.cpp
255

'.'

256

QString()

This revision is now accepted and ready to land.Oct 22 2018, 7:47 AM
This revision was automatically updated to reflect the committed changes.