Changeset 128812 in webkit


Ignore:
Timestamp:
Sep 17, 2012 3:05:27 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Unreviewed, rolling out r128809.
http://trac.webkit.org/changeset/128809
https://bugs.webkit.org/show_bug.cgi?id=96958

Broke the Windows build. (Requested by andersca on #webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2012-09-17

Source/WebCore:

  • platform/win/BString.cpp:

(WebCore::BString::~BString):
(WebCore::BString::adoptBSTR):

  • platform/win/BString.h:

(BString):

Source/WebKit/win:

  • DefaultPolicyDelegate.cpp:

(DefaultPolicyDelegate::decidePolicyForNavigationAction):
(DefaultPolicyDelegate::decidePolicyForMIMEType):
(DefaultPolicyDelegate::unableToImplementPolicyWithError):

  • MarshallingHelpers.cpp:

(MarshallingHelpers::KURLToBSTR):
(MarshallingHelpers::CFStringRefToBSTR):
(MarshallingHelpers::stringArrayToSafeArray):
(MarshallingHelpers::safeArrayToStringArray):

  • WebCoreSupport/WebChromeClient.cpp:

(WebChromeClient::runJavaScriptPrompt):

  • WebCoreSupport/WebEditorClient.cpp:

(WebEditorClient::checkGrammarOfString):
(WebEditorClient::getGuessesForWord):

  • WebFrame.cpp:

(WebFrame::canProvideDocumentSource):

  • WebHistory.cpp:

(WebHistory::removeItem):
(WebHistory::addItem):

  • WebIconDatabase.cpp:

(WebIconDatabase::startUpIconDatabase):

  • WebNotificationCenter.cpp:

(WebNotificationCenter::postNotification):

  • WebPreferences.cpp:

(WebPreferences::setStringValue):

  • WebView.cpp:

(PreferencesChangedOrRemovedObserver::onNotify):
(WebView::close):
(WebView::canShowMIMEType):
(WebView::initWithFrame):
(WebView::setApplicationNameForUserAgent):
(WebView::setCustomUserAgent):
(WebView::userAgentForURL):
(WebView::setCustomTextEncodingName):
(WebView::customTextEncodingName):
(WebView::setPreferences):
(WebView::searchFor):
(WebView::executeCoreCommandByName):
(WebView::markAllMatchesForText):
(WebView::setGroupName):
(WebView::registerURLSchemeAsLocal):
(WebView::replaceSelectionWithText):
(WebView::onNotify):
(WebView::notifyPreferencesChanged):
(WebView::MIMETypeForExtension):
(WebView::standardUserAgentWithApplicationName):
(WebView::addAdditionalPluginDirectory):
(WebView::registerEmbeddedViewMIMEType):
(toString):
(toKURL):
(WebView::addOriginAccessWhitelistEntry):
(WebView::removeOriginAccessWhitelistEntry):
(WebView::geolocationDidFailWithError):
(WebView::setDomainRelaxationForbiddenForURLScheme):
(WebView::setCompositionForTesting):
(WebView::confirmCompositionForTesting):

Location:
trunk/Source
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r128809 r128812  
     12012-09-17  Sheriff Bot  <webkit.review.bot@gmail.com>
     2
     3        Unreviewed, rolling out r128809.
     4        http://trac.webkit.org/changeset/128809
     5        https://bugs.webkit.org/show_bug.cgi?id=96958
     6
     7        Broke the Windows build. (Requested by andersca on #webkit).
     8
     9        * platform/win/BString.cpp:
     10        (WebCore::BString::~BString):
     11        (WebCore::BString::adoptBSTR):
     12        * platform/win/BString.h:
     13        (BString):
     14
    1152012-09-17  Patrick Gansterer  <paroga@webkit.org>
    216
  • trunk/Source/WebCore/platform/win/BString.cpp

    r128809 r128812  
    107107BString::~BString()
    108108{
    109     clear();
     109    SysFreeString(m_bstr);
    110110}
    111111
     
    120120void BString::adoptBSTR(BSTR bstr)
    121121{
    122     clear();
     122    if (m_bstr)
     123        SysFreeString(m_bstr);
    123124    m_bstr = bstr;
    124 }
    125 
    126 void BString::clear()
    127 {
    128     SysFreeString(m_bstr);
    129125}
    130126
  • trunk/Source/WebCore/platform/win/BString.h

    r128809 r128812  
    5353
    5454        void adoptBSTR(BSTR);
    55         void clear();
    5655
    5756        BString(const BString&);
     
    5958        BString& operator=(const BSTR&);
    6059
    61         BSTR* operator&() { ASSERT(!m_bstr); return &m_bstr; }
    6260        operator BSTR() const { return m_bstr; }
    6361
  • trunk/Source/WebKit/win/ChangeLog

    r128771 r128812  
     12012-09-17  Sheriff Bot  <webkit.review.bot@gmail.com>
     2
     3        Unreviewed, rolling out r128809.
     4        http://trac.webkit.org/changeset/128809
     5        https://bugs.webkit.org/show_bug.cgi?id=96958
     6
     7        Broke the Windows build. (Requested by andersca on #webkit).
     8
     9        * DefaultPolicyDelegate.cpp:
     10        (DefaultPolicyDelegate::decidePolicyForNavigationAction):
     11        (DefaultPolicyDelegate::decidePolicyForMIMEType):
     12        (DefaultPolicyDelegate::unableToImplementPolicyWithError):
     13        * MarshallingHelpers.cpp:
     14        (MarshallingHelpers::KURLToBSTR):
     15        (MarshallingHelpers::CFStringRefToBSTR):
     16        (MarshallingHelpers::stringArrayToSafeArray):
     17        (MarshallingHelpers::safeArrayToStringArray):
     18        * WebCoreSupport/WebChromeClient.cpp:
     19        (WebChromeClient::runJavaScriptPrompt):
     20        * WebCoreSupport/WebEditorClient.cpp:
     21        (WebEditorClient::checkGrammarOfString):
     22        (WebEditorClient::getGuessesForWord):
     23        * WebFrame.cpp:
     24        (WebFrame::canProvideDocumentSource):
     25        * WebHistory.cpp:
     26        (WebHistory::removeItem):
     27        (WebHistory::addItem):
     28        * WebIconDatabase.cpp:
     29        (WebIconDatabase::startUpIconDatabase):
     30        * WebNotificationCenter.cpp:
     31        (WebNotificationCenter::postNotification):
     32        * WebPreferences.cpp:
     33        (WebPreferences::setStringValue):
     34        * WebView.cpp:
     35        (PreferencesChangedOrRemovedObserver::onNotify):
     36        (WebView::close):
     37        (WebView::canShowMIMEType):
     38        (WebView::initWithFrame):
     39        (WebView::setApplicationNameForUserAgent):
     40        (WebView::setCustomUserAgent):
     41        (WebView::userAgentForURL):
     42        (WebView::setCustomTextEncodingName):
     43        (WebView::customTextEncodingName):
     44        (WebView::setPreferences):
     45        (WebView::searchFor):
     46        (WebView::executeCoreCommandByName):
     47        (WebView::markAllMatchesForText):
     48        (WebView::setGroupName):
     49        (WebView::registerURLSchemeAsLocal):
     50        (WebView::replaceSelectionWithText):
     51        (WebView::onNotify):
     52        (WebView::notifyPreferencesChanged):
     53        (WebView::MIMETypeForExtension):
     54        (WebView::standardUserAgentWithApplicationName):
     55        (WebView::addAdditionalPluginDirectory):
     56        (WebView::registerEmbeddedViewMIMEType):
     57        (toString):
     58        (toKURL):
     59        (WebView::addOriginAccessWhitelistEntry):
     60        (WebView::removeOriginAccessWhitelistEntry):
     61        (WebView::geolocationDidFailWithError):
     62        (WebView::setDomainRelaxationForbiddenForURLScheme):
     63        (WebView::setCompositionForTesting):
     64        (WebView::confirmCompositionForTesting):
     65
    1662012-09-16  Mark Lam  <mark.lam@apple.com>
    267
  • trunk/Source/WebKit/win/DefaultPolicyDelegate.cpp

    r128809 r128812  
    2828#include "DefaultPolicyDelegate.h"
    2929
    30 #include <WebCore/BString.h>
    3130#include <WebCore/COMPtr.h>
    3231#include <wtf/text/WTFString.h>
     
    118117            listener->use();
    119118        else {
    120             BString url;
     119            BSTR url;
    121120            // A file URL shouldn't fall through to here, but if it did,
    122121            // it would be a security risk to open it.
     
    126125            }
    127126            listener->ignore();
     127            SysFreeString(url);
    128128        }
    129129    }
     
    153153        canShowMIMEType = FALSE;
    154154
    155     BString url;
     155    BSTR url;
    156156    request->URL(&url);
    157157
     
    172172    else
    173173        listener->ignore();
     174    SysFreeString(url);
    174175    return S_OK;
    175176}
     
    180181    /*[in]*/ IWebFrame* frame)
    181182{
    182     BString errorStr;
     183    BSTR errorStr;
    183184    error->localizedDescription(&errorStr);
    184185
    185     BString frameName;
     186    BSTR frameName;
    186187    frame->name(&frameName);
    187188
    188189    LOG_ERROR("called unableToImplementPolicyWithError:%S inFrame:%S", errorStr ? errorStr : TEXT(""), frameName ? frameName : TEXT(""));
     190    SysFreeString(errorStr);
     191    SysFreeString(frameName);
    189192
    190193    return S_OK;
  • trunk/Source/WebKit/win/MarshallingHelpers.cpp

    r128809 r128812  
    2828#include "MarshallingHelpers.h"
    2929
    30 #include <WebCore/BString.h>
    3130#include <WebCore/IntRect.h>
    3231#include <WebCore/KURL.h>
     
    4847BSTR MarshallingHelpers::KURLToBSTR(const KURL& url)
    4948{
    50     return BString(url.string()).release();
     49    return SysAllocStringLen(url.string().characters(), url.string().length());
    5150}
    5251
     
    9190BSTR MarshallingHelpers::CFStringRefToBSTR(CFStringRef str)
    9291{
    93     return BString(str).release();
     92    if (!str)
     93        return 0;
     94
     95    const UniChar* uniChars = CFStringGetCharactersPtr(str);
     96    if (uniChars)
     97        return SysAllocStringLen((LPCTSTR)uniChars, CFStringGetLength(str));
     98
     99    CFIndex length = CFStringGetLength(str);
     100    BSTR bstr = SysAllocStringLen(0, length);
     101    if (bstr) {
     102        CFStringGetCharacters(str, CFRangeMake(0, length), (UniChar*)bstr);
     103        bstr[length] = 0;
     104    }
     105    return bstr;
    94106}
    95107
     
    148160    for (CFIndex i=0; i<size; i++) {
    149161        CFStringRef item = (CFStringRef) CFArrayGetValueAtIndex(inArray, i);
    150         BString bstr(item);
    151         ::SafeArrayPutElement(sa, &count, bstr); // SafeArrayPutElement() copies the string correctly.
     162        BSTR bstr = CFStringRefToBSTR(item);
     163        ::SafeArrayPutElement(sa, &count, bstr);
     164        SysFreeString(bstr);    // SafeArrayPutElement() should make a copy of the string
    152165        count++;
    153166    }
     
    220233        items = new CFStringRef[len];
    221234        for (; lBound <= uBound; lBound++) {
    222             BString str;
     235            BSTR str;
    223236            hr = ::SafeArrayGetElement(inArray, &lBound, &str);
    224237            items[lBound] = BSTRToCFStringRef(str);
     238            SysFreeString(str);
    225239        }
    226240    }
  • trunk/Source/WebKit/win/WebCoreSupport/WebChromeClient.cpp

    r128809 r128812  
    411411    TimerBase::fireTimersInNestedEventLoop();
    412412
    413     BString resultBSTR;
     413    BSTR resultBSTR = 0;
    414414    if (FAILED(ui->runJavaScriptTextInputPanelWithPrompt(m_webView, BString(message), BString(defaultValue), &resultBSTR)))
    415415        return false;
    416416
    417     if (!resultBSTR)
    418         return false;
    419 
    420     result = String(resultBSTR, SysStringLen(resultBSTR));
    421     return true;
     417    if (resultBSTR) {
     418        result = String(resultBSTR, SysStringLen(resultBSTR));
     419        SysFreeString(resultBSTR);
     420        return true;
     421    }
     422
     423    return false;
    422424}
    423425
  • trunk/Source/WebKit/win/WebCoreSupport/WebEditorClient.cpp

    r128809 r128812  
    696696        if (FAILED(detailObj->location(&detail.location)))
    697697            continue;
    698         BString userDesc;
     698        BSTR userDesc;
    699699        if (FAILED(detailObj->userDescription(&userDesc)))
    700700            continue;
    701701        detail.userDescription = String(userDesc, SysStringLen(userDesc));
     702        SysFreeString(userDesc);
    702703
    703704        COMPtr<IEnumSpellingGuesses> enumGuessesObj;
     
    705706            continue;
    706707        while (true) {
    707             BString guess;
     708            BSTR guess;
    708709            if (enumGuessesObj->Next(1, &guess, &fetched) != S_OK)
    709710                break;
    710711            detail.guesses.append(String(guess, SysStringLen(guess)));
     712            SysFreeString(guess);
    711713        }
    712714
     
    777779    while (true) {
    778780        ULONG fetched;
    779         BString guess;
     781        BSTR guess;
    780782        if (enumGuessesObj->Next(1, &guess, &fetched) != S_OK)
    781783            break;
    782784        guesses.append(String(guess, SysStringLen(guess)));
     785        SysFreeString(guess);
    783786    }
    784787}
  • trunk/Source/WebKit/win/WebFrame.cpp

    r128809 r128812  
    14431443    hr = dataSource->response(&urlResponse);
    14441444    if (SUCCEEDED(hr) && urlResponse) {
    1445         BString mimeTypeBStr;
     1445        BSTR mimeTypeBStr;
    14461446        if (SUCCEEDED(urlResponse->MIMEType(&mimeTypeBStr))) {
    14471447            String mimeType(mimeTypeBStr, SysStringLen(mimeTypeBStr));
    14481448            *result = mimeType == "text/html" || WebCore::DOMImplementation::isXMLMIMEType(mimeType);
     1449            SysFreeString(mimeTypeBStr);
    14491450        }
    14501451    }
  • trunk/Source/WebKit/win/WebHistory.cpp

    r128809 r128812  
    3737#include "WebPreferences.h"
    3838#include <CoreFoundation/CoreFoundation.h>
    39 #include <WebCore/BString.h>
    4039#include <WebCore/HistoryItem.h>
    4140#include <WebCore/HistoryPropertyList.h>
     
    614613{
    615614    HRESULT hr = S_OK;
    616     BString urlBStr;
     615    BSTR urlBStr = 0;
    617616
    618617    hr = entry->URLString(&urlBStr);
     
    621620
    622621    RetainPtr<CFStringRef> urlString(AdoptCF, MarshallingHelpers::BSTRToCFStringRef(urlBStr));
     622    SysFreeString(urlBStr);
    623623
    624624    // If this exact object isn't stored, then make no change.
     
    647647        return E_FAIL;
    648648
    649     BString urlBStr;
     649    BSTR urlBStr = 0;
    650650    hr = entry->URLString(&urlBStr);
    651651    if (FAILED(hr))
     
    653653
    654654    RetainPtr<CFStringRef> urlString(AdoptCF, MarshallingHelpers::BSTRToCFStringRef(urlBStr));
     655    SysFreeString(urlBStr);
    655656
    656657    COMPtr<IWebHistoryItem> oldEntry((IWebHistoryItem*) CFDictionaryGetValue(
  • trunk/Source/WebKit/win/WebIconDatabase.cpp

    r128809 r128812  
    8585    iconDatabase().setClient(this);
    8686
    87     BString prefDatabasePath;
     87    BSTR prefDatabasePath = 0;
    8888    if (FAILED(standardPrefs->iconDatabaseLocation(&prefDatabasePath)))
    8989        LOG_ERROR("Unable to get icon database location preference");
    9090
    9191    String databasePath(prefDatabasePath, SysStringLen(prefDatabasePath));
     92    SysFreeString(prefDatabasePath);
    9293
    9394    if (databasePath.isEmpty()) {
  • trunk/Source/WebKit/win/WebNotificationCenter.cpp

    r128809 r128812  
    2929
    3030#include "WebNotification.h"
    31 #include <WebCore/BString.h>
    3231#include <WebCore/COMPtr.h>
    3332#include <utility>
     
    162161    /* [in] */ IWebNotification* notification)
    163162{
    164     BString name;
     163    BSTR name;
    165164    HRESULT hr = notification->name(&name);
    166165    if (FAILED(hr))
     
    173172
    174173    postNotificationInternal(notification, name, obj.get());
     174    SysFreeString(name);
    175175
    176176    return hr;
  • trunk/Source/WebKit/win/WebPreferences.cpp

    r128809 r128812  
    350350void WebPreferences::setStringValue(CFStringRef key, LPCTSTR value)
    351351{
    352     BString val;
    353     val.adoptBSTR(stringValueForKey(key));
     352    BSTR val = stringValueForKey(key);
    354353    if (val && !wcscmp(val, value))
    355354        return;
     355    SysFreeString(val);
    356356   
    357357    RetainPtr<CFStringRef> valueRef(AdoptCF,
  • trunk/Source/WebKit/win/WebView.cpp

    r128809 r128812  
    200200}
    201201
    202 static inline AtomicString toAtomicString(BSTR bstr)
    203 {
    204     return AtomicString(bstr, SysStringLen(bstr));
    205 }
    206 
    207 static inline String toString(BSTR bstr)
    208 {
    209     return String(bstr, SysStringLen(bstr));
    210 }
    211 
    212 static inline KURL toKURL(BSTR bstr)
    213 {
    214     return KURL(KURL(), toString(bstr));
    215 }
    216 
    217202class PreferencesChangedOrRemovedObserver : public IWebNotificationObserver {
    218203public:
     
    261246        return hr;
    262247
     248    BSTR nameBSTR;
     249    hr = notification->name(&nameBSTR);
     250    if (FAILED(hr))
     251        return hr;
    263252    BString name;
    264     hr = notification->name(&name);
    265     if (FAILED(hr))
    266         return hr;
     253    name.adoptBSTR(nameBSTR);
    267254
    268255    if (wcscmp(name, WebPreferences::webPreferencesChangedNotification()) == 0)
     
    740727
    741728    if (COMPtr<WebPreferences> preferences = m_preferences) {
    742         BString identifier;
     729        BSTR identifier = 0;
    743730        preferences->identifier(&identifier);
    744731
     
    747734        // Make sure we release the reference, since WebPreferences::removeReferenceForIdentifier will check for last reference to WebPreferences
    748735        preferences = 0;
    749         if (identifier)
     736        if (identifier) {
    750737            WebPreferences::removeReferenceForIdentifier(identifier);
     738            SysFreeString(identifier);
     739        }
    751740    }
    752741
     
    25252514    /* [retval][out] */ BOOL* canShow)
    25262515{
    2527     String mimeTypeStr = toString(mimeType);
     2516    String mimeTypeStr(mimeType, SysStringLen(mimeType));
    25282517
    25292518    if (!canShow)
     
    26922681    provideGeolocationTo(m_page, new WebGeolocationClient(this));
    26932682
    2694     BString localStoragePath;
    2695     if (SUCCEEDED(m_preferences->localStorageDatabasePath(&localStoragePath)))
    2696         m_page->settings()->setLocalStorageDatabasePath(toString(localStoragePath));
     2683    BSTR localStoragePath;
     2684    if (SUCCEEDED(m_preferences->localStorageDatabasePath(&localStoragePath))) {
     2685        m_page->settings()->setLocalStorageDatabasePath(String(localStoragePath, SysStringLen(localStoragePath)));
     2686        SysFreeString(localStoragePath);
     2687    }
    26972688
    26982689    if (m_uiDelegate) {
    2699         BString path;
    2700         if (SUCCEEDED(m_uiDelegate->ftpDirectoryTemplatePath(this, &path)))
    2701             m_page->settings()->setFTPDirectoryTemplatePath(toString(path));
     2690        BSTR path;
     2691        if (SUCCEEDED(m_uiDelegate->ftpDirectoryTemplatePath(this, &path))) {
     2692            m_page->settings()->setFTPDirectoryTemplatePath(String(path, SysStringLen(path)));
     2693            SysFreeString(path);
     2694        }
    27022695    }
    27032696
     
    27072700    webFrame->Release(); // The WebFrame is owned by the Frame, so release our reference to it.
    27082701
    2709     coreFrame->tree()->setName(toString(frameName));
     2702    coreFrame->tree()->setName(String(frameName, SysStringLen(frameName)));
    27102703    coreFrame->init();
    27112704    setGroupName(groupName);
     
    30653058    /* [in] */ BSTR applicationName)
    30663059{
    3067     m_applicationName = toString(applicationName);
     3060    m_applicationName = String(applicationName, SysStringLen(applicationName));
    30683061    m_userAgentStandard = String();
    30693062    return S_OK;
     
    30833076{
    30843077    m_userAgentOverridden = userAgentString;
    3085     m_userAgentCustom = toString(userAgentString);
     3078    m_userAgentCustom = String(userAgentString, SysStringLen(userAgentString));
    30863079    return S_OK;
    30873080}
     
    31043097{
    31053098    String userAgentString = userAgentForKURL(MarshallingHelpers::BSTRToKURL(url));
    3106     *userAgent = BString(userAgentString).release();
     3099    *userAgent = SysAllocStringLen(userAgentString.characters(), userAgentString.length());
    31073100    if (!*userAgent && userAgentString.length())
    31083101        return E_OUTOFMEMORY;
     
    31243117
    31253118    HRESULT hr;
    3126     BString oldEncoding;
     3119    BSTR oldEncoding;
    31273120    hr = customTextEncodingName(&oldEncoding);
    31283121    if (FAILED(hr))
     
    31313124    if (oldEncoding != encodingName && (!oldEncoding || !encodingName || wcscmp(oldEncoding, encodingName))) {
    31323125        if (Frame* coreFrame = core(m_mainFrame))
    3133             coreFrame->loader()->reloadWithOverrideEncoding(toString(encodingName));
     3126            coreFrame->loader()->reloadWithOverrideEncoding(String(encodingName, SysStringLen(encodingName)));
    31343127    }
    31353128
     
    31633156
    31643157    if (!*encodingName)
    3165         *encodingName = BString(m_overrideEncoding).release();
     3158        *encodingName = SysAllocStringLen(m_overrideEncoding.characters(), m_overrideEncoding.length());
    31663159
    31673160    if (!*encodingName && m_overrideEncoding.length())
     
    32383231    nc->removeObserver(this, WebPreferences::webPreferencesChangedNotification(), static_cast<IWebPreferences*>(m_preferences.get()));
    32393232
    3240     BString identifier;
     3233    BSTR identifier = 0;
    32413234    oldPrefs->identifier(&identifier);
    32423235    oldPrefs->didRemoveFromWebView();
     
    32453238    m_preferences = webPrefs;
    32463239
    3247     if (identifier)
     3240    if (identifier) {
    32483241        WebPreferences::removeReferenceForIdentifier(identifier);
     3242        SysFreeString(identifier);
     3243    }
    32493244
    32503245    nc->addObserver(this, WebPreferences::webPreferencesChangedNotification(), static_cast<IWebPreferences*>(m_preferences.get()));
     
    33943389        return E_INVALIDARG;
    33953390
    3396     *found = m_page->findString(toString(str), caseFlag ? TextCaseSensitive : TextCaseInsensitive, forward ? FindDirectionForward : FindDirectionBackward, wrapFlag);
     3391    *found = m_page->findString(String(str, SysStringLen(str)), caseFlag ? TextCaseSensitive : TextCaseInsensitive, forward ? FindDirectionForward : FindDirectionBackward, wrapFlag);
    33973392    return S_OK;
    33983393}
     
    34243419}
    34253420
    3426 HRESULT STDMETHODCALLTYPE WebView::executeCoreCommandByName(BSTR name, BSTR value)
    3427 {
    3428     m_page->focusController()->focusedOrMainFrame()->editor()->command(toString(name)).execute(toString(value));
     3421HRESULT STDMETHODCALLTYPE WebView::executeCoreCommandByName(BSTR bName, BSTR bValue)
     3422{
     3423    String name(bName, SysStringLen(bName));
     3424    String value(bValue, SysStringLen(bValue));
     3425
     3426    m_page->focusController()->focusedOrMainFrame()->editor()->command(name).execute(value);
    34293427
    34303428    return S_OK;
     
    34503448        return E_INVALIDARG;
    34513449
    3452     *matches = m_page->markAllMatchesForText(toString(str), caseSensitive ? TextCaseSensitive : TextCaseInsensitive, highlight, limit);
     3450    *matches = m_page->markAllMatchesForText(String(str, SysStringLen(str)), caseSensitive ? TextCaseSensitive : TextCaseInsensitive, highlight, limit);
    34533451    return S_OK;
    34543452}
     
    35333531    if (!m_page)
    35343532        return S_OK;
    3535     m_page->setGroupName(toString(groupName));
     3533    m_page->setGroupName(String(groupName, SysStringLen(groupName)));
    35363534    return S_OK;
    35373535}
     
    37673765        return E_POINTER;
    37683766
    3769     SchemeRegistry::registerURLSchemeAsLocal(toString(scheme));
     3767    SchemeRegistry::registerURLSchemeAsLocal(String(scheme, ::SysStringLen(scheme)));
    37703768
    37713769    return S_OK;
     
    43184316        /* [in] */ BSTR text)
    43194317{
     4318    String textString(text, ::SysStringLen(text));
    43204319    Position start = m_page->mainFrame()->selection()->selection().start();
    4321     m_page->focusController()->focusedOrMainFrame()->editor()->insertText(toString(text), 0);
     4320    m_page->focusController()->focusedOrMainFrame()->editor()->insertText(textString, 0);
    43224321    m_page->mainFrame()->selection()->setBase(start);
    43234322    return S_OK;
     
    45384537    /* [in] */ IWebNotification* notification)
    45394538{
     4539    BSTR nameBSTR;
     4540    HRESULT hr = notification->name(&nameBSTR);
     4541    if (FAILED(hr))
     4542        return hr;
     4543
    45404544    BString name;
    4541     HRESULT hr = notification->name(&name);
    4542     if (FAILED(hr))
    4543         return hr;
     4545    name.adoptBSTR(nameBSTR);
    45444546
    45454547    if (!wcscmp(name, WebIconDatabase::iconDatabaseDidAddIconNotification()))
     
    45674569    ASSERT(preferences == m_preferences);
    45684570
    4569     BString str;
     4571    BSTR str;
    45704572    int size;
    45714573    BOOL enabled;
     
    45764578    if (FAILED(hr))
    45774579        return hr;
    4578     settings->setCursiveFontFamily(toAtomicString(str));
    4579     str.clear();
     4580    settings->setCursiveFontFamily(AtomicString(str, SysStringLen(str)));
     4581    SysFreeString(str);
    45804582
    45814583    hr = preferences->defaultFixedFontSize(&size);
     
    45884590        return hr;
    45894591    settings->setDefaultFontSize(size);
    4590 
     4592   
    45914593    hr = preferences->defaultTextEncodingName(&str);
    45924594    if (FAILED(hr))
    45934595        return hr;
    4594     settings->setDefaultTextEncodingName(toString(str));
    4595     str.clear();
     4596    settings->setDefaultTextEncodingName(String(str, SysStringLen(str)));
     4597    SysFreeString(str);
    45964598
    45974599    hr = preferences->fantasyFontFamily(&str);
    45984600    if (FAILED(hr))
    45994601        return hr;
    4600     settings->setFantasyFontFamily(toAtomicString(str));
    4601     str.clear();
     4602    settings->setFantasyFontFamily(AtomicString(str, SysStringLen(str)));
     4603    SysFreeString(str);
    46024604
    46034605    hr = preferences->fixedFontFamily(&str);
    46044606    if (FAILED(hr))
    46054607        return hr;
    4606     settings->setFixedFontFamily(toAtomicString(str));
    4607     str.clear();
     4608    settings->setFixedFontFamily(AtomicString(str, SysStringLen(str)));
     4609    SysFreeString(str);
    46084610
    46094611#if ENABLE(VIDEO_TRACK)
     
    46294631        if (FAILED(hr))
    46304632            return hr;
    4631         settings->setLocalStorageDatabasePath(toString(str));
    4632         str.clear();
     4633        settings->setLocalStorageDatabasePath(String(str, SysStringLen(str)));
     4634        SysFreeString(str);
    46334635    }
    46344636
     
    46364638    if (FAILED(hr))
    46374639        return hr;
    4638     settings->setPictographFontFamily(toAtomicString(str));
    4639     str.clear();
     4640    settings->setPictographFontFamily(AtomicString(str, SysStringLen(str)));
     4641    SysFreeString(str);
    46404642
    46414643    hr = preferences->isJavaEnabled(&enabled);
     
    46824684    if (FAILED(hr))
    46834685        return hr;
    4684     settings->setSansSerifFontFamily(toAtomicString(str));
    4685     str.clear();
     4686    settings->setSansSerifFontFamily(AtomicString(str, SysStringLen(str)));
     4687    SysFreeString(str);
    46864688
    46874689    hr = preferences->serifFontFamily(&str);
    46884690    if (FAILED(hr))
    46894691        return hr;
    4690     settings->setSerifFontFamily(toAtomicString(str));
    4691     str.clear();
     4692    settings->setSerifFontFamily(AtomicString(str, SysStringLen(str)));
     4693    SysFreeString(str);
    46924694
    46934695    hr = preferences->standardFontFamily(&str);
    46944696    if (FAILED(hr))
    46954697        return hr;
    4696     settings->setStandardFontFamily(toAtomicString(str));
    4697     str.clear();
     4698    settings->setStandardFontFamily(AtomicString(str, SysStringLen(str)));
     4699    SysFreeString(str);
    46984700
    46994701    hr = preferences->loadsImagesAutomatically(&enabled);
     
    47104712            return hr;
    47114713
    4712         RetainPtr<CFStringRef> urlString(AdoptCF, toString(str).createCFString());
     4714        RetainPtr<CFStringRef> urlString(AdoptCF, String(str, SysStringLen(str)).createCFString());
    47134715        RetainPtr<CFURLRef> url(AdoptCF, CFURLCreateWithString(kCFAllocatorDefault, urlString.get(), 0));
    47144716
     
    47284730
    47294731        settings->setUserStyleSheetLocation(url.get());
    4730         str.clear();
    4731     } else
     4732        SysFreeString(str);
     4733    } else {
    47324734        settings->setUserStyleSheetLocation(KURL());
     4735    }
    47334736
    47344737    hr = preferences->shouldPrintBackgrounds(&enabled);
     
    49764979        return E_POINTER;
    49774980
    4978     *mimeType = BString(MIMETypeRegistry::getMIMETypeForExtension(toString(extension))).release();
     4981    String extensionStr(extension, SysStringLen(extension));
     4982
     4983    *mimeType = BString(MIMETypeRegistry::getMIMETypeForExtension(extensionStr)).release();
    49794984
    49804985    return S_OK;
     
    52245229    }
    52255230
    5226     *groupName = BString(standardUserAgentWithApplicationName(toString(applicationName))).release();
     5231    BString applicationNameBString(applicationName);
     5232    *groupName = BString(standardUserAgentWithApplicationName(String(applicationNameBString, SysStringLen(applicationNameBString)))).release();
    52275233    return S_OK;
    52285234}
     
    52795285        /* [in] */ BSTR directory)
    52805286{
    5281     PluginDatabase::installedPlugins()->addExtraPluginDirectory(toString(directory));
     5287    PluginDatabase::installedPlugins()->addExtraPluginDirectory(String(directory, SysStringLen(directory)));
    52825288    return S_OK;
    52835289}
     
    61136119        m_embeddedViewMIMETypes = adoptPtr(new HashSet<String>);
    61146120
    6115     m_embeddedViewMIMETypes->add(toString(mimeType));
     6121    m_embeddedViewMIMETypes->add(String(mimeType, ::SysStringLen(mimeType)));
    61166122    return S_OK;
    61176123}
     
    61836189    m_page->setCanStartMedia(canStartPlugins);
    61846190    return S_OK;
     6191}
     6192
     6193static String toString(BSTR bstr)
     6194{
     6195    return String(bstr, SysStringLen(bstr));
     6196}
     6197
     6198static KURL toKURL(BSTR bstr)
     6199{
     6200    return KURL(KURL(), toString(bstr));
    61856201}
    61866202
     
    64006416HRESULT WebView::addOriginAccessWhitelistEntry(BSTR sourceOrigin, BSTR destinationProtocol, BSTR destinationHost, BOOL allowDestinationSubdomains)
    64016417{
    6402     SecurityPolicy::addOriginAccessWhitelistEntry(*SecurityOrigin::createFromString(toString(sourceOrigin)), toString(destinationProtocol), toString(destinationHost), allowDestinationSubdomains);
     6418    SecurityPolicy::addOriginAccessWhitelistEntry(*SecurityOrigin::createFromString(String(sourceOrigin, SysStringLen(sourceOrigin))), String(destinationProtocol, SysStringLen(destinationProtocol)), String(destinationHost, SysStringLen(destinationHost)), allowDestinationSubdomains);
    64036419    return S_OK;
    64046420}
     
    64066422HRESULT WebView::removeOriginAccessWhitelistEntry(BSTR sourceOrigin, BSTR destinationProtocol, BSTR destinationHost, BOOL allowDestinationSubdomains)
    64076423{
    6408     SecurityPolicy::removeOriginAccessWhitelistEntry(*SecurityOrigin::createFromString(toString(sourceOrigin)), toString(destinationProtocol), toString(destinationHost), allowDestinationSubdomains);
     6424    SecurityPolicy::removeOriginAccessWhitelistEntry(*SecurityOrigin::createFromString(String(sourceOrigin, SysStringLen(sourceOrigin))), String(destinationProtocol, SysStringLen(destinationProtocol)), String(destinationHost, SysStringLen(destinationHost)), allowDestinationSubdomains);
    64096425    return S_OK;
    64106426}
     
    65836599        return E_POINTER;
    65846600
    6585     BString description;
    6586     if (FAILED(error->localizedDescription(&description)))
    6587         return E_FAIL;
    6588 
    6589     RefPtr<GeolocationError> geolocationError = GeolocationError::create(GeolocationError::PositionUnavailable, toString(description));
     6601    BSTR descriptionBSTR;
     6602    if (FAILED(error->localizedDescription(&descriptionBSTR)))
     6603        return E_FAIL;
     6604    String descriptionString(descriptionBSTR, SysStringLen(descriptionBSTR));
     6605    SysFreeString(descriptionBSTR);
     6606
     6607    RefPtr<GeolocationError> geolocationError = GeolocationError::create(GeolocationError::PositionUnavailable, descriptionString);
    65906608    GeolocationController::from(m_page)->errorOccurred(geolocationError.get());
    65916609    return S_OK;
     
    65946612HRESULT WebView::setDomainRelaxationForbiddenForURLScheme(BOOL forbidden, BSTR scheme)
    65956613{
    6596     SchemeRegistry::setDomainRelaxationForbiddenForURLScheme(forbidden, toString(scheme));
     6614    SchemeRegistry::setDomainRelaxationForbiddenForURLScheme(forbidden, String(scheme, SysStringLen(scheme)));
    65976615    return S_OK;
    65986616}
     
    68896907        return E_FAIL;
    68906908
    6891     String compositionStr = toString(composition);
     6909    String compositionStr(composition, SysStringLen(composition));
    68926910
    68936911    Vector<CompositionUnderline> underlines;
     
    69216939        return E_FAIL;
    69226940
    6923     String compositionStr = toString(composition);
     6941    String compositionStr(composition, SysStringLen(composition));
    69246942
    69256943    if (compositionStr.isNull())
Note: See TracChangeset for help on using the changeset viewer.