Changeset 39845 in webkit


Ignore:
Timestamp:
Jan 12, 2009 4:15:14 PM (15 years ago)
Author:
beidson@apple.com
Message:

WebCore:

2009-01-12 Brady Eidson <beidson@apple.com>

Reviewed by Darin Adler

<rdar://problem/6468274> - Track Non-get requests in global history

  • WebCore.base.exp:
  • history/HistoryItem.cpp: (WebCore::HistoryItem::HistoryItem):
  • history/HistoryItem.h: (WebCore::HistoryItem::lastVisitWasHTTPNonGet): (WebCore::HistoryItem::setLastVisitWasHTTPNonGet):

WebKit/mac:

2009-01-12 Brady Eidson <beidson@apple.com>

Reviewed by Darin Adler

<rdar://problem/6468274> - Track Non-get requests in global history

  • History/WebHistory.mm: (-[WebHistory _visitedURL:withTitle:method:wasFailure:]):
  • History/WebHistoryInternal.h:
  • History/WebHistoryItem.mm: (-[WebHistoryItem initFromDictionaryRepresentation:]): (-[WebHistoryItem dictionaryRepresentation]): (-[WebHistoryItem _lastVisitWasHTTPNonGet]):
  • History/WebHistoryItemPrivate.h:
  • WebCoreSupport/WebFrameLoaderClient.mm: (WebFrameLoaderClient::updateGlobalHistory): Only pass the method through if it was an HTTP load

WebKit/win:

2009-01-12 Brady Eidson <beidson@apple.com>

Reviewed by Darin Adler

<rdar://problem/6468274> - Track Non-get requests in global history

  • WebCoreSupport/WebFrameLoaderClient.cpp: (WebFrameLoaderClient::updateGlobalHistory):
  • WebHistory.cpp: (WebHistory::addItem):
  • WebHistory.h:
  • Interfaces/IWebHistoryItemPrivate.idl:
  • WebHistoryItem.cpp: (WebHistoryItem::initFromDictionaryRepresentation): (WebHistoryItem::dictionaryRepresentation): (WebHistoryItem::lastVisitWasHTTPNonGet): (WebHistoryItem::setLastVisitWasHTTPNonGet):
  • WebHistoryItem.h:
