Changeset 24777 in webkit


Ignore:
Timestamp:
Jul 30, 2007 10:28:03 AM (17 years ago)
Author:
andersca
Message:

Reviewed by Darin.

<rdar://problem/4942372> REGRESSION: Anchor links in Mail don't work anymore


Make it possible for KURL to handle addig fragments to non-hierarchical URLs
such as mailto: and cid:.


  • platform/KURL.cpp: (WebCore::KURL::init): If the base URL is not hierarchical but the relative URL is a fragment, then allow parsing it.


(WebCore::KURL::parse):
If the URL is not hierarchical, set the fragment start and end positions correctly.

Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r24776 r24777  
     12007-07-30  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Darin.
     4
     5        <rdar://problem/4942372> REGRESSION: Anchor links in Mail don't work anymore
     6       
     7        Make it possible for KURL to handle addig fragments to non-hierarchical URLs
     8        such as mailto: and cid:.
     9   
     10        * platform/KURL.cpp:
     11        (WebCore::KURL::init):
     12        If the base URL is not hierarchical but the relative URL is a fragment, then
     13        allow parsing it.
     14       
     15        (WebCore::KURL::parse):
     16        If the URL is not hierarchical, set the fragment start and end positions correctly.
     17
    1182007-07-30  Simon Hausmann  <hausmann@kde.org>
    219
  • trunk/WebCore/platform/KURL.cpp

    r24462 r24777  
    11/*
    2  * Copyright (C) 2004 Apple Computer, Inc.  All rights reserved.
     2 * Copyright (C) 2004, 2007 Apple Inc.  All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    1111 *    documentation and/or other materials provided with the distribution.
    1212 *
    13  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
     13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
    1414 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    1515 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     
    349349        parse(str, (allASCII && !strippedStart && (charsToChopOffEnd == 0)) ? &rel : 0);
    350350    } else {
    351         // If the base is empty or opaque (e.g. data: or javascript:), then the URL is invalid.
     351        // If the base is empty or opaque (e.g. data: or javascript:), then the URL is invalid
     352        // unless the relative URL is a single fragment.
    352353        if (!base.isHierarchical()) {
    353             m_isValid = false;
     354            if (str[0] == '#') {
     355                DeprecatedString newURL = base.urlString.left(base.queryEndPos) + str;
     356                parse(newURL.ascii(), &newURL);
     357            } else
     358                m_isValid = false;
     359           
    354360            if (strBuffer)
    355361                fastFree(strBuffer);
     
    10541060
    10551061    if (!hierarchical) {
    1056         while (url[pathEnd] != '\0' && url[pathEnd] != '?') {
     1062        while (url[pathEnd] != '\0' && url[pathEnd] != '?' && url[pathEnd] != '#')
    10571063            pathEnd++;
    1058         }
    1059         queryStart = queryEnd = pathEnd;
    1060 
    1061         while (url[queryEnd] != '\0') {
    1062             queryEnd++;
    1063         }
    1064 
    1065         fragmentStart = fragmentEnd = queryEnd;
     1064       
     1065        queryStart = pathEnd;
     1066        queryEnd = queryStart;
     1067        if (url[queryStart] == '?') {
     1068            while (url[queryEnd] != '\0' && url[queryEnd] != '#')
     1069                queryEnd++;
     1070        }
     1071       
     1072        fragmentStart = queryEnd;
     1073        fragmentEnd = fragmentStart;
     1074        if (url[fragmentStart] == '#') {
     1075            fragmentStart++;
     1076            fragmentEnd = fragmentStart;
     1077            while (url[fragmentEnd] != '\0')
     1078                fragmentEnd++;
     1079        }       
    10661080    }
    10671081    else {
     
    10831097            fragmentStart++;
    10841098            fragmentEnd = fragmentStart;
    1085             while(url[fragmentEnd] != '\0') {
     1099            while (url[fragmentEnd] != '\0') {
    10861100                fragmentEnd++;
    10871101            }
Note: See TracChangeset for help on using the changeset viewer.