Commit 38955ed6 authored by kbalazs@webkit.org's avatar kbalazs@webkit.org

2011-03-14 Balazs Kelemen <kbalazs@webkit.org>

        Reviewed by Adam Roben.

        [Qt][WK2]Unbreak InjectedBundle on Qt
        https://bugs.webkit.org/show_bug.cgi?id=54109

        No code changes so no new tests.

        Revert the changes that were needed to use KURL
        in WebKitTestRunner.

        * Configurations/WebCore.xcconfig:
        * WebCore.exp.in:
2011-03-14  Balazs Kelemen  <kbalazs@webkit.org>

        Reviewed by Adam Roben.

        [Qt][WK2]Unbreak InjectedBundle on Qt
        https://bugs.webkit.org/show_bug.cgi?id=54109

        Add API's to WKURL and WKString to satisfy
        WebKitTestRunner's needs.

        * Shared/API/c/WKString.cpp:
        (WKStringIsEqualToUTF8CStringIgnoringCase):
        * Shared/API/c/WKString.h:
        * Shared/API/c/WKURL.cpp:
        (WKURLCopyHostName):
        (WKURLCopyScheme):
        * Shared/API/c/WKURL.h:
        * Shared/WebString.h:
        (WebKit::WebString::equalToUTF8StringIgnoringCase):
        * Shared/WebURL.h: Added OwnPtr<KURL> member to be able
        to lazily parse the URL and store the result.
        (WebKit::WebURL::host):
        (WebKit::WebURL::protocol):
        (WebKit::WebURL::parseURLIfNecessary):
        * win/WebKit2.def: Revert the symbol exports that were
        needed to use KURL in WebKitTestRunner.
2011-03-14  Balazs Kelemen  <kbalazs@webkit.org>

        Reviewed by Adam Roben.

        [Qt][WK2]Unbreak InjectedBundle on Qt
        https://bugs.webkit.org/show_bug.cgi?id=54109

        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
        (WTR::InjectedBundlePage::willSendRequestForFrame): Use new WebKit2
        API's instead of KURL to analyze the URL.
        * WebKitTestRunner/StringFunctions.h:
        (WTR::adoptWK): Moved from InjectedBundlePage.cpp to make it available globally
        in the WebKitTestRunner project.
        (WTR::toWK): Use adoptWK.
        (WTR::operator<<): Added helper for printing a WKURL.
        * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj: Do not link
        against WebCore.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@81084 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 87211842