Location:
trunk
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r39843 r39845  
     12009-01-12  Brady Eidson  <beidson@apple.com>
     2
     3        Reviewed by Darin Adler
     4
     5        <rdar://problem/6468274> - Track Non-get requests in global history
     6
     7        * WebCore.base.exp:
     8
     9        * history/HistoryItem.cpp:
     10        (WebCore::HistoryItem::HistoryItem):
     11        * history/HistoryItem.h:
     12        (WebCore::HistoryItem::lastVisitWasHTTPNonGet):
     13        (WebCore::HistoryItem::setLastVisitWasHTTPNonGet):
     14
    1152009-01-12  Kevin Ollivier  <kevino@theolliviers.com>
    216
  • trunk/WebCore/WebCore.base.exp

    r39823 r39845  
    131131__ZN7WebCore10ScrollView17setScrollbarModesENS_13ScrollbarModeES1_
    132132__ZN7WebCore10ScrollView20setCanHaveScrollbarsEb
    133 __ZNK7WebCore10ScrollView18visibleContentRectEb
     133__ZN7WebCore10StringImpl11reverseFindEPS0_ib
    134134__ZN7WebCore10StringImpl7replaceEtt
    135135__ZN7WebCore10StringImpl8endsWithEPS0_b
     
    621621__ZN7WebCore8parseURLERKNS_6StringE
    622622__ZN7WebCore9FloatRectC1ERK7_NSRect
    623 __ZN7WebCore9fontCacheEv
    624623__ZN7WebCore9FontCache13fontDataCountEv
    625624__ZN7WebCore9FontCache21inactiveFontDataCountEv
     
    685684__ZN7WebCore9TimerBaseC2Ev
    686685__ZN7WebCore9TimerBaseD2Ev
     686__ZN7WebCore9fontCacheEv
    687687__ZN7WebCore9makeRangeERKNS_15VisiblePositionES2_
    688688__ZN7WebCore9pageCacheEv
     
    695695__ZNK7WebCore10ScrollView12documentViewEv
    696696__ZNK7WebCore10ScrollView14scrollbarModesERNS_13ScrollbarModeES2_
     697__ZNK7WebCore10ScrollView18visibleContentRectEb
    697698__ZNK7WebCore11CachedImage5imageEv
    698699__ZNK7WebCore11ContextMenu19platformDescriptionEv
     
    788789__ZNK7WebCore19InspectorController17drawNodeHighlightERNS_15GraphicsContextE
    789790__ZNK7WebCore19InspectorController7enabledEv
     791__ZNK7WebCore19ResourceRequestBase10httpMethodEv
    790792__ZNK7WebCore19ResourceRequestBase3urlEv
    791793__ZNK7WebCore19ResourceRequestBase7isEmptyEv
  • trunk/WebCore/history/HistoryItem.cpp

    r38449 r39845  
    4545HistoryItem::HistoryItem()
    4646    : m_lastVisitedTime(0)
     47    , m_lastVisitWasHTTPNonGet(false)
    4748    , m_lastVisitWasFailure(false)
    4849    , m_isInPageCache(false)
     
    5758    , m_title(title)
    5859    , m_lastVisitedTime(time)
     60    , m_lastVisitWasHTTPNonGet(false)
    5961    , m_lastVisitWasFailure(false)
    6062    , m_isInPageCache(false)
     
    7173    , m_displayTitle(alternateTitle)
    7274    , m_lastVisitedTime(time)
     75    , m_lastVisitWasHTTPNonGet(false)
    7376    , m_lastVisitWasFailure(false)
    7477    , m_isInPageCache(false)
     
    8689    , m_title(title)
    8790    , m_lastVisitedTime(0)
     91    , m_lastVisitWasHTTPNonGet(false)
    8892    , m_lastVisitWasFailure(false)
    8993    , m_isInPageCache(false)
     
    109113    , m_displayTitle(item.m_displayTitle)
    110114    , m_lastVisitedTime(item.m_lastVisitedTime)
     115    , m_lastVisitWasHTTPNonGet(item.m_lastVisitWasHTTPNonGet)
    111116    , m_scrollPoint(item.m_scrollPoint)
    112117    , m_lastVisitWasFailure(item.m_lastVisitWasFailure)
  • trunk/WebCore/history/HistoryItem.h

    r38449 r39845  
    102102    int visitCount() const;
    103103    bool lastVisitWasFailure() const { return m_lastVisitWasFailure; }
     104    bool lastVisitWasHTTPNonGet() const { return m_lastVisitWasHTTPNonGet; }
    104105
    105106    void mergeAutoCompleteHints(HistoryItem* otherItem);
     
    125126    void setVisitCount(int);
    126127    void setLastVisitWasFailure(bool wasFailure) { m_lastVisitWasFailure = wasFailure; }
     128    void setLastVisitWasHTTPNonGet(bool wasNotGet) { m_lastVisitWasHTTPNonGet = wasNotGet; }
    127129
    128130    void addChildItem(PassRefPtr<HistoryItem>);
     
    176178   
    177179    double m_lastVisitedTime;
     180    bool m_lastVisitWasHTTPNonGet;
    178181
    179182    IntPoint m_scrollPoint;
  • trunk/WebKit/mac/ChangeLog

    r39840 r39845  
     12009-01-12  Brady Eidson  <beidson@apple.com>
     2
     3        Reviewed by Darin Adler
     4
     5        <rdar://problem/6468274> - Track Non-get requests in global history
     6
     7        * History/WebHistory.mm:
     8        (-[WebHistory _visitedURL:withTitle:method:wasFailure:]):
     9        * History/WebHistoryInternal.h:
     10
     11        * History/WebHistoryItem.mm:
     12        (-[WebHistoryItem initFromDictionaryRepresentation:]):
     13        (-[WebHistoryItem dictionaryRepresentation]):
     14        (-[WebHistoryItem _lastVisitWasHTTPNonGet]):
     15        * History/WebHistoryItemPrivate.h:
     16
     17        * WebCoreSupport/WebFrameLoaderClient.mm:
     18        (WebFrameLoaderClient::updateGlobalHistory): Only pass the method through if it was an HTTP load
     19
    1202009-01-12  Anders Carlsson  <andersca@apple.com>
    221
  • trunk/WebKit/mac/History/WebHistory.mm

    r39481 r39845  
    795795@implementation WebHistory (WebInternal)
    796796
    797 - (void)_visitedURL:(NSURL *)URL withTitle:(NSString *)title wasFailure:(BOOL)wasFailure
     797- (void)_visitedURL:(NSURL *)URL withTitle:(NSString *)title method:(NSString *)method wasFailure:(BOOL)wasFailure
    798798{
    799799    WebHistoryItem *entry = [_historyPrivate visitedURL:URL withTitle:title];
    800     core(entry)->setLastVisitWasFailure(wasFailure);
     800    HistoryItem* item = core(entry);
     801    item->setLastVisitWasFailure(wasFailure);
     802    if ([method length] && [method caseInsensitiveCompare:@"GET"])
     803        item->setLastVisitWasHTTPNonGet(true);
    801804
    802805    NSArray *entries = [[NSArray alloc] initWithObjects:entry, nil];
  • trunk/WebKit/mac/History/WebHistoryInternal.h

    r38728 r39845  
    3434
    3535@interface WebHistory (WebInternal)
    36 - (void)_visitedURL:(NSURL *)URL withTitle:(NSString *)title wasFailure:(BOOL)wasFailure;
     36- (void)_visitedURL:(NSURL *)URL withTitle:(NSString *)title method:(NSString *)method wasFailure:(BOOL)wasFailure;
    3737- (void)_addVisitedLinksToPageGroup:(WebCore::PageGroup&)group;
    3838@end
  • trunk/WebKit/mac/History/WebHistoryItem.mm

    r39636 r39845  
    5757// Private keys used in the WebHistoryItem's dictionary representation.
    5858// see 3245793 for explanation of "lastVisitedDate"
    59 static NSString *WebLastVisitedTimeIntervalKey = @"lastVisitedDate";
    60 static NSString *WebVisitCountKey = @"visitCount";
    61 static NSString *WebTitleKey = @"title";
    62 static NSString *WebChildrenKey = @"children";
    63 static NSString *WebDisplayTitleKey = @"displayTitle";
     59static NSString *lastVisitedTimeIntervalKey = @"lastVisitedDate";
     60static NSString *visitCountKey = @"visitCount";
     61static NSString *titleKey = @"title";
     62static NSString *childrenKey = @"children";
     63static NSString *displayTitleKey = @"displayTitle";
    6464static NSString *lastVisitWasFailureKey = @"lastVisitWasFailure";
     65static NSString *lastVisitWasHTTPNonGetKey = @"lastVisitWasHTTPNonGet";
    6566
    6667// Notification strings.
     
    336337    ASSERT_MAIN_THREAD();
    337338    NSString *URLString = [dict _webkit_stringForKey:@""];
    338     NSString *title = [dict _webkit_stringForKey:WebTitleKey];
     339    NSString *title = [dict _webkit_stringForKey:titleKey];
    339340
    340341    // Do an existence check to avoid calling doubleValue on a nil string. Leave
    341342    // time interval at 0 if there's no value in dict.
    342     NSString *timeIntervalString = [dict _webkit_stringForKey:WebLastVisitedTimeIntervalKey];
     343    NSString *timeIntervalString = [dict _webkit_stringForKey:lastVisitedTimeIntervalKey];
    343344    NSTimeInterval lastVisited = timeIntervalString == nil ? 0 : [timeIntervalString doubleValue];
    344345
    345     self = [self initWithURLString:URLString title:title displayTitle:[dict _webkit_stringForKey:WebDisplayTitleKey] lastVisitedTimeInterval:lastVisited];
     346    self = [self initWithURLString:URLString title:title displayTitle:[dict _webkit_stringForKey:displayTitleKey] lastVisitedTimeInterval:lastVisited];
    346347   
    347348    // Check if we've read a broken URL from the file that has non-Latin1 chars.  If so, try to convert
     
    355356    }
    356357
    357     core(_private)->setVisitCount([dict _webkit_intForKey:WebVisitCountKey]);
     358    core(_private)->setVisitCount([dict _webkit_intForKey:visitCountKey]);
    358359
    359360    if ([dict _webkit_boolForKey:lastVisitWasFailureKey])
    360361        core(_private)->setLastVisitWasFailure(true);
    361 
    362     NSArray *childDicts = [dict objectForKey:WebChildrenKey];
     362   
     363    BOOL lastVisitWasHTTPNonGet = [dict _webkit_boolForKey:lastVisitWasHTTPNonGetKey];
     364    NSString *tempURLString = [URLString lowercaseString];
     365    if (lastVisitWasHTTPNonGet && ([tempURLString hasPrefix:@"http:"] || [tempURLString hasPrefix:@"https:"]))
     366        core(_private)->setLastVisitWasHTTPNonGet(lastVisitWasHTTPNonGet);
     367
     368    NSArray *childDicts = [dict objectForKey:childrenKey];
    363369    if (childDicts) {
    364370        for (int i = [childDicts count] - 1; i >= 0; i--) {
     
    408414    }
    409415    if (!coreItem->title().isEmpty()) {
    410         [dict setObject:(NSString*)coreItem->title() forKey:WebTitleKey];
     416        [dict setObject:(NSString*)coreItem->title() forKey:titleKey];
    411417    }
    412418    if (!coreItem->alternateTitle().isEmpty()) {
    413         [dict setObject:(NSString*)coreItem->alternateTitle() forKey:WebDisplayTitleKey];
     419        [dict setObject:(NSString*)coreItem->alternateTitle() forKey:displayTitleKey];
    414420    }
    415421    if (coreItem->lastVisitedTime() != 0.0) {
    416422        // store as a string to maintain backward compatibility (see 3245793)
    417423        [dict setObject:[NSString stringWithFormat:@"%.1lf", coreItem->lastVisitedTime()]
    418                  forKey:WebLastVisitedTimeIntervalKey];
     424                 forKey:lastVisitedTimeIntervalKey];
    419425    }
    420426    if (coreItem->visitCount())
    421         [dict setObject:[NSNumber numberWithInt:coreItem->visitCount()] forKey:WebVisitCountKey];
     427        [dict setObject:[NSNumber numberWithInt:coreItem->visitCount()] forKey:visitCountKey];
    422428    if (coreItem->lastVisitWasFailure())
    423429        [dict setObject:[NSNumber numberWithBool:YES] forKey:lastVisitWasFailureKey];
     430
     431    if (coreItem->lastVisitWasHTTPNonGet()) {
     432        ASSERT(coreItem->urlString().startsWith("http:", false) || coreItem->urlString().startsWith("https:", false));
     433        [dict setObject:[NSNumber numberWithBool:YES] forKey:lastVisitWasHTTPNonGetKey];
     434    }
     435   
    424436    if (coreItem->children().size()) {
    425437        const HistoryItemVector& children = coreItem->children();
     
    428440        for (int i = children.size() - 1; i >= 0; i--)
    429441            [childDicts addObject:[kit(children[i].get()) dictionaryRepresentation]];
    430         [dict setObject: childDicts forKey:WebChildrenKey];
     442        [dict setObject: childDicts forKey:childrenKey];
    431443    }
    432444
     
    540552}
    541553
     554- (BOOL)_lastVisitWasHTTPNonGet
     555{
     556    return core(_private)->lastVisitWasHTTPNonGet();
     557}
     558
    542559@end
    543560
  • trunk/WebKit/mac/History/WebHistoryItemPrivate.h

    r39636 r39845  
    4040- (void)_setLastVisitWasFailure:(BOOL)failure;
    4141
     42- (BOOL)_lastVisitWasHTTPNonGet;
     43
    4244- (NSString *)RSSFeedReferrer;
    4345- (void)setRSSFeedReferrer:(NSString *)referrer;
  • trunk/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm

    r39566 r39845  
    790790    const String& title = loader->title();
    791791    bool wasFailure = loader->urlForHistoryReflectsFailure();
    792     [[WebHistory optionalSharedHistory] _visitedURL:url withTitle:title wasFailure:wasFailure];
     792    [[WebHistory optionalSharedHistory] _visitedURL:url withTitle:title method:loader->request().httpMethod() wasFailure:wasFailure];
    793793}
    794794
  • trunk/WebKit/win/ChangeLog

    r39823 r39845  
     12009-01-12  Brady Eidson  <beidson@apple.com>
     2
     3        Reviewed by Darin Adler
     4
     5        <rdar://problem/6468274> - Track Non-get requests in global history
     6
     7        * WebCoreSupport/WebFrameLoaderClient.cpp:
     8        (WebFrameLoaderClient::updateGlobalHistory):
     9
     10        * WebHistory.cpp:
     11        (WebHistory::addItem):
     12        * WebHistory.h:
     13
     14        * Interfaces/IWebHistoryItemPrivate.idl:
     15        * WebHistoryItem.cpp:
     16        (WebHistoryItem::initFromDictionaryRepresentation):
     17        (WebHistoryItem::dictionaryRepresentation):
     18        (WebHistoryItem::lastVisitWasHTTPNonGet):
     19        (WebHistoryItem::setLastVisitWasHTTPNonGet):
     20        * WebHistoryItem.h:
     21
    1222009-01-12  Julien Chaffraix  <jchaffraix@pleyo.com>
    223
  • trunk/WebKit/win/Interfaces/IWebHistoryItemPrivate.idl

    r38728 r39845  
    5858    HRESULT lastVisitWasFailure([out, retval] BOOL* wasFailure);
    5959    HRESULT setLastVisitWasFailure([in] BOOL wasFailure);
     60    HRESULT lastVisitWasHTTPNonGet([out, retval] BOOL* HTTPNonGet);
    6061}
  • trunk/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp

    r39763 r39845  
    457457        return;
    458458    DocumentLoader* loader = core(m_webFrame)->loader()->documentLoader();
    459     history->addItem(loader->urlForHistory(), loader->title(), loader->urlForHistoryReflectsFailure());                 
     459    history->addItem(loader->urlForHistory(), loader->title(), loader->request().httpMethod(), loader->urlForHistoryReflectsFailure());                 
    460460}
    461461
  • trunk/WebKit/win/WebHistory.cpp

    r39425 r39845  
    669669}
    670670
    671 void WebHistory::addItem(const KURL& url, const String& title, bool wasFailure)
     671void WebHistory::addItem(const KURL& url, const String& title, const String& httpMethod, bool wasFailure)
    672672{
    673673    COMPtr<WebHistoryItem> item(AdoptCOM, WebHistoryItem::createInstance());
     
    691691    if (wasFailure)
    692692        item->setLastVisitWasFailure(true);
     693   
     694    if (!httpMethod.isEmpty() && !equalIgnoringCase(httpMethod, "GET"))
     695        item->setLastVisitWasHTTPNonGet(true);
    693696
    694697    addItem(item.get());
  • trunk/WebKit/win/WebHistory.h

    r39425 r39845  
    116116    // WebHistory
    117117    static WebHistory* sharedHistory();
    118     void addItem(const WebCore::KURL&, const WebCore::String& title, bool wasFailure);
     118    void addItem(const WebCore::KURL&, const WebCore::String& title, const WebCore::String& httpMethod, bool wasFailure);
    119119    void addVisitedLinksToPageGroup(WebCore::PageGroup&);
    120120
  • trunk/WebKit/win/WebHistoryItem.cpp

    r38728 r39845  
    3535#include <WebCore/BString.h>
    3636#include <WebCore/HistoryItem.h>
     37#include <WebCore/KURL.h>
    3738#pragma warning(pop)
    3839
     
    9697static CFStringRef visitCountKey = CFSTR("visitCount");
    9798static CFStringRef lastVisitWasFailureKey = CFSTR("lastVisitWasFailure");
     99static CFStringRef lastVisitWasHTTPNonGetKey = CFSTR("lastVisitWasHTTPNonGet");
    98100
    99101HRESULT STDMETHODCALLTYPE WebHistoryItem::initFromDictionaryRepresentation(void* dictionary)
     
    125127        return E_FAIL;
    126128    bool lastVisitWasFailure = lastVisitWasFailureRef && CFBooleanGetValue(lastVisitWasFailureRef);
     129
     130    CFBooleanRef lastVisitWasHTTPNonGetRef = static_cast<CFBooleanRef>(CFDictionaryGetValue(dictionaryRef, lastVisitWasHTTPNonGetKey));
     131    if (lastVisitWasHTTPNonGetRef && CFGetTypeID(lastVisitWasHTTPNonGetRef) != CFBooleanGetTypeID())
     132        return E_FAIL;
     133    bool lastVisitWasHTTPNonGet = lastVisitWasHTTPNonGetRef && CFBooleanGetValue(lastVisitWasHTTPNonGetRef);
    127134
    128135    historyItemWrappers().remove(m_historyItem.get());
     
    133140    if (lastVisitWasFailure)
    134141        m_historyItem->setLastVisitWasFailure(true);
     142
     143    if (lastVisitWasHTTPNonGet && (protocolIs(m_historyItem->urlString(), "http") || protocolIs(m_historyItem->urlString(), "https")))
     144        m_historyItem->setLastVisitWasHTTPNonGet(true);
    135145
    136146    return S_OK;
     
    147157
    148158    int keyCount = 0;
    149     CFTypeRef keys[5];
    150     CFTypeRef values[5];
     159    CFTypeRef keys[6];
     160    CFTypeRef values[6];
    151161
    152162    if (!m_historyItem->urlString().isEmpty()) {
     
    169179    if (m_historyItem->lastVisitWasFailure()) {
    170180        keys[keyCount] = lastVisitWasFailureKey;
     181        values[keyCount++] = CFRetain(kCFBooleanTrue);
     182    }
     183
     184    if (m_historyItem->lastVisitWasHTTPNonGet()) {
     185        ASSERT(m_historyItem->urlString().startsWith("http:", false) || m_historyItem->urlString().startsWith("https:", false));
     186        keys[keyCount] = lastVisitWasHTTPNonGetKey;
    171187        values[keyCount++] = CFRetain(kCFBooleanTrue);
    172188    }
     
    336352{
    337353    m_historyItem->setLastVisitWasFailure(wasFailure);
     354    return S_OK;
     355}
     356
     357HRESULT STDMETHODCALLTYPE WebHistoryItem::lastVisitWasHTTPNonGet(BOOL* HTTPNonGet)
     358{
     359    if (!HTTPNonGet) {
     360        ASSERT_NOT_REACHED();
     361        return E_POINTER;
     362    }
     363
     364    *HTTPNonGet = m_historyItem->lastVisitWasHTTPNonGet();
     365
     366    return S_OK;
     367}
     368
     369HRESULT STDMETHODCALLTYPE WebHistoryItem::setLastVisitWasHTTPNonGet(BOOL HTTPNonGet)
     370{
     371    m_historyItem->setLastVisitWasHTTPNonGet(HTTPNonGet);
    338372    return S_OK;
    339373}
  • trunk/WebKit/win/WebHistoryItem.h

    r38728 r39845  
    100100    virtual HRESULT STDMETHODCALLTYPE lastVisitWasFailure(BOOL* wasFailure);
    101101    virtual HRESULT STDMETHODCALLTYPE setLastVisitWasFailure(BOOL wasFailure);
     102    virtual HRESULT STDMETHODCALLTYPE lastVisitWasHTTPNonGet(BOOL* HTTPNonGet);
     103    virtual HRESULT STDMETHODCALLTYPE setLastVisitWasHTTPNonGet(BOOL HTTPNonGet);
    102104
    103105    // WebHistoryItem
Note: See TracChangeset for help on using the changeset viewer.