Commit 320d65e3 authored by ap@apple.com's avatar ap@apple.com

Reviewed by Darin Adler.

        https://bugs.webkit.org/show_bug.cgi?id=28852
        Rename KURL single argument constructor to avoid confusion

        * platform/KURL.h: The constructor that used to be single argument should now be invoked
        as KURL(ParsedURLString, myString).



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@47907 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 4dcb63de
2009-08-31 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin Adler.
https://bugs.webkit.org/show_bug.cgi?id=28852
Rename KURL single argument constructor to avoid confusion
* platform/KURL.h: The constructor that used to be single argument should now be invoked
as KURL(ParsedURLString, myString).
* WebCore.base.exp:
* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::createWindow):
* bindings/js/ScriptCallFrame.cpp:
(WebCore::ScriptCallFrame::ScriptCallFrame):
* bindings/v8/NPV8Object.cpp:
(_NPN_EvaluateHelper):
* bindings/v8/custom/V8DOMWindowCustom.cpp:
(WebCore::createWindow):
* css/CSSCursorImageValue.cpp:
(WebCore::isSVGCursorIdentifier):
* css/CSSImageValue.cpp:
(WebCore::CSSImageValue::cachedImage):
* css/CSSImportRule.cpp:
(WebCore::CSSImportRule::insertedIntoParent):
* css/StyleBase.cpp:
(WebCore::StyleBase::baseURL):
* dom/Document.cpp:
(WebCore::Document::initSecurityContext):
* dom/Element.cpp:
(WebCore::Element::baseURI):
* editing/markup.cpp:
(WebCore::completeURLs):
* history/HistoryItem.cpp:
(WebCore::HistoryItem::url):
(WebCore::HistoryItem::originalURL):
* inspector/InspectorController.cpp:
(WebCore::InspectorController::didLoadResourceFromMemoryCache):
* inspector/InspectorResource.cpp:
(WebCore::InspectorResource::createCached):
* loader/Cache.cpp:
(WebCore::Cache::revalidateResource):
* loader/DocLoader.cpp:
(WebCore::DocLoader::requestResource):
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::getSubresources):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::init):
(WebCore::FrameLoader::iconURL):
(WebCore::FrameLoader::scheduleLocationChange):
(WebCore::FrameLoader::redirectionTimerFired):
(WebCore::FrameLoader::loadURLIntoChildFrame):
(WebCore::FrameLoader::startRedirectionTimer):
* loader/appcache/ApplicationCache.cpp:
(WebCore::ApplicationCache::resourceForURL):
* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::startLoadingEntry):
(WebCore::ApplicationCacheGroup::addEntry):
* loader/appcache/ApplicationCacheStorage.cpp:
(WebCore::ApplicationCacheStorage::cacheGroupForURL):
(WebCore::ApplicationCacheStorage::fallbackCacheGroupForURL):
(WebCore::ApplicationCacheStorage::loadCache):
(WebCore::ApplicationCacheStorage::manifestURLs):
* loader/archive/cf/LegacyWebArchive.cpp:
(WebCore::LegacyWebArchive::createResource):
(WebCore::LegacyWebArchive::create):
* loader/loader.cpp:
(WebCore::Loader::load):
* notifications/NotificationCenter.h:
(WebCore::NotificationCenter::createHTMLNotification):
* platform/KURL.cpp:
(WebCore::KURL::KURL):
(WebCore::blankURL):
* platform/KURLHash.h:
* platform/chromium/ClipboardChromium.cpp:
(WebCore::ClipboardChromium::setData):
* platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
(WebCore::MediaPlayerPrivate::createQTMovie):
* platform/network/cf/ResourceErrorCF.cpp:
(WebCore::ResourceError::operator CFErrorRef):
* platform/network/cf/ResourceRequest.h:
(WebCore::ResourceRequest::ResourceRequest):
* platform/network/chromium/ResourceRequest.h:
(WebCore::ResourceRequest::ResourceRequest):
* platform/network/curl/ResourceHandleManager.cpp:
(WebCore::handleLocalReceiveResponse):
(WebCore::headerCallback):
* platform/network/curl/ResourceRequest.h:
(WebCore::ResourceRequest::ResourceRequest):
* platform/network/mac/ResourceErrorMac.mm:
(WebCore::ResourceError::operator NSError*):
* platform/network/mac/ResourceRequest.h:
(WebCore::ResourceRequest::ResourceRequest):
* platform/network/qt/ResourceRequest.h:
(WebCore::ResourceRequest::ResourceRequest):
* platform/network/soup/ResourceRequest.h:
(WebCore::ResourceRequest::ResourceRequest):
* platform/win/ClipboardWin.cpp:
(WebCore::filesystemPathFromUrlOrTitle):
(WebCore::ClipboardWin::setData):
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::dataChanged):
* xml/XSLImportRule.cpp:
(WebCore::XSLImportRule::loadSheet):
* xml/XSLTProcessor.cpp:
(WebCore::docLoaderFunc):
Adapt to the change everywhere the single argument constructor was used. I did a very
cursory check of whether these locations were using this constructor properly, and didn't
notice any obvious mistakes. The new explicit name will hopefully suggest checking this
better when refactoring any such code.
2009-08-31 Beth Dakin <bdakin@apple.com>
Reviewed by Darin Adler.
......@@ -489,8 +489,8 @@ __ZN7WebCore4FontC1Ev
__ZN7WebCore4FontD1Ev
__ZN7WebCore4FontaSERKS0_
__ZN7WebCore4KURL10invalidateEv
__ZN7WebCore4KURLC1ENS_18ParsedURLStringTagERKNS_6StringE
__ZN7WebCore4KURLC1EP5NSURL
__ZN7WebCore4KURLC1ERKNS_6StringE
__ZN7WebCore4Node17stopIgnoringLeaksEv
__ZN7WebCore4Node18startIgnoringLeaksEv
__ZN7WebCore4Page12setGroupNameERKNS_6StringE
......
......@@ -688,7 +688,7 @@ static Frame* createWindow(ExecState* exec, Frame* lexicalFrame, Frame* dynamicF
newWindow->putDirect(Identifier(exec, "dialogArguments"), dialogArgs);
if (!protocolIsJavaScript(url) || newWindow->allowsAccessFrom(exec)) {
KURL completedURL = url.isEmpty() ? KURL("") : completeURL(exec, url);
KURL completedURL = url.isEmpty() ? KURL(ParsedURLString, "") : completeURL(exec, url);
bool userGesture = processingUserGesture(exec);
if (created)
......
......@@ -40,7 +40,7 @@ namespace WebCore {
ScriptCallFrame::ScriptCallFrame(const UString& functionName, const UString& urlString, int lineNumber, const ArgList& args, unsigned skipArgumentCount)
: m_functionName(functionName)
, m_sourceURL(urlString)
, m_sourceURL(ParsedURLString, urlString)
, m_lineNumber(lineNumber)
{
size_t argumentCount = args.size();
......
......@@ -263,7 +263,7 @@ bool _NPN_EvaluateHelper(NPP npp, bool popupsAllowed, NPObject* npObject, NPStri
filename = "npscript";
WebCore::String script = WebCore::String::fromUTF8(npScript->UTF8Characters, npScript->UTF8Length);
v8::Local<v8::Value> v8result = proxy->evaluate(WebCore::ScriptSourceCode(script, WebCore::KURL(filename)), 0);
v8::Local<v8::Value> v8result = proxy->evaluate(WebCore::ScriptSourceCode(script, WebCore::KURL(WebCore::ParsedURLString, filename)), 0);
if (v8result.IsEmpty())
return false;
......
......@@ -554,7 +554,7 @@ static Frame* createWindow(Frame* callingFrame,
if (protocolIsJavaScript(url) || ScriptController::isSafeScript(newFrame)) {
KURL completedUrl =
url.isEmpty() ? KURL("") : completeURL(url);
url.isEmpty() ? KURL(ParsedURLString, "") : completeURL(url);
bool userGesture = processingUserGesture();
if (created)
......
......@@ -39,7 +39,7 @@ namespace WebCore {
#if ENABLE(SVG)
static inline bool isSVGCursorIdentifier(const String& url)
{
KURL kurl(url);
KURL kurl(ParsedURLString, url);
return kurl.hasFragmentIdentifier();
}
......
......@@ -63,7 +63,7 @@ StyleCachedImage* CSSImageValue::cachedImage(DocLoader* loader, const String& ur
cachedImage = loader->requestImage(url);
else {
// FIXME: Should find a way to make these images sit in their own memory partition, since they are user agent images.
cachedImage = static_cast<CachedImage*>(cache()->requestResource(0, CachedResource::ImageResource, KURL(url), String()));
cachedImage = static_cast<CachedImage*>(cache()->requestResource(0, CachedResource::ImageResource, KURL(ParsedURLString, url), String()));
}
if (cachedImage) {
......
......@@ -100,7 +100,7 @@ void CSSImportRule::insertedIntoParent()
String absHref = m_strHref;
if (!parentSheet->href().isNull())
// use parent styleheet's URL as the base URL
absHref = KURL(KURL(parentSheet->href()), m_strHref).string();
absHref = KURL(KURL(ParsedURLString, parentSheet->href()), m_strHref).string();
// Check for a cycle in our import chain. If we encounter a stylesheet
// in our parent chain with the same URL, then just bail.
......
......@@ -57,7 +57,7 @@ KURL StyleBase::baseURL() const
if (!sheet)
return KURL();
if (!sheet->href().isNull())
return KURL(sheet->href());
return KURL(ParsedURLString, sheet->href());
if (sheet->parent())
return sheet->parent()->baseURL();
if (!sheet->ownerNode())
......
......@@ -4144,7 +4144,7 @@ void Document::initSecurityContext()
if (!m_frame) {
// No source for a security context.
// This can occur via document.implementation.createDocument().
m_cookieURL = KURL("");
m_cookieURL = KURL(ParsedURLString, "");
ScriptExecutionContext::setSecurityOrigin(SecurityOrigin::createEmpty());
return;
}
......
......@@ -682,7 +682,7 @@ void Element::setPrefix(const AtomicString &_prefix, ExceptionCode& ec)
KURL Element::baseURI() const
{
KURL base(getAttribute(baseAttr));
KURL base(ParsedURLString, getAttribute(baseAttr));
if (!base.protocol().isEmpty())
return base;
......
......@@ -645,7 +645,7 @@ static void completeURLs(Node* node, const String& baseURL)
{
Vector<AttributeChange> changes;
KURL parsedBaseURL(baseURL);
KURL parsedBaseURL(ParsedURLString, baseURL);
Node* end = node->traverseNextSibling();
for (Node* n = node; n != end; n = n->traverseNextNode()) {
......
......@@ -172,12 +172,12 @@ double HistoryItem::lastVisitedTime() const
KURL HistoryItem::url() const
{
return KURL(m_urlString);
return KURL(ParsedURLString, m_urlString);
}
KURL HistoryItem::originalURL() const
{
return KURL(m_originalURLString);
return KURL(ParsedURLString, m_originalURLString);
}
const String& HistoryItem::referrer() const
......
......@@ -826,7 +826,7 @@ void InspectorController::didLoadResourceFromMemoryCache(DocumentLoader* loader,
return;
ASSERT(m_inspectedPage);
bool isMainResource = isMainResourceLoader(loader, KURL(cachedResource->url()));
bool isMainResource = isMainResourceLoader(loader, KURL(ParsedURLString, cachedResource->url()));
ensureResourceTrackingSettingsLoaded();
if (!isMainResource && !m_resourceTrackingEnabled)
return;
......
......@@ -71,7 +71,7 @@ PassRefPtr<InspectorResource> InspectorResource::createCached(long long identifi
resource->m_finished = true;
resource->m_requestURL = KURL(cachedResource->url());
resource->m_requestURL = KURL(ParsedURLString, cachedResource->url());
resource->updateResponse(cachedResource->response());
resource->m_length = cachedResource->encodedSize();
......
......@@ -191,7 +191,7 @@ void Cache::revalidateResource(CachedResource* resource, DocLoader* docLoader)
return;
}
const String& url = resource->url();
CachedResource* newResource = createResource(resource->type(), KURL(url), resource->encoding());
CachedResource* newResource = createResource(resource->type(), KURL(ParsedURLString, url), resource->encoding());
newResource->setResourceToRevalidate(resource);
evict(resource);
m_resources.set(url, newResource);
......
......@@ -217,7 +217,7 @@ CachedResource* DocLoader::requestResource(CachedResource::Type type, const Stri
if (resource) {
// Check final URL of resource to catch redirects.
// See <https://bugs.webkit.org/show_bug.cgi?id=21963>.
if (!canRequest(type, KURL(resource->url())))
if (!canRequest(type, KURL(ParsedURLString, resource->url())))
return 0;
m_documentResources.set(resource->url(), resource);
......
......@@ -560,7 +560,7 @@ void DocumentLoader::getSubresources(Vector<PassRefPtr<ArchiveResource> >& subre
const DocLoader::DocumentResourceMap& allResources = document->docLoader()->allCachedResources();
DocLoader::DocumentResourceMap::const_iterator end = allResources.end();
for (DocLoader::DocumentResourceMap::const_iterator it = allResources.begin(); it != end; ++it) {
RefPtr<ArchiveResource> subresource = this->subresource(KURL(it->second->url()));
RefPtr<ArchiveResource> subresource = this->subresource(KURL(ParsedURLString, it->second->url()));
if (subresource)
subresources.append(subresource.release());
}
......
......@@ -294,7 +294,7 @@ void FrameLoader::init()
// this somewhat odd set of steps is needed to give the frame an initial empty document
m_isDisplayingInitialEmptyDocument = false;
m_creatingInitialEmptyDocument = true;
setPolicyDocumentLoader(m_client->createDocumentLoader(ResourceRequest(KURL("")), SubstituteData()).get());
setPolicyDocumentLoader(m_client->createDocumentLoader(ResourceRequest(KURL(ParsedURLString, "")), SubstituteData()).get());
setProvisionalDocumentLoader(m_policyDocumentLoader.get());
setState(FrameStateProvisional);
m_provisionalDocumentLoader->setResponse(ResourceResponse(KURL(), "text/html", 0, String(), String()));
......@@ -658,7 +658,7 @@ KURL FrameLoader::iconURL()
// If we have an iconURL from a Link element, return that
if (!m_frame->document()->iconURL().isEmpty())
return KURL(m_frame->document()->iconURL());
return KURL(ParsedURLString, m_frame->document()->iconURL());
// Don't return a favicon iconURL unless we're http or https
if (!m_URL.protocolInHTTPFamily())
......@@ -1362,7 +1362,7 @@ void FrameLoader::scheduleLocationChange(const String& url, const String& referr
// If the URL we're going to navigate to is the same as the current one, except for the
// fragment part, we don't need to schedule the location change.
KURL parsedURL(url);
KURL parsedURL(ParsedURLString, url);
if (parsedURL.hasFragmentIdentifier() && equalIgnoringFragmentIdentifier(m_URL, parsedURL)) {
changeLocation(completeURL(url), referrer, lockHistory, lockBackForwardList, wasUserGesture);
return;
......@@ -1469,7 +1469,7 @@ void FrameLoader::redirectionTimerFired(Timer<FrameLoader>*)
switch (redirection->type) {
case ScheduledRedirection::redirection:
case ScheduledRedirection::locationChange:
changeLocation(KURL(redirection->url), redirection->referrer,
changeLocation(KURL(ParsedURLString, redirection->url), redirection->referrer,
redirection->lockHistory, redirection->lockBackForwardList, redirection->wasUserGesture, redirection->wasRefresh);
return;
case ScheduledRedirection::historyNavigation:
......@@ -1515,7 +1515,7 @@ void FrameLoader::loadURLIntoChildFrame(const KURL& url, const String& referer,
// Use the original URL to ensure we get all the side-effects, such as
// onLoad handlers, of any redirects that happened. An example of where
// this is needed is Radar 3213556.
workingURL = KURL(childItem->originalURLString());
workingURL = KURL(ParsedURLString, childItem->originalURLString());
childLoadType = loadType;
childFrame->loader()->m_provisionalHistoryItem = childItem;
}
......@@ -2103,7 +2103,7 @@ void FrameLoader::startRedirectionTimer()
switch (m_scheduledRedirection->type) {
case ScheduledRedirection::locationChange:
case ScheduledRedirection::redirection:
clientRedirected(KURL(m_scheduledRedirection->url),
clientRedirected(KURL(ParsedURLString, m_scheduledRedirection->url),
m_scheduledRedirection->delay,
currentTime() + m_redirectionTimer.nextFireInterval(),
m_scheduledRedirection->lockBackForwardList);
......
......@@ -111,7 +111,7 @@ unsigned ApplicationCache::removeResource(const String& url)
ApplicationCacheResource* ApplicationCache::resourceForURL(const String& url)
{
ASSERT(!KURL(url).hasFragmentIdentifier());
ASSERT(!KURL(ParsedURLString, url).hasFragmentIdentifier());
return m_resources.get(url).get();
}
......
......@@ -852,7 +852,7 @@ void ApplicationCacheGroup::startLoadingEntry()
ASSERT(!m_currentHandle);
m_currentHandle = createResourceHandle(KURL(it->first), m_newestCache ? m_newestCache->resourceForURL(it->first) : 0);
m_currentHandle = createResourceHandle(KURL(ParsedURLString, it->first), m_newestCache ? m_newestCache->resourceForURL(it->first) : 0);
}
void ApplicationCacheGroup::deliverDelayedMainResources()
......@@ -879,7 +879,7 @@ void ApplicationCacheGroup::deliverDelayedMainResources()
void ApplicationCacheGroup::addEntry(const String& url, unsigned type)
{
ASSERT(m_cacheBeingUpdated);
ASSERT(!KURL(url).hasFragmentIdentifier());
ASSERT(!KURL(ParsedURLString, url).hasFragmentIdentifier());
// Don't add the URL if we already have an master resource in the cache
// (i.e., the main resource finished loading before the manifest).
......
......@@ -216,7 +216,7 @@ ApplicationCacheGroup* ApplicationCacheStorage::cacheGroupForURL(const KURL& url
int result;
while ((result = statement.step()) == SQLResultRow) {
KURL manifestURL = KURL(statement.getColumnText(1));
KURL manifestURL = KURL(ParsedURLString, statement.getColumnText(1));
if (m_cachesInMemory.contains(manifestURL))
continue;
......@@ -284,7 +284,7 @@ ApplicationCacheGroup* ApplicationCacheStorage::fallbackCacheGroupForURL(const K
int result;
while ((result = statement.step()) == SQLResultRow) {
KURL manifestURL = KURL(statement.getColumnText(1));
KURL manifestURL = KURL(ParsedURLString, statement.getColumnText(1));
if (m_cachesInMemory.contains(manifestURL))
continue;
......@@ -835,7 +835,7 @@ PassRefPtr<ApplicationCache> ApplicationCacheStorage::loadCache(unsigned storage
int result;
while ((result = cacheStatement.step()) == SQLResultRow) {
KURL url(cacheStatement.getColumnText(0));
KURL url(ParsedURLString, cacheStatement.getColumnText(0));
unsigned type = static_cast<unsigned>(cacheStatement.getColumnInt64(1));
......@@ -871,7 +871,7 @@ PassRefPtr<ApplicationCache> ApplicationCacheStorage::loadCache(unsigned storage
Vector<KURL> whitelist;
while ((result = whitelistStatement.step()) == SQLResultRow)
whitelist.append(whitelistStatement.getColumnText(0));
whitelist.append(KURL(ParsedURLString, whitelistStatement.getColumnText(0)));
if (result != SQLResultDone)
LOG_ERROR("Could not load cache online whitelist, error \"%s\"", m_database.lastErrorMsg());
......@@ -901,7 +901,7 @@ PassRefPtr<ApplicationCache> ApplicationCacheStorage::loadCache(unsigned storage
FallbackURLVector fallbackURLs;
while ((result = fallbackStatement.step()) == SQLResultRow)
fallbackURLs.append(make_pair(fallbackStatement.getColumnText(0), fallbackStatement.getColumnText(1)));
fallbackURLs.append(make_pair(KURL(ParsedURLString, fallbackStatement.getColumnText(0)), KURL(ParsedURLString, fallbackStatement.getColumnText(1))));
if (result != SQLResultDone)
LOG_ERROR("Could not load fallback URLs, error \"%s\"", m_database.lastErrorMsg());
......@@ -1016,7 +1016,7 @@ bool ApplicationCacheStorage::manifestURLs(Vector<KURL>* urls)
return false;
while (selectURLs.step() == SQLResultRow)
urls->append(selectURLs.getColumnText(0));
urls->append(KURL(ParsedURLString, selectURLs.getColumnText(0)));
return true;
}
......
......@@ -233,7 +233,7 @@ PassRefPtr<ArchiveResource> LegacyWebArchive::createResource(CFDictionaryRef dic
response = createResourceResponseFromPropertyListData(resourceResponseData, resourceResponseVersion);
}
return ArchiveResource::create(SharedBuffer::create(CFDataGetBytePtr(resourceData), CFDataGetLength(resourceData)), KURL(url), mimeType, textEncoding, frameName, response);
return ArchiveResource::create(SharedBuffer::create(CFDataGetBytePtr(resourceData), CFDataGetLength(resourceData)), KURL(ParsedURLString, url), mimeType, textEncoding, frameName, response);
}
PassRefPtr<LegacyWebArchive> LegacyWebArchive::create()
......@@ -489,7 +489,7 @@ PassRefPtr<LegacyWebArchive> LegacyWebArchive::create(const String& markupString
// it's possible to have a response without a URL here
// <rdar://problem/5454935>
if (responseURL.isNull())
responseURL = KURL("");
responseURL = KURL(ParsedURLString, "");
PassRefPtr<ArchiveResource> mainResource = ArchiveResource::create(utf8Buffer(markupString), responseURL, response.mimeType(), "UTF-8", frame->tree()->name());
......@@ -548,7 +548,7 @@ PassRefPtr<LegacyWebArchive> LegacyWebArchive::create(const String& markupString
const String& iconURL = iconDatabase()->iconURLForPageURL(responseURL);
if (!iconURL.isEmpty() && iconDatabase()->iconDataKnownForIconURL(iconURL)) {
if (Image* iconImage = iconDatabase()->iconForPageURL(responseURL, IntSize(16, 16))) {
if (RefPtr<ArchiveResource> resource = ArchiveResource::create(iconImage->data(), KURL(iconURL), "image/x-icon", "", ""))
if (RefPtr<ArchiveResource> resource = ArchiveResource::create(iconImage->data(), KURL(ParsedURLString, iconURL), "image/x-icon", "", ""))
subresources.append(resource.release());
}
}
......
......@@ -100,7 +100,7 @@ void Loader::load(DocLoader* docLoader, CachedResource* resource, bool increment
Request* request = new Request(docLoader, resource, incremental, skipCanLoadCheck, sendResourceLoadCallbacks);
RefPtr<Host> host;
KURL url(resource->url());
KURL url(ParsedURLString, resource->url());
if (url.protocolInHTTPFamily()) {
AtomicString hostName = url.host();
host = m_hosts.get(hostName.impl());
......
......@@ -51,7 +51,7 @@ namespace WebCore {
Notification* createHTMLNotification(const String& URI, ExceptionCode& ec)
{
return Notification::create(KURL(URI), context(), ec, presenter());
return Notification::create(KURL(ParsedURLString, URI), context(), ec, presenter());
}
Notification* createNotification(const String& iconURI, const String& title, const String& body, ExceptionCode& ec)
......
......@@ -302,13 +302,13 @@ void KURL::invalidate()
m_fragmentEnd = 0;
}
KURL::KURL(const char* url)
KURL::KURL(ParsedURLStringTag, const char* url)
{
parse(url, 0);
ASSERT(url == m_string);
}
KURL::KURL(const String& url)
KURL::KURL(ParsedURLStringTag, const String& url)
{
parse(url);
ASSERT(url == m_string);
......@@ -1641,7 +1641,7 @@ String mimeTypeFromDataURL(const String& url)
const KURL& blankURL()
{
DEFINE_STATIC_LOCAL(KURL, staticBlankURL, ("about:blank"));
DEFINE_STATIC_LOCAL(KURL, staticBlankURL, (ParsedURLString, "about:blank"));
return staticBlankURL;
}
......
......@@ -55,15 +55,18 @@ namespace WebCore {
class TextEncoding;
struct KURLHash;
enum ParsedURLStringTag { ParsedURLString };
class KURL {
public:
// Generates a URL which contains a null string.
KURL() { invalidate(); }
// The argument is an absolute URL string. The string is assumed to be
// an already encoded (ASCII-only) valid absolute URL.
explicit KURL(const char*);
explicit KURL(const String&);
// The argument is an absolute URL string. The string is assumed to be output of KURL::string() called on a valid
// KURL object, or indiscernible from such.
// It is usually best to avoid repeatedly parsing a string, unless memory saving outweigh the possible slow-downs.
KURL(ParsedURLStringTag, const char*);
KURL(ParsedURLStringTag, const String&);
// Resolves the relative URL with the given base URL. If provided, the
// TextEncoding is used to encode non-ASCII characers. The base URL can be
......
......@@ -52,7 +52,7 @@ namespace WTF {
template<> struct HashTraits<WebCore::KURL> : GenericHashTraits<WebCore::KURL> {
static const bool emptyValueIsZero = true;
static void constructDeletedValue(WebCore::KURL& slot) { new (&slot) WebCore::KURL(WebCore::String(HashTableDeletedValue)); }
static void constructDeletedValue(WebCore::KURL& slot) { new (&slot) WebCore::KURL(WebCore::ParsedURLString, WebCore::String(HashTableDeletedValue)); }
static bool isDeletedValue(const WebCore::KURL& slot) { return slot.string().isHashTableDeletedValue(); }
};
......
......@@ -143,7 +143,7 @@ bool ClipboardChromium::setData(const String& type, const String& data)
ClipboardDataType winType = clipboardTypeFromMIMEType(type);
if (winType == ClipboardDataTypeURL) {
m_dataObject->url = KURL(data);
m_dataObject->url = KURL(ParsedURLString, data);
return m_dataObject->url.isValid();
}
......
......@@ -232,7 +232,7 @@ MediaPlayerPrivate::~MediaPlayerPrivate()
void MediaPlayerPrivate::createQTMovie(const String& url)
{
NSURL *cocoaURL = KURL(url);
NSURL *cocoaURL = KURL(ParsedURLString, url);
NSDictionary *movieAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
cocoaURL, QTMovieURLAttribute,
[NSNumber numberWithBool:m_player->preservesPitch()], QTMovieRateChangesPreservePitchAttribute,
......
......@@ -129,7 +129,7 @@ ResourceError::operator CFErrorRef() const
if (!m_failingURL.isEmpty()) {
RetainPtr<CFStringRef> failingURLString(AdoptCF, m_failingURL.createCFString());
CFDictionarySetValue(userInfo.get(), failingURLStringKey, failingURLString.get());
RetainPtr<CFURLRef> url(AdoptCF, KURL(m_failingURL).createCFURL());
RetainPtr<CFURLRef> url(AdoptCF, KURL(ParsedURLString, m_failingURL).createCFURL());
CFDictionarySetValue(userInfo.get(), failingURLKey, url.get());
}
......
......@@ -37,7 +37,7 @@ namespace WebCore {
struct ResourceRequest : ResourceRequestBase {
ResourceRequest(const String& url)
: ResourceRequestBase(KURL(url), UseProtocolCachePolicy)
: ResourceRequestBase(KURL(ParsedURLString, url), UseProtocolCachePolicy)
{
}
......
......@@ -46,7 +46,7 @@ namespace WebCore {
};
ResourceRequest(const String& url)
: ResourceRequestBase(KURL(url), UseProtocolCachePolicy)
: ResourceRequestBase(KURL(ParsedURLString, url), UseProtocolCachePolicy)
, m_requestorID(0)
, m_requestorProcessID(0)
, m_appCacheContextID(0)
......
......@@ -121,7 +121,7 @@ static void handleLocalReceiveResponse (CURL* handle, ResourceHandle* job, Resou
const char* hdr;
CURLcode err = curl_easy_getinfo(handle, CURLINFO_EFFECTIVE_URL, &hdr);
ASSERT(CURLE_OK == err);
d->m_response.setURL(KURL(hdr));
d->m_response.setURL(KURL(ParsedURLString, hdr));
if (d->client())
d->client()->didReceiveResponse(job, d->m_response);
d->m_response.setResponseFired(true);
......@@ -206,7 +206,7 @@ static size_t headerCallback(char* ptr, size_t size, size_t nmemb, void* data)
const char* hdr;
err = curl_easy_getinfo(h, CURLINFO_EFFECTIVE_URL, &hdr);
d->m_response.setURL(KURL(hdr));
d->m_response.setURL(KURL(ParsedURLString, hdr));
long httpCode = 0;
err = curl_easy_getinfo(h, CURLINFO_RESPONSE_CODE, &httpCode);
......
......@@ -36,7 +36,7 @@ namespace WebCore {
struct ResourceRequest : ResourceRequestBase {
ResourceRequest(const String& url)
: ResourceRequestBase(KURL(url), UseProtocolCachePolicy)