Changeset 71930 in webkit


Ignore:
Timestamp:
Nov 12, 2010 10:39:53 AM (13 years ago)
Author:
weinig@apple.com
Message:

ASSERTION when converting some WKStringRefs returned from willSubmitForm to CFStringRef
<rdar://problem/8662180>
https://bugs.webkit.org/show_bug.cgi?id=49454

Reviewed by Anders Carlsson.

Enforce the invariant that a WebString never contains a null WTF::String at a
lower level, in the WebString constructor, instead of relying on the callers of
WebString::create to do it.

  • Shared/API/c/WKSharedAPICast.h:

(WebKit::toAPI):
(WebKit::toCopiedAPI): Remove null string check...

  • Shared/WebString.h:

(WebKit::WebString::WebString): ... and move it to the constructor.

  • Shared/API/c/WKURL.cpp:

(WKURLCopyString): Use toCopiedAPI() instead of calling WebString directly
to match other similar uses.

Location:
trunk/WebKit2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit2/ChangeLog

    r71919 r71930  
     12010-11-12  Sam Weinig  <sam@webkit.org>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        ASSERTION when converting some WKStringRefs returned from willSubmitForm to CFStringRef
     6        <rdar://problem/8662180>
     7        https://bugs.webkit.org/show_bug.cgi?id=49454
     8
     9        Enforce the invariant that a WebString never contains a null WTF::String at a
     10        lower level, in the WebString constructor, instead of relying on the callers of
     11        WebString::create to do it.
     12
     13        * Shared/API/c/WKSharedAPICast.h:
     14        (WebKit::toAPI):
     15        (WebKit::toCopiedAPI): Remove null string check...
     16
     17        * Shared/WebString.h:
     18        (WebKit::WebString::WebString): ... and move it to the constructor.
     19
     20        * Shared/API/c/WKURL.cpp:
     21        (WKURLCopyString): Use toCopiedAPI() instead of calling WebString directly
     22        to match other similar uses.
     23
    1242010-11-12  Andreas Kling  <kling@webkit.org>
    225
  • trunk/WebKit2/Shared/API/c/WKSharedAPICast.h

    r71790 r71930  
    116116inline ProxyingRefPtr<WebString> toAPI(StringImpl* string)
    117117{
    118     StringImpl* impl = string ? string : StringImpl::empty();
    119     return ProxyingRefPtr<WebString>(WebString::create(String(impl)));
     118    return ProxyingRefPtr<WebString>(WebString::create(string));
    120119}
    121120
    122121inline WKStringRef toCopiedAPI(const String& string)
    123122{
    124     StringImpl* impl = string.impl() ? string.impl() : StringImpl::empty();
    125     RefPtr<WebString> webString = WebString::create(String(impl));
     123    RefPtr<WebString> webString = WebString::create(string);
    126124    return toAPI(webString.release().releaseRef());
    127125}
  • trunk/WebKit2/Shared/API/c/WKURL.cpp

    r70723 r71930  
    4242WKStringRef WKURLCopyString(WKURLRef url)
    4343{
    44     return toAPI(WebString::create(toImpl(url)->string()).leakRef());
     44    return toCopiedAPI(toImpl(url)->string());
    4545}
    4646
  • trunk/WebKit2/Shared/WebString.h

    r68961 r71930  
    8282private:
    8383    WebString(const String& string)
    84         : m_string(string)
     84        : m_string(!string.impl() ? String(StringImpl::empty()) : string)
    8585    {
    8686    }
Note: See TracChangeset for help on using the changeset viewer.