Diff
Modified: trunk/Source/WebCore/ChangeLog (150605 => 150606)
--- trunk/Source/WebCore/ChangeLog 2013-05-23 19:42:58 UTC (rev 150605)
+++ trunk/Source/WebCore/ChangeLog 2013-05-23 19:46:05 UTC (rev 150606)
@@ -1,3 +1,47 @@
+2013-05-23 Benjamin Poulain <[email protected]>
+
+ KURL::createCFURL() should return a RetainPtr<CFURLRef>
+ https://bugs.webkit.org/show_bug.cgi?id=116644
+
+ Reviewed by Andreas Kling.
+
+ For consistency with the other createCFType() APIs in WebKit, KURL should
+ return a RetainPtr<> instead of raw +1 CFURLRef.
+
+ No leak were discovered while making this change.
+
+ * platform/KURL.h:
+ * platform/cf/KURLCFNet.cpp:
+ (WebCore):
+ (WebCore::createCFURLFromBuffer):
+ (WebCore::KURL::createCFURL):
+ (WebCore::KURL::fileSystemPath):
+ * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
+ (WebCore::AVFWrapper::createAssetForURL):
+ * platform/graphics/cg/GraphicsContextCG.cpp:
+ (WebCore::GraphicsContext::setURLForRect):
+ * platform/mac/KURLMac.mm:
+ (WebCore):
+ (WebCore::KURL::operator NSURL *):
+ (WebCore::KURL::createCFURL):
+ * platform/network/cf/CookieJarCFNet.cpp:
+ (WebCore::setCookiesFromDOM):
+ (WebCore::cookiesForDOM):
+ (WebCore::cookieRequestHeaderFieldValue):
+ (WebCore::getRawCookies):
+ (WebCore::deleteCookie):
+ * platform/network/cf/DNSCFNet.cpp:
+ (WebCore::DNSResolveQueue::platformProxyIsEnabledInSystemPreferences):
+ * platform/network/cf/ProxyServerCFNet.cpp:
+ (WebCore::addProxyServersForURL):
+ * platform/network/cf/ResourceRequestCFNet.cpp:
+ (WebCore::ResourceRequest::doUpdatePlatformRequest):
+ (WebCore::ResourceRequest::doUpdatePlatformHTTPBody):
+ * platform/network/cf/ResourceResponseCFNet.cpp:
+ (WebCore::ResourceResponse::cfURLResponse):
+ * platform/network/cf/SocketStreamHandleCFNet.cpp:
+ (WebCore::SocketStreamHandle::SocketStreamHandle):
+
2013-05-18 Robert Hogan <[email protected]>
The ellipsis in a text overflow should not avoid floats
Modified: trunk/Source/WebCore/platform/KURL.h (150605 => 150606)
--- trunk/Source/WebCore/platform/KURL.h 2013-05-23 19:42:58 UTC (rev 150605)
+++ trunk/Source/WebCore/platform/KURL.h 2013-05-23 19:46:05 UTC (rev 150606)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2011, 2012, 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -28,6 +28,7 @@
#include <wtf/Forward.h>
#include <wtf/HashMap.h>
+#include <wtf/RetainPtr.h>
#include <wtf/text/WTFString.h>
#if USE(CF)
@@ -167,7 +168,7 @@
#if USE(CF)
KURL(CFURLRef);
- CFURLRef createCFURL() const;
+ RetainPtr<CFURLRef> createCFURL() const;
#endif
#if PLATFORM(MAC) || (PLATFORM(QT) && USE(QTKIT))
Modified: trunk/Source/WebCore/platform/cf/KURLCFNet.cpp (150605 => 150606)
--- trunk/Source/WebCore/platform/cf/KURLCFNet.cpp 2013-05-23 19:42:58 UTC (rev 150605)
+++ trunk/Source/WebCore/platform/cf/KURLCFNet.cpp 2013-05-23 19:46:05 UTC (rev 150606)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2008, 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -35,7 +35,7 @@
typedef Vector<char, 512> CharBuffer;
-CFURLRef createCFURLFromBuffer(const CharBuffer&);
+RetainPtr<CFURLRef> createCFURLFromBuffer(const CharBuffer&);
KURL::KURL(CFURLRef url)
{
@@ -52,20 +52,20 @@
parse(bytes);
}
-CFURLRef createCFURLFromBuffer(const CharBuffer& buffer)
+RetainPtr<CFURLRef> createCFURLFromBuffer(const CharBuffer& buffer)
{
// NOTE: We use UTF-8 here since this encoding is used when computing strings when returning URL components
// (e.g calls to NSURL -path). However, this function is not tolerant of illegal UTF-8 sequences, which
// could either be a malformed string or bytes in a different encoding, like Shift-JIS, so we fall back
// onto using ISO Latin-1 in those cases.
- CFURLRef result = CFURLCreateAbsoluteURLWithBytes(0, reinterpret_cast<const UInt8*>(buffer.data()), buffer.size(), kCFStringEncodingUTF8, 0, true);
+ RetainPtr<CFURLRef> result = adoptCF(CFURLCreateAbsoluteURLWithBytes(0, reinterpret_cast<const UInt8*>(buffer.data()), buffer.size(), kCFStringEncodingUTF8, 0, true));
if (!result)
- result = CFURLCreateAbsoluteURLWithBytes(0, reinterpret_cast<const UInt8*>(buffer.data()), buffer.size(), kCFStringEncodingISOLatin1, 0, true);
+ result = adoptCF(CFURLCreateAbsoluteURLWithBytes(0, reinterpret_cast<const UInt8*>(buffer.data()), buffer.size(), kCFStringEncodingISOLatin1, 0, true));
return result;
}
#if !PLATFORM(MAC) && !(PLATFORM(QT) && USE(QTKIT))
-CFURLRef KURL::createCFURL() const
+RetainPtr<CFURLRef> KURL::createCFURL() const
{
// FIXME: What should this return for invalid URLs?
// Currently it throws away the high bytes of the characters in the string in that case,
@@ -79,7 +79,7 @@
#if !(PLATFORM(QT) && USE(QTKIT))
String KURL::fileSystemPath() const
{
- RetainPtr<CFURLRef> cfURL = adoptCF(createCFURL());
+ RetainPtr<CFURLRef> cfURL = createCFURL();
if (!cfURL)
return String();
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp (150605 => 150606)
--- trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp 2013-05-23 19:42:58 UTC (rev 150605)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp 2013-05-23 19:46:05 UTC (rev 150606)
@@ -982,7 +982,7 @@
{
ASSERT(!avAsset());
- RetainPtr<CFURLRef> urlRef = adoptCF(KURL(ParsedURLString, url).createCFURL());
+ RetainPtr<CFURLRef> urlRef = KURL(ParsedURLString, url).createCFURL();
AVCFURLAssetRef assetRef = AVCFURLAssetCreateWithURLAndOptions(kCFAllocatorDefault, urlRef.get(), 0, m_notificationQueue);
m_avAsset = adoptCF(assetRef);
Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp (150605 => 150606)
--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp 2013-05-23 19:42:58 UTC (rev 150605)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp 2013-05-23 19:46:05 UTC (rev 150606)
@@ -1289,7 +1289,7 @@
if (paintingDisabled())
return;
- RetainPtr<CFURLRef> urlRef = adoptCF(link.createCFURL());
+ RetainPtr<CFURLRef> urlRef = link.createCFURL();
if (!urlRef)
return;
Modified: trunk/Source/WebCore/platform/mac/KURLMac.mm (150605 => 150606)
--- trunk/Source/WebCore/platform/mac/KURLMac.mm 2013-05-23 19:42:58 UTC (rev 150605)
+++ trunk/Source/WebCore/platform/mac/KURLMac.mm 2013-05-23 19:46:05 UTC (rev 150606)
@@ -34,7 +34,7 @@
namespace WebCore {
typedef Vector<char, 512> CharBuffer;
-extern CFURLRef createCFURLFromBuffer(const CharBuffer& buffer);
+extern RetainPtr<CFURLRef> createCFURLFromBuffer(const CharBuffer& buffer);
KURL::KURL(NSURL *url)
{
@@ -53,18 +53,20 @@
KURL::operator NSURL *() const
{
- return HardAutorelease(createCFURL());
+ return HardAutorelease(createCFURL().leakRef());
}
// We use the toll-free bridge between NSURL and CFURL to
// create a CFURLRef supporting both empty and null values.
-CFURLRef KURL::createCFURL() const
+RetainPtr<CFURLRef> KURL::createCFURL() const
{
if (isNull())
return 0;
- if (isEmpty())
- return reinterpret_cast<CFURLRef>([[NSURL alloc] initWithString:@""]);
+ if (isEmpty()) {
+ RetainPtr<NSURL> emptyNSURL = adoptNS([[NSURL alloc] initWithString:@""]);
+ return reinterpret_cast<CFURLRef>(emptyNSURL.get());
+ }
CharBuffer buffer;
copyToBuffer(buffer);
Modified: trunk/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp (150605 => 150606)
--- trunk/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp 2013-05-23 19:42:58 UTC (rev 150605)
+++ trunk/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp 2013-05-23 19:46:05 UTC (rev 150606)
@@ -99,8 +99,8 @@
if (value.isEmpty())
return;
- RetainPtr<CFURLRef> urlCF = adoptCF(url.createCFURL());
- RetainPtr<CFURLRef> firstPartyForCookiesCF = adoptCF(firstParty.createCFURL());
+ RetainPtr<CFURLRef> urlCF = url.createCFURL();
+ RetainPtr<CFURLRef> firstPartyForCookiesCF = firstParty.createCFURL();
// <http://bugs.webkit.org/show_bug.cgi?id=6531>, <rdar://4409034>
// cookiesWithResponseHeaderFields doesn't parse cookies without a value
@@ -119,7 +119,7 @@
String cookiesForDOM(const NetworkStorageSession& session, const KURL&, const KURL& url)
{
- RetainPtr<CFURLRef> urlCF = adoptCF(url.createCFURL());
+ RetainPtr<CFURLRef> urlCF = url.createCFURL();
bool secure = url.protocolIs("https");
RetainPtr<CFArrayRef> cookiesCF = adoptCF(CFHTTPCookieStorageCopyCookiesForURL(session.cookieStorage().get(), urlCF.get(), secure));
@@ -129,7 +129,7 @@
String cookieRequestHeaderFieldValue(const NetworkStorageSession& session, const KURL& /*firstParty*/, const KURL& url)
{
- RetainPtr<CFURLRef> urlCF = adoptCF(url.createCFURL());
+ RetainPtr<CFURLRef> urlCF = url.createCFURL();
bool secure = url.protocolIs("https");
RetainPtr<CFArrayRef> cookiesCF = adoptCF(CFHTTPCookieStorageCopyCookiesForURL(session.cookieStorage().get(), urlCF.get(), secure));
@@ -147,7 +147,7 @@
{
rawCookies.clear();
- RetainPtr<CFURLRef> urlCF = adoptCF(url.createCFURL());
+ RetainPtr<CFURLRef> urlCF = url.createCFURL();
bool sendSecureCookies = url.protocolIs("https");
RetainPtr<CFArrayRef> cookiesCF = adoptCF(CFHTTPCookieStorageCopyCookiesForURL(session.cookieStorage().get(), urlCF.get(), sendSecureCookies));
@@ -178,7 +178,7 @@
{
RetainPtr<CFHTTPCookieStorageRef> cookieStorage = session.cookieStorage();
- RetainPtr<CFURLRef> urlCF = adoptCF(url.createCFURL());
+ RetainPtr<CFURLRef> urlCF = url.createCFURL();
bool sendSecureCookies = url.protocolIs("https");
RetainPtr<CFArrayRef> cookiesCF = adoptCF(CFHTTPCookieStorageCopyCookiesForURL(cookieStorage.get(), urlCF.get(), sendSecureCookies));
Modified: trunk/Source/WebCore/platform/network/cf/DNSCFNet.cpp (150605 => 150606)
--- trunk/Source/WebCore/platform/network/cf/DNSCFNet.cpp 2013-05-23 19:42:58 UTC (rev 150605)
+++ trunk/Source/WebCore/platform/network/cf/DNSCFNet.cpp 2013-05-23 19:46:05 UTC (rev 150606)
@@ -55,11 +55,11 @@
if (!proxySettings)
return false;
- static CFURLRef httpCFURL = KURL(ParsedURLString, "http://example.com/").createCFURL();
- static CFURLRef httpsCFURL = KURL(ParsedURLString, "https://example.com/").createCFURL();
+ RetainPtr<CFURLRef> httpCFURL = KURL(ParsedURLString, "http://example.com/").createCFURL();
+ RetainPtr<CFURLRef> httpsCFURL = KURL(ParsedURLString, "https://example.com/").createCFURL();
- RetainPtr<CFArrayRef> httpProxyArray = adoptCF(CFNetworkCopyProxiesForURL(httpCFURL, proxySettings.get()));
- RetainPtr<CFArrayRef> httpsProxyArray = adoptCF(CFNetworkCopyProxiesForURL(httpsCFURL, proxySettings.get()));
+ RetainPtr<CFArrayRef> httpProxyArray = adoptCF(CFNetworkCopyProxiesForURL(httpCFURL.get(), proxySettings.get()));
+ RetainPtr<CFArrayRef> httpsProxyArray = adoptCF(CFNetworkCopyProxiesForURL(httpsCFURL.get(), proxySettings.get()));
CFIndex httpProxyCount = CFArrayGetCount(httpProxyArray.get());
CFIndex httpsProxyCount = CFArrayGetCount(httpsProxyArray.get());
Modified: trunk/Source/WebCore/platform/network/cf/ProxyServerCFNet.cpp (150605 => 150606)
--- trunk/Source/WebCore/platform/network/cf/ProxyServerCFNet.cpp 2013-05-23 19:42:58 UTC (rev 150605)
+++ trunk/Source/WebCore/platform/network/cf/ProxyServerCFNet.cpp 2013-05-23 19:46:05 UTC (rev 150606)
@@ -125,7 +125,7 @@
if (!proxySettings)
return;
- RetainPtr<CFURLRef> cfURL = adoptCF(url.createCFURL());
+ RetainPtr<CFURLRef> cfURL = url.createCFURL();
RetainPtr<CFArrayRef> proxiesForURL = adoptCF(CFNetworkCopyProxiesForURL(cfURL.get(), proxySettings.get()));
if (!proxiesForURL)
return;
Modified: trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp (150605 => 150606)
--- trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp 2013-05-23 19:42:58 UTC (rev 150605)
+++ trunk/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp 2013-05-23 19:46:05 UTC (rev 150606)
@@ -130,8 +130,8 @@
{
CFMutableURLRequestRef cfRequest;
- RetainPtr<CFURLRef> url = ""
- RetainPtr<CFURLRef> firstPartyForCookies = adoptCF(ResourceRequest::firstPartyForCookies().createCFURL());
+ RetainPtr<CFURLRef> url = ""
+ RetainPtr<CFURLRef> firstPartyForCookies = ResourceRequest::firstPartyForCookies().createCFURL();
if (m_cfRequest) {
cfRequest = CFURLRequestCreateMutableCopy(0, m_cfRequest.get());
CFURLRequestSetURL(cfRequest, url.get());
@@ -190,8 +190,8 @@
{
CFMutableURLRequestRef cfRequest;
- RetainPtr<CFURLRef> url = ""
- RetainPtr<CFURLRef> firstPartyForCookies = adoptCF(ResourceRequest::firstPartyForCookies().createCFURL());
+ RetainPtr<CFURLRef> url = ""
+ RetainPtr<CFURLRef> firstPartyForCookies = ResourceRequest::firstPartyForCookies().createCFURL();
if (m_cfRequest) {
cfRequest = CFURLRequestCreateMutableCopy(0, m_cfRequest.get());
CFURLRequestSetURL(cfRequest, url.get());
Modified: trunk/Source/WebCore/platform/network/cf/ResourceResponseCFNet.cpp (150605 => 150606)
--- trunk/Source/WebCore/platform/network/cf/ResourceResponseCFNet.cpp 2013-05-23 19:42:58 UTC (rev 150605)
+++ trunk/Source/WebCore/platform/network/cf/ResourceResponseCFNet.cpp 2013-05-23 19:46:05 UTC (rev 150606)
@@ -50,7 +50,7 @@
CFURLResponseRef ResourceResponse::cfURLResponse() const
{
if (!m_cfResponse && !m_isNull) {
- RetainPtr<CFURLRef> url = ""
+ RetainPtr<CFURLRef> url = ""
// FIXME: This creates a very incomplete CFURLResponse, which does not even have a status code.
Modified: trunk/Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp (150605 => 150606)
--- trunk/Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp 2013-05-23 19:42:58 UTC (rev 150605)
+++ trunk/Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp 2013-05-23 19:46:05 UTC (rev 150606)
@@ -66,7 +66,7 @@
ASSERT(url.protocolIs("ws") || url.protocolIs("wss"));
KURL httpsURL(KURL(), "https://" + m_url.host());
- m_httpsURL = adoptCF(httpsURL.createCFURL());
+ m_httpsURL = httpsURL.createCFURL();
createStreams();
ASSERT(!m_readStream == !m_writeStream);