[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
kbalazs at webkit.org
kbalazs at webkit.org
Wed Dec 22 14:34:22 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 06e5c3476133147db920b91097630cce11c9296e
Author: kbalazs at webkit.org <kbalazs at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Oct 13 14:07:06 2010 +0000
2010-10-13 Balazs Kelemen <kbalazs at webkit.org>
Reviewed by Csaba Osztrogonác.
WTR should accept relative paths
https://bugs.webkit.org/show_bug.cgi?id=47486
* WebKitTestRunner/StringFunctions.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::createWKURL): Moved from StringFunctions.h since it is
used only here. Extend relative paths to absolute.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69657 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 4a0ee89..90cbb27 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,15 @@
+2010-10-13 Balazs Kelemen <kbalazs at webkit.org>
+
+ Reviewed by Csaba Osztrogonác.
+
+ WTR should accept relative paths
+ https://bugs.webkit.org/show_bug.cgi?id=47486
+
+ * WebKitTestRunner/StringFunctions.h:
+ * WebKitTestRunner/TestInvocation.cpp:
+ (WTR::createWKURL): Moved from StringFunctions.h since it is
+ used only here. Extend relative paths to absolute.
+
2010-10-12 Adam Roben <aroben at apple.com>
Make TestWebKitAPI work on Windows
diff --git a/WebKitTools/WebKitTestRunner/StringFunctions.h b/WebKitTools/WebKitTestRunner/StringFunctions.h
index 862ddee..2d0ca72 100644
--- a/WebKitTools/WebKitTestRunner/StringFunctions.h
+++ b/WebKitTools/WebKitTestRunner/StringFunctions.h
@@ -92,22 +92,6 @@ inline std::ostream& operator<<(std::ostream& out, const WKRetainPtr<WKStringRef
return out << stringRef.get();
}
-// URL creation
-
-inline WKURLRef createWKURL(const char* pathOrURL)
-{
- if (strstr(pathOrURL, "http://") || strstr(pathOrURL, "https") || strstr(pathOrURL, "file://"))
- return WKURLCreateWithUTF8CString(pathOrURL);
-
- const char* filePrefix = "file://";
- static const size_t prefixLength = strlen(filePrefix);
- size_t length = strlen(pathOrURL);
- OwnArrayPtr<char> buffer = adoptArrayPtr(new char[length + prefixLength + 1]);
- strcpy(buffer.get(), filePrefix);
- strcat(buffer.get(), pathOrURL);
- return WKURLCreateWithUTF8CString(buffer.get());
-}
-
} // namespace WTR
#endif // StringFunctions_h
diff --git a/WebKitTools/WebKitTestRunner/TestInvocation.cpp b/WebKitTools/WebKitTestRunner/TestInvocation.cpp
index 9116c3f..c1bf894 100644
--- a/WebKitTools/WebKitTestRunner/TestInvocation.cpp
+++ b/WebKitTools/WebKitTestRunner/TestInvocation.cpp
@@ -28,17 +28,62 @@
#include "PlatformWebView.h"
#include "StringFunctions.h"
#include "TestController.h"
+#include <climits>
#include <cstdio>
#include <WebKit2/WKContextPrivate.h>
#include <WebKit2/WKRetainPtr.h>
#include <wtf/OwnArrayPtr.h>
#include <wtf/PassOwnArrayPtr.h>
+#if OS(WINDOWS)
+#include <direct.h> // For _getcwd.
+#define getcwd _getcwd // MSDN says getcwd is deprecated.
+#define PATH_MAX _MAX_PATH
+#endif
+
using namespace WebKit;
using namespace std;
namespace WTR {
+static WKURLRef createWKURL(const char* pathOrURL)
+{
+ if (strstr(pathOrURL, "http://") || strstr(pathOrURL, "https://") || strstr(pathOrURL, "file://"))
+ return WKURLCreateWithUTF8CString(pathOrURL);
+
+ // Creating from filesytem path.
+ size_t length = strlen(pathOrURL);
+ if (!length)
+ return 0;
+
+ const char* filePrefix = "file://";
+ static const size_t prefixLength = strlen(filePrefix);
+#if OS(WINDOWS)
+ const char separator = '\\';
+ bool isAbsolutePath = length >= 3 && pathOrURL[1] == ':' && pathOrURL[2] == separator;
+#else
+ const char separator = '/';
+ bool isAbsolutePath = pathOrURL[0] == separator;
+#endif
+
+ OwnArrayPtr<char> buffer;
+ if (isAbsolutePath) {
+ buffer = adoptArrayPtr(new char[prefixLength + length + 1]);
+ strcpy(buffer.get(), filePrefix);
+ strcpy(buffer.get() + prefixLength, pathOrURL);
+ } else {
+ buffer = adoptArrayPtr(new char[prefixLength + PATH_MAX + length + 2]); // 1 for the separator
+ strcpy(buffer.get(), filePrefix);
+ if (!getcwd(buffer.get() + prefixLength, PATH_MAX))
+ return 0;
+ size_t numCharacters = strlen(buffer.get());
+ buffer[numCharacters] = separator;
+ strcpy(buffer.get() + numCharacters + 1, pathOrURL);
+ }
+
+ return WKURLCreateWithUTF8CString(buffer.get());
+}
+
TestInvocation::TestInvocation(const char* pathOrURL)
: m_url(AdoptWK, createWKURL(pathOrURL))
, m_pathOrURL(fastStrDup(pathOrURL))
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list