Changeset 70795 in webkit


Ignore:
Timestamp:
Oct 28, 2010 12:09:43 PM (13 years ago)
Author:
weinig@apple.com
Message:

WKURLRefs should be allowed to be null
<rdar://problem/8575621>
https://bugs.webkit.org/show_bug.cgi?id=48535

Reviewed by Anders Carlsson.

WebKit2:

  • Shared/API/c/WKSharedAPICast.h:

(WebKit::toURLRef):
(WebKit::toCopiedURLAPI):
Turn a null WTF::String into a null WKURLRef.

WebKitTools:

  • TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
  • TestWebKitAPI/Tests/WebKit2/PageLoadBasic.cpp:

(TestWebKitAPI::didStartProvisionalLoadForFrame):
(TestWebKitAPI::didCommitLoadForFrame):
(TestWebKitAPI::didFinishLoadForFrame):
Test that URLs are null pointers when unset.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit2/ChangeLog

    r70790 r70795  
     12010-10-28  Sam Weinig  <sam@webkit.org>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        WKURLRefs should be allowed to be null
     6        <rdar://problem/8575621>
     7        https://bugs.webkit.org/show_bug.cgi?id=48535
     8
     9        * Shared/API/c/WKSharedAPICast.h:
     10        (WebKit::toURLRef):
     11        (WebKit::toCopiedURLAPI):
     12        Turn a null WTF::String into a null WKURLRef.
     13
    1142010-10-28  Sam Weinig  <sam@webkit.org>
    215
  • trunk/WebKit2/Shared/API/c/WKSharedAPICast.h

    r70428 r70795  
    118118}
    119119
    120 inline ProxyingRefPtr<WebURL> toURLRef(StringImpl* string)
    121 {
    122     StringImpl* impl = string ? string : StringImpl::empty();
    123     return ProxyingRefPtr<WebURL>(WebURL::create(String(impl)));
    124 }
    125 
    126120inline WKStringRef toCopiedAPI(const String& string)
    127121{
     
    131125}
    132126
     127inline ProxyingRefPtr<WebURL> toURLRef(StringImpl* string)
     128{
     129    if (!string)
     130        ProxyingRefPtr<WebURL>(0);
     131    return ProxyingRefPtr<WebURL>(WebURL::create(String(string)));
     132}
     133
    133134inline WKURLRef toCopiedURLAPI(const String& string)
    134135{
    135     StringImpl* impl = string.impl() ? string.impl() : StringImpl::empty();
    136     RefPtr<WebURL> webURL = WebURL::create(String(impl));
     136    if (!string)
     137        return 0;
     138    RefPtr<WebURL> webURL = WebURL::create(string);
    137139    return toAPI(webURL.release().releaseRef());
    138140}
  • trunk/WebKitTools/ChangeLog

    r70792 r70795  
     12010-10-28  Sam Weinig  <sam@webkit.org>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        WKURLRefs should be allowed to be null
     6        <rdar://problem/8575621>
     7        https://bugs.webkit.org/show_bug.cgi?id=48535
     8
     9        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
     10        * TestWebKitAPI/Tests/WebKit2/PageLoadBasic.cpp:
     11        (TestWebKitAPI::didStartProvisionalLoadForFrame):
     12        (TestWebKitAPI::didCommitLoadForFrame):
     13        (TestWebKitAPI::didFinishLoadForFrame):
     14        Test that URLs are null pointers when unset.
     15
    1162010-10-28  Chris Fleizach  <cfleizach@apple.com>
    217
  • trunk/WebKitTools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj

    r70658 r70795  
    257257                        isa = PBXGroup;
    258258                        children = (
     259                                1A02C84B125D4A5E00E3F4BD /* find.html */,
    259260                                BCBD372E125ABBE600D2C29F /* icon.png */,
    260                                 1A02C84B125D4A5E00E3F4BD /* find.html */,
    261261                                BC909778125571AB00083756 /* simple.html */,
    262262                                C02B7882126615410026BF0F /* spacebar-scrolling.html */,
  • trunk/WebKitTools/TestWebKitAPI/Tests/WebKit2/PageLoadBasic.cpp

    r69317 r70795  
    5353    TEST_ASSERT(state->didDecidePolicyForNavigationAction);
    5454    TEST_ASSERT(!state->didCommitLoadForFrame);
     55
     56    // The commited URL should be null.
     57    TEST_ASSERT(!WKFrameCopyURL(frame));
     58
    5559    TEST_ASSERT(!state->didStartProvisionalLoadForFrame);
     60
    5661
    5762    state->didStartProvisionalLoadForFrame = true;
     
    6469    TEST_ASSERT(state->didStartProvisionalLoadForFrame);
    6570
     71    // The provisional URL should be null.
     72    TEST_ASSERT(!WKFrameCopyProvisionalURL(frame));
     73
    6674    state->didCommitLoadForFrame = true;
    6775}
     
    7381    TEST_ASSERT(state->didStartProvisionalLoadForFrame);
    7482    TEST_ASSERT(state->didCommitLoadForFrame);
     83
     84    // The provisional URL should be null.
     85    TEST_ASSERT(!WKFrameCopyProvisionalURL(frame));
    7586
    7687    test1Done = true;
Note: See TracChangeset for help on using the changeset viewer.