Title: [102080] trunk/Source/WebCore
Revision
102080
Author
[email protected]
Date
2011-12-05 17:51:27 -0800 (Mon, 05 Dec 2011)

Log Message

Get rid of KURL::KURL(ParsedURLStringTag, const char*);
https://bugs.webkit.org/show_bug.cgi?id=73792

Reviewed by Andreas Kling.

In all cases where the constructor is used, the constructor
taking a String is as effective because the string is valid and converted
to String for m_string.

This patch remove the constructor KURL::KURL(ParsedURLStringTag, const char*)
and change the call sites that were using that constructor to build
empty URLs.

* dom/Document.cpp:
(WebCore::Document::initSecurityContext):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::init):
* loader/archive/cf/LegacyWebArchive.cpp:
(WebCore::LegacyWebArchive::create):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::createWindow):
* platform/KURL.cpp:
* platform/KURL.h:
* platform/KURLGoogle.cpp:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (102079 => 102080)


--- trunk/Source/WebCore/ChangeLog	2011-12-06 01:41:16 UTC (rev 102079)
+++ trunk/Source/WebCore/ChangeLog	2011-12-06 01:51:27 UTC (rev 102080)
@@ -1,5 +1,32 @@
 2011-12-05  Benjamin Poulain  <[email protected]>
 
+        Get rid of KURL::KURL(ParsedURLStringTag, const char*);
+        https://bugs.webkit.org/show_bug.cgi?id=73792
+
+        Reviewed by Andreas Kling.
+
+        In all cases where the constructor is used, the constructor
+        taking a String is as effective because the string is valid and converted
+        to String for m_string.
+
+        This patch remove the constructor KURL::KURL(ParsedURLStringTag, const char*)
+        and change the call sites that were using that constructor to build
+        empty URLs.
+
+        * dom/Document.cpp:
+        (WebCore::Document::initSecurityContext):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::init):
+        * loader/archive/cf/LegacyWebArchive.cpp:
+        (WebCore::LegacyWebArchive::create):
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::createWindow):
+        * platform/KURL.cpp:
+        * platform/KURL.h:
+        * platform/KURLGoogle.cpp:
+
+2011-12-05  Benjamin Poulain  <[email protected]>
+
         Remove methods declared but never implemented with GOOGLEURL
         https://bugs.webkit.org/show_bug.cgi?id=73795
 

Modified: trunk/Source/WebCore/dom/Document.cpp (102079 => 102080)


