⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 170671 in webkit


Ignore:
Timestamp:
Jul 1, 2014, 3:34:10 PM (12 years ago)
Author:
andersca@apple.com
Message:

Use the new legacy session state coding in WKPageCopySessionState
​https://bugs.webkit.org/show_bug.cgi?id=134516

Reviewed by Tim Horton.

  • UIProcess/API/C/WKPage.cpp:

(WKPageCopySessionState):
Call encodeLegacySessionState.

  • UIProcess/mac/LegacySessionStateCoding.cpp:

(WebKit::encodeSessionHistoryEntryData):
Use leakPtr() so we won't attempt to double-free the buffer.

(WebKit::createDictionary):
Fix a typo.

(WebKit::encodeLegacySessionState):
Don't encode the provisional URL if it's empty.

Location:
trunk/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r170670 r170671  
     12014-07-01  Anders Carlsson  <andersca@apple.com>
     2
     3        Use the new legacy session state coding in WKPageCopySessionState
     4        https://bugs.webkit.org/show_bug.cgi?id=134516
     5
     6        Reviewed by Tim Horton.
     7
     8        * UIProcess/API/C/WKPage.cpp:
     9        (WKPageCopySessionState):
     10        Call encodeLegacySessionState.
     11
     12        * UIProcess/mac/LegacySessionStateCoding.cpp:
     13        (WebKit::encodeSessionHistoryEntryData):
     14        Use leakPtr() so we won't attempt to double-free the buffer.
     15
     16        (WebKit::createDictionary):
     17        Fix a typo.
     18
     19        (WebKit::encodeLegacySessionState):
     20        Don't encode the provisional URL if it's empty.
     21
    1222014-07-01  Chris Fleizach  <cfleizach@apple.com>
    223
  • trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp

    r170657 r170671  
    3535#include "APIUIClient.h"
    3636#include "ImmutableDictionary.h"
     37#include "LegacySessionStateCoding.h"
    3738#include "NativeWebKeyboardEvent.h"
    3839#include "NativeWebWheelEvent.h"
    … …  
    352353WKDataRef WKPageCopySessionState(WKPageRef pageRef, void *context, WKPageSessionStateFilterCallback filter)
    353354{
    354     return toAPI(toImpl(pageRef)->sessionStateData([pageRef, context, filter](WebBackForwardListItem& item) {
     355    auto sessionState = toImpl(pageRef)->sessionState([pageRef, context, filter](WebBackForwardListItem& item) {
    355356        if (filter) {
    356357            if (!filter(pageRef, WKPageGetSessionBackForwardListItemValueType(), toAPI(&item), context))
    … …  
    362363
    363364        return true;
    364     }).leakRef());
     365    });
     366
     367    return toAPI(encodeLegacySessionState(sessionState).release().leakRef());
    365368}
    366369
  • trunk/Source/WebKit2/UIProcess/mac/LegacySessionStateCoding.cpp

    r170658 r170671  
    402402    auto buffer = encodeSessionHistoryEntryData(frameState, bufferSize);
    403403
    404     return adoptCF(CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, buffer.get(), bufferSize, fastMallocDeallocator));
     404    return adoptCF(CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, buffer.leakPtr(), bufferSize, fastMallocDeallocator));
    405405}
    406406
    … …  
    415415    for (const auto& keyValuePair : keyValuePairs) {
    416416        keys.uncheckedAppend(keyValuePair.first);
    417         keys.uncheckedAppend(keyValuePair.second);
     417        values.uncheckedAppend(keyValuePair.second);
    418418    }
    419419
    … …  
    452452{
    453453    auto sessionHistoryDictionary = encodeSessionHistory(sessionState.backForwardListState);
    454     auto provisionalURLString = sessionState.provisionalURL.string().createCFString();
     454    auto provisionalURLString = sessionState.provisionalURL.isNull() ? nullptr : sessionState.provisionalURL.string().createCFString();
    455455
    456456    RetainPtr<CFDictionaryRef> stateDictionary;
Note: See TracChangeset for help on using the changeset viewer.