2011-03-14 Balazs Kelemen <kbalazs@webkit.org>
Reviewed by Adam Roben.
[Qt][WK2]Unbreak InjectedBundle on Qt
https://bugs.webkit.org/show_bug.cgi?id=54109
No code changes so no new tests.
Revert the changes that were needed to use KURL
in WebKitTestRunner.
* Configurations/WebCore.xcconfig:
* WebCore.exp.in:
2011-03-14 Jarkko Sakkinen <jarkko.j.sakkinen@gmail.com>
Reviewed by Kenneth Rohde Christiansen.
......
......@@ -63,7 +63,7 @@ PRODUCTION_FRAMEWORKS_DIR_iphonesimulator = $(PRODUCTION_FRAMEWORKS_DIR_iphoneos
PRODUCTION_FRAMEWORKS_DIR_macosx = $(NEXT_ROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks;
WEBKIT2_LDFLAGS = $(WEBKIT2_LDFLAGS_$(TARGET_MAC_OS_X_VERSION_MAJOR));
WEBKIT2_LDFLAGS_1060 = -allowable_client WebKit2 -allowable_client WebKitTestRunner -allowable_client WebKitTestRunnerInjectedBundle;
WEBKIT2_LDFLAGS_1060 = -allowable_client WebKit2
WEBKIT2_LDFLAGS_1070 = $(WEBKIT2_LDFLAGS_1060);
JAVASCRIPTCORE_PRIVATE_HEADERS_DIR = $(JAVASCRIPTCORE_PRIVATE_HEADERS_DIR_$(CONFIGURATION));
......
......@@ -645,7 +645,6 @@ __ZN7WebCore4FontaSERKS0_
__ZN7WebCore4Icon18createIconForFilesERKN3WTF6VectorINS1_6StringELm0EEE
__ZN7WebCore4IconD1Ev
__ZN7WebCore4KURL10invalidateEv
__ZN7WebCore4KURLC1ENS_18ParsedURLStringTagEPKc
__ZN7WebCore4KURLC1ENS_18ParsedURLStringTagERKN3WTF6StringE
__ZN7WebCore4KURLC1EP5NSURL
__ZN7WebCore4KURLC1EPK7__CFURL
......
2011-03-14 Balazs Kelemen <kbalazs@webkit.org>
Reviewed by Adam Roben.
[Qt][WK2]Unbreak InjectedBundle on Qt
https://bugs.webkit.org/show_bug.cgi?id=54109
Add API's to WKURL and WKString to satisfy
WebKitTestRunner's needs.
* Shared/API/c/WKString.cpp:
(WKStringIsEqualToUTF8CStringIgnoringCase):
* Shared/API/c/WKString.h:
* Shared/API/c/WKURL.cpp:
(WKURLCopyHostName):
(WKURLCopyScheme):
* Shared/API/c/WKURL.h:
* Shared/WebString.h:
(WebKit::WebString::equalToUTF8StringIgnoringCase):
* Shared/WebURL.h: Added OwnPtr<KURL> member to be able
to lazily parse the URL and store the result.
(WebKit::WebURL::host):
(WebKit::WebURL::protocol):
(WebKit::WebURL::parseURLIfNecessary):
* win/WebKit2.def: Revert the symbol exports that were
needed to use KURL in WebKitTestRunner.
2011-03-14 Jeff Miller <jeffm@apple.com>
Reviewed by Adam Roben.
......
......@@ -67,6 +67,11 @@ bool WKStringIsEqualToUTF8CString(WKStringRef aRef, const char* b)
return toImpl(aRef)->equalToUTF8String(b);
}
bool WKStringIsEqualToUTF8CStringIgnoringCase(WKStringRef aRef, const char* b)
{
return toImpl(aRef)->equalToUTF8StringIgnoringCase(b);
}
WKStringRef WKStringCreateWithJSString(JSStringRef jsStringRef)
{
RefPtr<WebString> webString = WebString::create(jsStringRef);
......
......@@ -47,6 +47,7 @@ WK_EXPORT size_t WKStringGetUTF8CString(WKStringRef string, char* buffer, size_t
WK_EXPORT bool WKStringIsEqual(WKStringRef a, WKStringRef b);
WK_EXPORT bool WKStringIsEqualToUTF8CString(WKStringRef a, const char* b);
WK_EXPORT bool WKStringIsEqualToUTF8CStringIgnoringCase(WKStringRef a, const char* b);
#ifdef __cplusplus
}
......
......@@ -49,3 +49,13 @@ bool WKURLIsEqual(WKURLRef a, WKURLRef b)
{
return toImpl(a)->string() == toImpl(b)->string();
}
WKStringRef WKURLCopyHostName(WKURLRef url)
{
return toCopiedAPI(toImpl(url)->host());
}
WKStringRef WKURLCopyScheme(WKURLRef url)
{
return toCopiedAPI(toImpl(url)->protocol());
}
......@@ -36,7 +36,9 @@ WK_EXPORT WKTypeID WKURLGetTypeID();
WK_EXPORT WKURLRef WKURLCreateWithUTF8CString(const char* string);
WK_EXPORT WKStringRef WKURLCopyString(WKURLRef URL);
WK_EXPORT WKStringRef WKURLCopyString(WKURLRef url);
WK_EXPORT WKStringRef WKURLCopyHostName(WKURLRef url);
WK_EXPORT WKStringRef WKURLCopyScheme(WKURLRef url);
WK_EXPORT bool WKURLIsEqual(WKURLRef a, WKURLRef b);
......
......@@ -74,6 +74,7 @@ public:
bool equal(WebString* other) { return m_string == other->m_string; }
bool equalToUTF8String(const char* other) { return m_string == String::fromUTF8(other); }
bool equalToUTF8StringIgnoringCase(const char* other) { return equalIgnoringCase(m_string, other); }
const String& string() const { return m_string; }
......
......@@ -27,6 +27,9 @@
#define WebURL_h
#include "APIObject.h"
#include <WebCore/KURL.h>
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/PassRefPtr.h>
#include <wtf/text/WTFString.h>
......@@ -48,15 +51,35 @@ public:
const String& string() const { return m_string; }
String host() const
{
parseURLIfNecessary();
return m_parsedURL->isValid() ? m_parsedURL->host() : String();
}
String protocol() const
{
parseURLIfNecessary();
return m_parsedURL->isValid() ? m_parsedURL->protocol() : String();
}
private:
WebURL(const String& string)
: m_string(string)
{
}
void parseURLIfNecessary() const
{
if (m_parsedURL)
return;
m_parsedURL = WTF::adoptPtr(new WebCore::KURL(WebCore::KURL(), m_string));
}
virtual Type type() const { return APIType; }
String m_string;
mutable OwnPtr<WebCore::KURL> m_parsedURL;
};
} // namespace WebKit
......
......@@ -19,14 +19,6 @@ EXPORTS
WebKitShouldUseFontSmoothing
WebKitCreateInstance
; Exported for WebKitTestRunner's use only
??0KURL@WebCore@@QAE@W4ParsedURLStringTag@1@PBD@Z
??1StringImpl@WTF@@QAE@XZ
?equal@WTF@@YA_NPBVStringImpl@1@PBD@Z
?equalIgnoringCase@WTF@@YA_NPAVStringImpl@1@PBD@Z
?host@KURL@WebCore@@QBE?AVString@WTF@@XZ
?protocol@KURL@WebCore@@QBE?AVString@WTF@@XZ
; These functions are deprecated
WebLocalizedString
WebLocalizedLPCTSTR
......
2011-03-14 Balazs Kelemen <kbalazs@webkit.org>
Reviewed by Adam Roben.
[Qt][WK2]Unbreak InjectedBundle on Qt
https://bugs.webkit.org/show_bug.cgi?id=54109
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::willSendRequestForFrame): Use new WebKit2
API's instead of KURL to analyze the URL.
* WebKitTestRunner/StringFunctions.h:
(WTR::adoptWK): Moved from InjectedBundlePage.cpp to make it available globally
in the WebKitTestRunner project.
(WTR::toWK): Use adoptWK.
(WTR::operator<<): Added helper for printing a WKURL.
* WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj: Do not link
against WebCore.
2011-03-14 Balazs Kelemen <kbalazs@webkit.org>
Reviewed by Kenneth Rohde Christiansen.
......
......@@ -29,7 +29,6 @@
#include "StringFunctions.h"
#include <cmath>
#include <JavaScriptCore/JSRetainPtr.h>
#include <WebCore/KURL.h>
#include <WebKit2/WKArray.h>
#include <WebKit2/WKBundle.h>
#include <WebKit2/WKBundleBackForwardList.h>
......@@ -43,11 +42,6 @@ using namespace std;
namespace WTR {
template<typename T> static inline WKRetainPtr<T> adoptWK(T item)
{
return WKRetainPtr<T>(AdoptWK, item);
}
static bool hasPrefix(const string& searchString, const string& prefix)
{
return searchString.length() >= prefix.length() && searchString.substr(0, prefix.length()) == prefix;
......@@ -634,15 +628,15 @@ WKURLRequestRef InjectedBundlePage::willSendRequestForFrame(WKBundlePageRef, WKB
if (InjectedBundle::shared().isTestRunning() && InjectedBundle::shared().layoutTestController()->willSendRequestReturnsNull())
return 0;
string urlString = toSTD(adoptWK(WKURLCopyString(adoptWK(WKURLRequestCopyURL(request)).get())));
WebCore::KURL url(WebCore::ParsedURLString, urlString.c_str());
if (!url.host().isEmpty()
&& (equalIgnoringCase(url.protocol(), "http") || (equalIgnoringCase(url.protocol(), "https")))
&& (url.host() != "127.0.0.1")
&& (url.host() != "255.255.255.255") // used in some tests that expect to get back an error
&& (!equalIgnoringCase(url.host(), "localhost"))) {
InjectedBundle::shared().os() << "Blocked access to external URL " << urlString << "\n";
WKRetainPtr<WKURLRef> url = adoptWK(WKURLRequestCopyURL(request));
WKRetainPtr<WKStringRef> host = adoptWK(WKURLCopyHostName(url.get()));
WKRetainPtr<WKStringRef> scheme = adoptWK(WKURLCopyScheme(url.get()));
if (host
&& (WKStringIsEqualToUTF8CStringIgnoringCase(scheme.get(), "http") || WKStringIsEqualToUTF8CStringIgnoringCase(scheme.get(), "https"))
&& !WKStringIsEqualToUTF8CString(host.get(), "127.0.0.1")
&& !WKStringIsEqualToUTF8CString(host.get(), "255.255.255.255") // Used in some tests that expect to get back an error.
&& !WKStringIsEqualToUTF8CStringIgnoringCase(host.get(), "localhost")) {
InjectedBundle::shared().os() << "Blocked access to external URL " << url << "\n";
return 0;
}
......
......@@ -44,9 +44,14 @@ namespace WTR {
// Conversion functions
template<typename T> static inline WKRetainPtr<T> adoptWK(const T item)
{
return WKRetainPtr<T>(AdoptWK, item);
}
inline WKRetainPtr<WKStringRef> toWK(JSStringRef string)
{
return WKRetainPtr<WKStringRef>(AdoptWK, WKStringCreateWithJSString(string));
return adoptWK(WKStringCreateWithJSString(string));
}
inline WKRetainPtr<WKStringRef> toWK(JSRetainPtr<JSStringRef> string)
......@@ -92,6 +97,19 @@ inline std::ostream& operator<<(std::ostream& out, const WKRetainPtr<WKStringRef
return out << stringRef.get();
}
inline std::ostream& operator<<(std::ostream& out, WKURLRef urlRef)
{
if (!urlRef)
return out;
return out << toSTD(adoptWK(WKURLCopyString(urlRef)));
}
inline std::ostream& operator<<(std::ostream& out, const WKRetainPtr<WKURLRef>& urlRef)
{
return out << urlRef.get();
}
} // namespace WTR
#endif // StringFunctions_h
......@@ -32,8 +32,6 @@
6510A78A11EC643800410867 /* WebKitWeightWatcher700.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6510A77F11EC643800410867 /* WebKitWeightWatcher700.ttf */; };
6510A78B11EC643800410867 /* WebKitWeightWatcher800.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6510A78011EC643800410867 /* WebKitWeightWatcher800.ttf */; };
6510A78C11EC643800410867 /* WebKitWeightWatcher900.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 6510A78111EC643800410867 /* WebKitWeightWatcher900.ttf */; };
65DD1D9612FFE798004B5285 /* WebCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65DD1D9512FFE798004B5285 /* WebCore.framework */; };
65DE432512FFE84000171BCA /* WebCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65DD1D9512FFE798004B5285 /* WebCore.framework */; };
65EB85A011EC67CC0034D300 /* ActivateFonts.mm in Sources */ = {isa = PBXBuildFile; fileRef = 65EB859F11EC67CC0034D300 /* ActivateFonts.mm */; };
BC14E4DB120E02D000826C0C /* GCController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC14E4D9120E02D000826C0C /* GCController.cpp */; };
BC14E4EA120E03D800826C0C /* JSGCController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC14E4E8120E03D800826C0C /* JSGCController.cpp */; };
......@@ -90,7 +88,6 @@
6510A77F11EC643800410867 /* WebKitWeightWatcher700.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher700.ttf; path = fonts/WebKitWeightWatcher700.ttf; sourceTree = "<group>"; };
6510A78011EC643800410867 /* WebKitWeightWatcher800.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher800.ttf; path = fonts/WebKitWeightWatcher800.ttf; sourceTree = "<group>"; };
6510A78111EC643800410867 /* WebKitWeightWatcher900.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher900.ttf; path = fonts/WebKitWeightWatcher900.ttf; sourceTree = "<group>"; };
65DD1D9512FFE798004B5285 /* WebCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = WebCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
65EB859D11EC67CC0034D300 /* ActivateFonts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActivateFonts.h; sourceTree = "<group>"; };
65EB859F11EC67CC0034D300 /* ActivateFonts.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ActivateFonts.mm; sourceTree = "<group>"; };
8DD76FA10486AA7600D96B5E /* WebKitTestRunner */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = WebKitTestRunner; sourceTree = BUILT_PRODUCTS_DIR; };
......@@ -151,7 +148,6 @@
BC7934A511906584005EA8E2 /* Cocoa.framework in Frameworks */,
BC7934AC1190658C005EA8E2 /* WebKit2.framework in Frameworks */,
BCDA2B9A1191051F00C3BC47 /* JavaScriptCore.framework in Frameworks */,
65DD1D9612FFE798004B5285 /* WebCore.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -162,7 +158,6 @@
BC25193E11D15D8B002EBC01 /* Cocoa.framework in Frameworks */,
BC25193F11D15D8B002EBC01 /* WebKit2.framework in Frameworks */,
BC25194011D15D8B002EBC01 /* JavaScriptCore.framework in Frameworks */,
65DE432512FFE84000171BCA /* WebCore.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -204,7 +199,6 @@
BC7934A411906584005EA8E2 /* Cocoa.framework */,
BC7934AB1190658C005EA8E2 /* WebKit2.framework */,
BCDA2B991191051F00C3BC47 /* JavaScriptCore.framework */,
65DD1D9512FFE798004B5285 /* WebCore.framework */,
);
name = "External Frameworks and Libraries";
sourceTree = "<group>";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment