[Webkit-unassigned] [Bug 85028] [BlackBerry] Cookies should be checked during parsing to improve performance.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue May 8 02:27:15 PDT 2012


https://bugs.webkit.org/show_bug.cgi?id=85028





--- Comment #7 from Jason <jason.liu at torchmobile.com.cn>  2012-05-08 02:27:14 PST ---
(In reply to comment #6)
> In the original code:
> 
> if (cookie->domain()[0] == '.') {
>     // Check if the domain contains an embedded dot.
>     size_t dotPosition = cookie->domain().find(".", 1);
>     if (dotPosition == notFound || dotPosition == cookie->domain().length()) {
>         LOG_ERROR("Cookie %s is rejected because its domain does not contain an embedded dot.\n", cookie->toString().utf8().data());
>         return true;
>     }
> }
> 
> // The request host should domain match the Domain attribute.
> // Domain string starts with a dot, so a.b.com should domain match .a.b.com.
> // add a "." at beginning of host name, because it can handle many cases such as
> // a.b.com matches b.com, a.b.com matches .B.com and a.b.com matches .A.b.Com
> // and so on.
> String hostDomainName = url.host();
> hostDomainName = hostDomainName.startsWith(".") ? hostDomainName : "." + hostDomainName;
> if (!hostDomainName.endsWith(cookie->domain(), false)) {
>     LOG_ERROR("Cookie %s is rejected because its domain does not domain match the URL %s\n", cookie->toString().utf8().data(), url.string().utf8().data());
>     return true;
> }
> 
> // We should check for an embedded dot in the portion of string in the host not in the domain
> // but to match firefox behaviour we do not.
> 
> return false; 
> 
> 
> So for .xxxxx, cookie->domain()[0] is '.' and it skips the first "if" statement entirely.  Then the second "if" statement looks only at url.host() so the dot position in the domain doesn't matter.  Then it returns false, meaning "do not reject this cookie".
> 
> Am I reading that wrong?
> 
In the original code:
if (cookie->domain()[0] == '.') {

For .xxxxx, it won't skip this if statement.
it will go into this if branch and rejected by the following codes.

// Check if the domain contains an embedded dot.
size_t dotPosition = cookie->domain().find(".", 1);
if (dotPosition == notFound || dotPosition == cookie->domain().length())  {
   LOG_ERROR("Cookie %s is rejected because its domain does not contain an embedded dot.\n", cookie->toString().utf8().data());
   return true;
}

So there is no change in behaviour.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list