diff options
Diffstat (limited to 'Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp')
-rw-r--r-- | Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp index 3ce081e..3b73174 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp +++ b/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp @@ -23,13 +23,13 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ +#include "config.h" #include "InjectedBundlePage.h" #include "InjectedBundle.h" #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 +43,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; @@ -218,6 +213,8 @@ InjectedBundlePage::InjectedBundlePage(WKBundlePageRef page) 0, /*mouseDidMoveOverElement*/ 0, /*pageDidScroll*/ 0, /*paintCustomOverhangArea*/ + 0, /*shouldGenerateFileForUpload*/ + 0, /*generateFileForUpload*/ }; WKBundlePageSetUIClient(m_page, &uiClient); @@ -526,6 +523,9 @@ void InjectedBundlePage::dump() if (InjectedBundle::shared().layoutTestController()->shouldDumpBackForwardListsForAllWindows()) InjectedBundle::shared().dumpBackForwardListsForAllPages(); + if (InjectedBundle::shared().shouldDumpPixels() && InjectedBundle::shared().layoutTestController()->shouldDumpPixels()) + InjectedBundle::shared().setPixelResult(adoptWK(WKBundlePageCreateSnapshotInViewCoordinates(m_page, WKBundleFrameGetVisibleContentBounds(WKBundlePageGetMainFrame(m_page)), kWKImageOptionsShareable)).get()); + InjectedBundle::shared().done(); } @@ -634,15 +634,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 && !WKStringIsEmpty(host.get()) + && (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; } |