Changeset 69297 in webkit
- Timestamp:
- Oct 7, 2010 5:23:04 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit2/ChangeLog
r69245 r69297 1 2010-10-07 Balazs Kelemen <kbalazs@webkit.org> 2 3 Reviewed by Kenneth Rohde Christiansen. 4 5 WebKitTestRunner should be portable 6 https://bugs.webkit.org/show_bug.cgi?id=45393 7 8 Introducing additional URL API. 9 * Shared/API/c/WKURL.cpp: 10 (WKURLCreateWithUTF8CString): 11 (WKURLIsEqual): 12 * Shared/API/c/WKURL.h: 13 1 14 2010-10-06 Balazs Kelemen <kbalazs@webkit.org> 2 15 -
trunk/WebKit2/Shared/API/c/WKURL.cpp
r69214 r69297 34 34 return toAPI(WebURL::APIType); 35 35 } 36 37 WKURLRef WKURLCreateWithUTF8CString(const char* string) 38 { 39 return toAPI(WebURL::create(String::fromUTF8(string)).leakRef()); 40 } 41 42 bool WKURLIsEqual(WKURLRef a, WKURLRef b) 43 { 44 return toImpl(a)->string() == toImpl(b)->string(); 45 } -
trunk/WebKit2/Shared/API/c/WKURL.h
r68357 r69297 35 35 WK_EXPORT WKTypeID WKURLGetTypeID(); 36 36 37 WK_EXPORT WKURLRef WKURLCreateWithUTF8CString(const char* string); 38 39 WK_EXPORT bool WKURLIsEqual(WKURLRef a, WKURLRef b); 40 37 41 #ifdef __cplusplus 38 42 } -
trunk/WebKitTools/ChangeLog
r69294 r69297 1 2010-10-07 Balazs Kelemen <kbalazs@webkit.org> 2 3 Reviewed by Kenneth Rohde Christiansen. 4 5 WebKitTestRunner should be portable 6 https://bugs.webkit.org/show_bug.cgi?id=45393 7 8 Use only the WebKit API for working with urls. 9 * WebKitTestRunner/StringFunctions.h: 10 (WTR::createWKURL): 11 * WebKitTestRunner/TestController.cpp: 12 (WTR::blankURL): 13 (WTR::TestController::resetStateToConsistentValues): 14 (WTR::TestController::didFinishLoadForFrame): 15 1 16 2010-10-07 Carlos Garcia Campos <cgarcia@igalia.com> 2 17 -
trunk/WebKitTools/WebKitTestRunner/StringFunctions.h
r69129 r69297 1 1 /* 2 2 * Copyright (C) 2010 Apple Inc. All rights reserved. 3 * Copyright (C) 2010 University of Szeged. All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 29 30 #include <JavaScriptCore/JSRetainPtr.h> 30 31 #include <JavaScriptCore/JavaScript.h> 32 #include <sstream> 33 #include <string> 31 34 #include <WebKit2/WKRetainPtr.h> 32 35 #include <WebKit2/WKString.h> 33 #include <WebKit2/WKStringCF.h>34 36 #include <WebKit2/WKStringPrivate.h> 35 37 #include <WebKit2/WKURL.h> 36 #include <WebKit2/WKURLCF.h>37 #include <sstream>38 #include <string>39 38 #include <wtf/OwnArrayPtr.h> 40 39 #include <wtf/PassOwnArrayPtr.h> 41 40 #include <wtf/Platform.h> 42 #include <wtf/RetainPtr.h>43 41 #include <wtf/Vector.h> 44 42 … … 95 93 } 96 94 97 // URL Functions95 // URL creation 98 96 99 97 inline WKURLRef createWKURL(const char* pathOrURL) 100 98 { 101 RetainPtr<CFStringRef> pathOrURLCFString(AdoptCF, CFStringCreateWithCString(0, pathOrURL, kCFStringEncodingUTF8)); 102 RetainPtr<CFURLRef> cfURL; 103 if (CFStringHasPrefix(pathOrURLCFString.get(), CFSTR("http://")) || CFStringHasPrefix(pathOrURLCFString.get(), CFSTR("https://"))) 104 cfURL.adoptCF(CFURLCreateWithString(0, pathOrURLCFString.get(), 0)); 105 else 106 #if PLATFORM(WIN) 107 cfURL.adoptCF(CFURLCreateWithFileSystemPath(0, pathOrURLCFString.get(), kCFURLWindowsPathStyle, false)); 108 #else 109 cfURL.adoptCF(CFURLCreateWithFileSystemPath(0, pathOrURLCFString.get(), kCFURLPOSIXPathStyle, false)); 110 #endif 111 return WKURLCreateWithCFURL(cfURL.get()); 112 } 99 if (strstr(pathOrURL, "http://") || strstr(pathOrURL, "https") || strstr(pathOrURL, "file://")) 100 return WKURLCreateWithUTF8CString(pathOrURL); 113 101 114 inline WKStringRef copyURLString(WKURLRef url) 115 { 116 RetainPtr<CFURLRef> cfURL(AdoptCF, WKURLCopyCFURL(0, url)); 117 return WKStringCreateWithCFString(CFURLGetString(cfURL.get())); 102 const char* filePrefix = "file://"; 103 static const size_t prefixLength = strlen(filePrefix); 104 size_t length = strlen(pathOrURL); 105 OwnArrayPtr<char> buffer = adoptArrayPtr(new char[length + prefixLength + 1]); 106 strcpy(buffer.get(), filePrefix); 107 strcat(buffer.get(), pathOrURL); 108 return WKURLCreateWithUTF8CString(buffer.get()); 118 109 } 119 110 -
trunk/WebKitTools/WebKitTestRunner/TestController.cpp
r68966 r69297 35 35 namespace WTR { 36 36 37 static WKURLRef blankURL() 38 { 39 static staticBlankURL = WKURLCreateWithUTF8CString("about:blank"); 40 retun staticBlankURL; 41 } 42 37 43 static TestController* controller; 38 44 … … 228 234 m_doneResetting = false; 229 235 230 WKRetainPtr<WKURLRef> url(AdoptWK, createWKURL("about:blank")); 231 WKPageLoadURL(m_mainWebView->page(), url.get()); 236 WKPageLoadURL(m_mainWebView->page(), blankURL()); 232 237 TestController::runUntil(m_doneResetting); 233 238 } … … 296 301 297 302 WKRetainPtr<WKURLRef> wkURL(AdoptWK, WKFrameCopyURL(frame)); 298 WKRetainPtr<WKStringRef> wkURLString(AdoptWK, copyURLString(wkURL.get())); 299 if (!WKStringIsEqualToUTF8CString(wkURLString.get(), "about:blank")) 303 if (!WKURLIsEqual(wkURL.get(), blankURL())) 300 304 return; 301 305
Note: See TracChangeset
for help on using the changeset viewer.