REGRESSION: WebKit2.PageLoadBasic API test is failing
https://bugs.webkit.org/show_bug.cgi?id=127892

Reviewed by Dan Bernstein.

Source/WebKit2:

On Mountain Lion, URLs returned by -[NSBundle URLForResource:withExtension:subdirectory] include
localhost as the hostname, but WebCore::URL normalizes those URLs and removes the host name.

Because of this, URLs created by WKURLCreateWithCFURL won't be equal to urls passed through
the WebCore::URL constructor. Change WKURLIsEqual to compare the normalized URLs.

* Shared/API/c/WKURL.cpp:
(WKURLIsEqual):
* Shared/APIURL.h:
(API::URL::equals):
(API::URL::url):

Tools:

Re-enable test.

* TestWebKitAPI/Tests/WebKit2/PageLoadBasic.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163173 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
index e8d2b87..768c302 100644
--- a/Source/WebKit2/ChangeLog
+++ b/Source/WebKit2/ChangeLog
@@ -1,3 +1,22 @@
+2014-01-31  Anders Carlsson  <andersca@apple.com>
+
+        REGRESSION: WebKit2.PageLoadBasic API test is failing
+        https://bugs.webkit.org/show_bug.cgi?id=127892
+
+        Reviewed by Dan Bernstein.
+
+        On Mountain Lion, URLs returned by -[NSBundle URLForResource:withExtension:subdirectory] include
+        localhost as the hostname, but WebCore::URL normalizes those URLs and removes the host name.
+        
+        Because of this, URLs created by WKURLCreateWithCFURL won't be equal to urls passed through 
+        the WebCore::URL constructor. Change WKURLIsEqual to compare the normalized URLs.
+
+        * Shared/API/c/WKURL.cpp:
+        (WKURLIsEqual):
+        * Shared/APIURL.h:
+        (API::URL::equals):
+        (API::URL::url):
+
 2014-01-31  Brady Eidson  <beidson@apple.com>
 
         IDB: When deleting object stores/indexes, also delete associated records
diff --git a/Source/WebKit2/Shared/API/c/WKURL.cpp b/Source/WebKit2/Shared/API/c/WKURL.cpp
index 80bbb10..790b1b8 100644
--- a/Source/WebKit2/Shared/API/c/WKURL.cpp
+++ b/Source/WebKit2/Shared/API/c/WKURL.cpp
@@ -52,7 +52,7 @@
 
 bool WKURLIsEqual(WKURLRef a, WKURLRef b)
 {
-    return toImpl(a)->string() == toImpl(b)->string();
+    return API::URL::equals(*toImpl(a), *toImpl(b));
 }
 
 WKStringRef WKURLCopyHostName(WKURLRef url)
diff --git a/Source/WebKit2/Shared/APIURL.h b/Source/WebKit2/Shared/APIURL.h
index 0e1e03c..cd69b65 100644
--- a/Source/WebKit2/Shared/APIURL.h
+++ b/Source/WebKit2/Shared/APIURL.h
@@ -58,6 +58,11 @@
 
     const WTF::String& string() const { return m_string; }
 
+    static bool equals(const URL& a, const URL& b)
+    {
+        return a.url() == b.url();
+    }
+
     WTF::String host() const
     {
         parseURLIfNecessary();
@@ -109,6 +114,12 @@
     {
     }
 
+    const WebCore::URL& url() const
+    {
+        parseURLIfNecessary();
+        return *m_parsedURL;
+    }
+
     void parseURLIfNecessary() const
     {
         if (m_parsedURL)
diff --git a/Tools/ChangeLog b/Tools/ChangeLog
index ee2e2b8..5b098f8 100644
--- a/Tools/ChangeLog
+++ b/Tools/ChangeLog
@@ -1,3 +1,14 @@
+2014-01-31  Anders Carlsson  <andersca@apple.com>
+
+        REGRESSION: WebKit2.PageLoadBasic API test is failing
+        https://bugs.webkit.org/show_bug.cgi?id=127892
+
+        Reviewed by Dan Bernstein.
+
+        Re-enable test.
+
+        * TestWebKitAPI/Tests/WebKit2/PageLoadBasic.cpp:
+
 2014-01-31  Csaba Osztrogonác  <ossy@webkit.org>
 
         [jhbuild] Disable escape sequences in EWS output
diff --git a/Tools/TestWebKitAPI/Tests/WebKit2/PageLoadBasic.cpp b/Tools/TestWebKitAPI/Tests/WebKit2/PageLoadBasic.cpp
index e976d07..cbb685a 100644
--- a/Tools/TestWebKitAPI/Tests/WebKit2/PageLoadBasic.cpp
+++ b/Tools/TestWebKitAPI/Tests/WebKit2/PageLoadBasic.cpp
@@ -109,11 +109,7 @@
 }
 
 // FIXME: http://webkit.org/b/127934 REGRESSION (r163037): WebKit2.PageLoadBasic API test failing on Mountain Lion
-#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1080
-TEST(WebKit2, DISABLED_PageLoadBasic)
-#else
 TEST(WebKit2, PageLoadBasic)
-#endif
 {
     State state;