--- trunk/Source/WebCore/dom/Document.cpp	2011-12-06 01:41:16 UTC (rev 102079)
+++ trunk/Source/WebCore/dom/Document.cpp	2011-12-06 01:51:27 UTC (rev 102080)
@@ -4472,7 +4472,7 @@
     if (!m_frame) {
         // No source for a security context.
         // This can occur via document.implementation.createDocument().
-        m_cookieURL = KURL(ParsedURLString, "");
+        m_cookieURL = KURL(ParsedURLString, emptyString());
         setSecurityOrigin(SecurityOrigin::createUnique());
         setContentSecurityPolicy(ContentSecurityPolicy::create(this));
         return;

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (102079 => 102080)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2011-12-06 01:41:16 UTC (rev 102079)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2011-12-06 01:51:27 UTC (rev 102080)
@@ -220,7 +220,7 @@
     // This somewhat odd set of steps gives the frame an initial empty document.
     // It would be better if this could be done with even fewer steps.
     m_stateMachine.advanceTo(FrameLoaderStateMachine::CreatingInitialEmptyDocument);
-    setPolicyDocumentLoader(m_client->createDocumentLoader(ResourceRequest(KURL(ParsedURLString, "")), SubstituteData()).get());
+    setPolicyDocumentLoader(m_client->createDocumentLoader(ResourceRequest(KURL(ParsedURLString, emptyString())), SubstituteData()).get());
     setProvisionalDocumentLoader(m_policyDocumentLoader.get());
     setState(FrameStateProvisional);
     m_provisionalDocumentLoader->setResponse(ResourceResponse(KURL(), "text/html", 0, String(), String()));

Modified: trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp (102079 => 102080)


--- trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp	2011-12-06 01:41:16 UTC (rev 102079)
+++ trunk/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp	2011-12-06 01:51:27 UTC (rev 102080)
@@ -507,7 +507,7 @@
     // it's possible to have a response without a URL here
     // <rdar://problem/5454935>
     if (responseURL.isNull())
-        responseURL = KURL(ParsedURLString, "");
+        responseURL = KURL(ParsedURLString, emptyString());
         
     PassRefPtr<ArchiveResource> mainResource = ArchiveResource::create(utf8Buffer(markupString), responseURL, response.mimeType(), "UTF-8", frame->tree()->uniqueName());
 

Modified: trunk/Source/WebCore/page/DOMWindow.cpp (102079 => 102080)


--- trunk/Source/WebCore/page/DOMWindow.cpp	2011-12-06 01:41:16 UTC (rev 102079)
+++ trunk/Source/WebCore/page/DOMWindow.cpp	2011-12-06 01:51:27 UTC (rev 102080)
@@ -1813,7 +1813,7 @@
     // For whatever reason, Firefox uses the first frame to determine the outgoingReferrer. We replicate that behavior here.
     String referrer = firstFrame->loader()->outgoingReferrer();
 
-    KURL completedURL = urlString.isEmpty() ? KURL(ParsedURLString, "") : firstFrame->document()->completeURL(urlString);
+    KURL completedURL = urlString.isEmpty() ? KURL(ParsedURLString, emptyString()) : firstFrame->document()->completeURL(urlString);
     ResourceRequest request(completedURL, referrer);
     FrameLoader::addHTTPOriginIfNeeded(request, firstFrame->loader()->outgoingOrigin());
     FrameLoadRequest frameRequest(activeWindow->securityOrigin(), request, frameName);

Modified: trunk/Source/WebCore/platform/KURL.cpp (102079 => 102080)


--- trunk/Source/WebCore/platform/KURL.cpp	2011-12-06 01:41:16 UTC (rev 102079)
+++ trunk/Source/WebCore/platform/KURL.cpp	2011-12-06 01:51:27 UTC (rev 102080)
@@ -320,12 +320,6 @@
     m_fragmentEnd = 0;
 }
 
-KURL::KURL(ParsedURLStringTag, const char* url)
-{
-    parse(url);
-    ASSERT(url == m_string);
-}
-
 KURL::KURL(ParsedURLStringTag, const String& url)
 {
     parse(url);

Modified: trunk/Source/WebCore/platform/KURL.h (102079 => 102080)


--- trunk/Source/WebCore/platform/KURL.h	2011-12-06 01:41:16 UTC (rev 102079)
+++ trunk/Source/WebCore/platform/KURL.h	2011-12-06 01:51:27 UTC (rev 102080)
@@ -73,7 +73,6 @@
     // 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&);
     KURL(ParsedURLStringTag, const URLString&);
 #if USE(GOOGLEURL)

Modified: trunk/Source/WebCore/platform/KURLGoogle.cpp (102079 => 102080)


--- trunk/Source/WebCore/platform/KURLGoogle.cpp	2011-12-06 01:41:16 UTC (rev 102079)
+++ trunk/Source/WebCore/platform/KURLGoogle.cpp	2011-12-06 01:51:27 UTC (rev 102080)
@@ -341,22 +341,6 @@
 
 // KURL ------------------------------------------------------------------------
 
-// Creates with null-terminated string input representing an absolute URL.
-// WebCore generally calls this only with hardcoded strings, so the input is
-// ASCII. We treat it as UTF-8 just in case.
-KURL::KURL(ParsedURLStringTag, const char *url)
-{
-    // FIXME The Mac code checks for beginning with a slash and converts it to
-    // file: URL. We will want to add this as well once we can compile on a
-    // system like that.
-    m_url.init(KURL(), url, strlen(url), 0);
-
-    // The one-argument constructors should never generate a null string.
-    // This is a funny quirk of KURL.cpp (probably a bug) which we preserve.
-    if (m_url.utf8String().isNull())
-        m_url.setAscii(CString("", 0));
-}
-
 // Initializes with a string representing an absolute URL. No encoding
 // information is specified. This generally happens when a KURL is converted
 // to a string and then converted back. In this case, the URL is already
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to