[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

weinig at apple.com weinig at apple.com
Wed Dec 22 11:40:57 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 2bf7a198c254ab7137b42dda3c4f34cf8f3f7613
Author: weinig at apple.com <weinig at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Aug 3 19:18:16 2010 +0000

    Roll r64566 back in this time with all the overloads in place..
    
    * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
    (WTR::InjectedBundlePage::shouldInsertNode):
    * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
    * WebKitTestRunner/StringFunctions.h:
    * WebKitTestRunner/TestInvocation.cpp:
    (WTR::TestInvocation::resetPreferencesToConsistentValues):
    (WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
    * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64576 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 5e18f1b..954f68a 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,5 +1,18 @@
 2010-08-03  Sam Weinig  <sam at webkit.org>
 
+        Roll r64566 back in this time with all the overloads in place..
+
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+        (WTR::InjectedBundlePage::shouldInsertNode):
+        * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
+        * WebKitTestRunner/StringFunctions.h:
+        * WebKitTestRunner/TestInvocation.cpp:
+        (WTR::TestInvocation::resetPreferencesToConsistentValues):
+        (WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
+        * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
+
+2010-08-03  Sam Weinig  <sam at webkit.org>
+
         Rollout r64566. It broke all the WebKit2 tests.
 
         * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
index 406787e..fe6488d 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
@@ -26,6 +26,7 @@
 #include "InjectedBundlePage.h"
 
 #include "InjectedBundle.h"
+#include "StringFunctions.h"
 #include <JavaScriptCore/JSRetainPtr.h>
 #include <WebKit2/WKArray.h>
 #include <WebKit2/WKBundleFrame.h>
@@ -34,45 +35,11 @@
 #include <WebKit2/WKBundlePagePrivate.h>
 #include <WebKit2/WKRetainPtr.h>
 #include <WebKit2/WKBundleRange.h>
-#include <WebKit2/WKString.h>
-#include <WebKit2/WKStringCF.h>
-#include <wtf/PassOwnPtr.h>
-#include <wtf/RetainPtr.h>
-#include <wtf/Vector.h>
 
 using namespace std;
 
 namespace WTR {
 
-static ostream& operator<<(ostream& out, CFStringRef stringRef)
-{
-    if (!stringRef)
-        return out;
-    CFIndex bufferLength = CFStringGetMaximumSizeForEncoding(CFStringGetLength(stringRef), kCFStringEncodingUTF8) + 1;
-    Vector<char> buffer(bufferLength);
-    if (!CFStringGetCString(stringRef, buffer.data(), bufferLength, kCFStringEncodingUTF8))
-        return out;
-    return out << buffer.data();
-}
-
-static ostream& operator<<(ostream& out, const RetainPtr<CFStringRef>& stringRef)
-{
-    return out << stringRef.get();
-}
-
-static ostream& operator<<(ostream& out, WKStringRef stringRef)
-{
-    if (!stringRef)
-        return out;
-    RetainPtr<CFStringRef> cfString(AdoptCF, WKStringCopyCFString(0, stringRef));
-    return out << cfString;
-}
-
-static ostream& operator<<(ostream& out, const WKRetainPtr<WKStringRef>& stringRef)
-{
-    return out << stringRef.get();
-}
-
 static string dumpPath(WKBundleNodeRef node)
 {
     if (!node)
@@ -492,7 +459,7 @@ bool InjectedBundlePage::shouldEndEditing(WKBundleRangeRef range)
 
 bool InjectedBundlePage::shouldInsertNode(WKBundleNodeRef node, WKBundleRangeRef rangeToReplace, WKInsertActionType action)
 {
-    static const char *insertactionstring[] = {
+    static const char* insertactionstring[] = {
         "WebViewInsertActionTyped",
         "WebViewInsertActionPasted",
         "WebViewInsertActionDropped",
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
index 8fda21e..490640c 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
@@ -28,12 +28,11 @@
 #include "InjectedBundle.h"
 #include "InjectedBundlePage.h"
 #include "JSLayoutTestController.h"
-#include <JavaScriptCore/JSRetainPtr.h>
+#include "StringFunctions.h"
 #include <WebKit2/WKBundleFrame.h>
 #include <WebKit2/WKBundleFramePrivate.h>
 #include <WebKit2/WKBundlePagePrivate.h>
 #include <WebKit2/WKRetainPtr.h>
-#include <WebKit2/WKStringCF.h>
 #include <WebKit2/WebKit2.h>
 
 namespace WTR {
@@ -42,31 +41,6 @@ namespace WTR {
 // Eventually it should be changed to match.
 static const CFTimeInterval waitToDumpWatchdogInterval = 6.0;
 
-static RetainPtr<CFStringRef> toCF(JSStringRef string)
-{
-    return RetainPtr<CFStringRef>(AdoptCF, JSStringCopyCFString(0, string));
-}
-
-static RetainPtr<CFStringRef> toCF(WKStringRef string)
-{
-    return RetainPtr<CFStringRef>(AdoptCF, WKStringCopyCFString(0, string));
-}
-
-static WKRetainPtr<WKStringRef> toWK(JSStringRef string)
-{
-    return WKRetainPtr<WKStringRef>(AdoptWK, WKStringCreateWithCFString(toCF(string).get()));
-}
-
-static JSRetainPtr<JSStringRef> toJS(WKStringRef string)
-{
-    return JSRetainPtr<JSStringRef>(Adopt, JSStringCreateWithCFString(toCF(string).get()));
-}
-
-static JSRetainPtr<JSStringRef> toJS(const WKRetainPtr<WKStringRef>& string)
-{
-    return toJS(string.get());
-}
-
 static void setProperty(JSContextRef context, JSObjectRef object, const char* propertyName, JSWrappable* value, JSPropertyAttributes attributes, JSValueRef* exception)
 {
     JSRetainPtr<JSStringRef> propertyNameString(Adopt, JSStringCreateWithUTF8CString(propertyName));
diff --git a/WebKitTools/WebKitTestRunner/StringFunctions.h b/WebKitTools/WebKitTestRunner/StringFunctions.h
new file mode 100644
index 0000000..4f8fe93
--- /dev/null
+++ b/WebKitTools/WebKitTestRunner/StringFunctions.h
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef StringFunctions_h
+#define StringFunctions_h
+
+#include <JavaScriptCore/JSRetainPtr.h>
+#include <JavaScriptCore/JavaScriptCore.h>
+#include <WebKit2/WKRetainPtr.h>
+#include <WebKit2/WKString.h>
+#include <WebKit2/WKStringCF.h>
+#include <WebKit2/WKURL.h>
+#include <WebKit2/WKURLCF.h>
+#include <sstream>
+#include <wtf/Platform.h>
+#include <wtf/RetainPtr.h>
+#include <wtf/Vector.h>
+
+namespace WTR {
+
+// Conversion functions
+
+inline RetainPtr<CFStringRef> toCF(JSStringRef string)
+{
+    return RetainPtr<CFStringRef>(AdoptCF, JSStringCopyCFString(0, string));
+}
+
+inline RetainPtr<CFStringRef> toCF(WKStringRef string)
+{
+    return RetainPtr<CFStringRef>(AdoptCF, WKStringCopyCFString(0, string));
+}
+
+inline WKRetainPtr<WKStringRef> toWK(JSStringRef string)
+{
+    return WKRetainPtr<WKStringRef>(AdoptWK, WKStringCreateWithCFString(toCF(string).get()));
+}
+
+inline WKRetainPtr<WKStringRef> toWK(JSRetainPtr<JSStringRef> string)
+{
+    return WKRetainPtr<WKStringRef>(AdoptWK, WKStringCreateWithCFString(toCF(string.get()).get()));
+}
+
+inline JSRetainPtr<JSStringRef> toJS(WKStringRef string)
+{
+    return JSRetainPtr<JSStringRef>(Adopt, JSStringCreateWithCFString(toCF(string).get()));
+}
+
+inline JSRetainPtr<JSStringRef> toJS(const WKRetainPtr<WKStringRef>& string)
+{
+    return toJS(string.get());
+}
+
+// Streaming functions
+
+inline std::ostream& operator<<(std::ostream& out, CFStringRef stringRef)
+{
+    if (!stringRef)
+        return out;
+    CFIndex bufferLength = CFStringGetMaximumSizeForEncoding(CFStringGetLength(stringRef), kCFStringEncodingUTF8) + 1;
+    Vector<char> buffer(bufferLength);
+    if (!CFStringGetCString(stringRef, buffer.data(), bufferLength, kCFStringEncodingUTF8))
+        return out;
+    return out << buffer.data();
+}
+
+inline std::ostream& operator<<(std::ostream& out, const RetainPtr<CFStringRef>& stringRef)
+{
+    return out << stringRef.get();
+}
+
+inline std::ostream& operator<<(std::ostream& out, WKStringRef stringRef)
+{
+    if (!stringRef)
+        return out;
+    return out << toCF(stringRef);
+}
+
+inline std::ostream& operator<<(std::ostream& out, const WKRetainPtr<WKStringRef>& stringRef)
+{
+    return out << stringRef.get();
+}
+
+// URL creation
+
+inline WKURLRef createWKURL(const char* pathOrURL)
+{
+    RetainPtr<CFStringRef> pathOrURLCFString(AdoptCF, CFStringCreateWithCString(0, pathOrURL, kCFStringEncodingUTF8));
+    RetainPtr<CFURLRef> cfURL;
+    if (CFStringHasPrefix(pathOrURLCFString.get(), CFSTR("http://")) || CFStringHasPrefix(pathOrURLCFString.get(), CFSTR("https://")))
+        cfURL.adoptCF(CFURLCreateWithString(0, pathOrURLCFString.get(), 0));
+    else
+#if PLATFORM(WIN)
+        cfURL.adoptCF(CFURLCreateWithFileSystemPath(0, pathOrURLCFString.get(), kCFURLWindowsPathStyle, false));
+#else
+        cfURL.adoptCF(CFURLCreateWithFileSystemPath(0, pathOrURLCFString.get(), kCFURLPOSIXPathStyle, false));
+#endif
+    return WKURLCreateWithCFURL(cfURL.get());
+}
+
+
+} // namespace WTR
+
+#endif // StringFunctions_h
diff --git a/WebKitTools/WebKitTestRunner/TestInvocation.cpp b/WebKitTools/WebKitTestRunner/TestInvocation.cpp
index 658911b..e65ca8d 100644
--- a/WebKitTools/WebKitTestRunner/TestInvocation.cpp
+++ b/WebKitTools/WebKitTestRunner/TestInvocation.cpp
@@ -26,47 +26,17 @@
 #include "TestInvocation.h"
 
 #include "PlatformWebView.h"
+#include "StringFunctions.h"
 #include "TestController.h"
 #include <WebKit2/WKContextPrivate.h>
 #include <WebKit2/WKRetainPtr.h>
-#include <WebKit2/WKStringCF.h>
-#include <WebKit2/WKURLCF.h>
-#include <wtf/PassOwnPtr.h>
 #include <wtf/RetainPtr.h>
-#include <wtf/Vector.h>
 
 using namespace WebKit;
+using namespace std;
 
 namespace WTR {
 
-static WKURLRef createWKURL(const char* pathOrURL)
-{
-    RetainPtr<CFStringRef> pathOrURLCFString(AdoptCF, CFStringCreateWithCString(0, pathOrURL, kCFStringEncodingUTF8));
-    RetainPtr<CFURLRef> cfURL;
-    if (CFStringHasPrefix(pathOrURLCFString.get(), CFSTR("http://")) || CFStringHasPrefix(pathOrURLCFString.get(), CFSTR("https://")))
-        cfURL.adoptCF(CFURLCreateWithString(0, pathOrURLCFString.get(), 0));
-    else
-#if defined(WIN32) || defined(_WIN32)
-        cfURL.adoptCF(CFURLCreateWithFileSystemPath(0, pathOrURLCFString.get(), kCFURLWindowsPathStyle, false));
-#else
-        cfURL.adoptCF(CFURLCreateWithFileSystemPath(0, pathOrURLCFString.get(), kCFURLPOSIXPathStyle, false));
-#endif
-    return WKURLCreateWithCFURL(cfURL.get());
-}
-
-static PassOwnPtr<Vector<char> > WKStringToUTF8(WKStringRef wkStringRef)
-{
-    RetainPtr<CFStringRef> cfString(AdoptCF, WKStringCopyCFString(0, wkStringRef));
-    CFIndex bufferLength = CFStringGetMaximumSizeForEncoding(CFStringGetLength(cfString.get()), kCFStringEncodingUTF8) + 1;
-    OwnPtr<Vector<char> > buffer(new Vector<char>(bufferLength));
-    if (!CFStringGetCString(cfString.get(), buffer->data(), bufferLength, kCFStringEncodingUTF8)) {
-        buffer->shrink(1);
-        (*buffer)[0] = 0;
-    } else
-        buffer->shrink(strlen(buffer->data()) + 1);
-    return buffer.release();
-}
-
 TestInvocation::TestInvocation(const char* pathOrURL)
     : m_url(AdoptWK, createWKURL(pathOrURL))
     , m_pathOrURL(fastStrDup(pathOrURL))
@@ -99,7 +69,6 @@ static void sizeWebViewForCurrentTest(char* pathOrURL)
 void TestInvocation::resetPreferencesToConsistentValues()
 {
     WKPreferencesRef preferences = WKContextGetPreferences(TestController::shared().context());
-    
     WKPreferencesSetOfflineWebApplicationCacheEnabled(preferences, true);
 }
 
@@ -165,8 +134,11 @@ void TestInvocation::didReceiveMessageFromInjectedBundle(WKStringRef messageName
 
     if (CFEqual(cfMessageName.get(), CFSTR("Done"))) {
         ASSERT(WKGetTypeID(messageBody) == WKStringGetTypeID());
-        OwnPtr<Vector<char> > utf8Message = WKStringToUTF8(static_cast<WKStringRef>(messageBody));
-        dump(utf8Message->data());
+        ostringstream out;
+        out << static_cast<WKStringRef>(messageBody);
+
+        dump(out.str().c_str());
+
         m_gotFinalMessage = true;
         return;
     }
diff --git a/WebKitTools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj b/WebKitTools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj
index eccf330..145729d 100644
--- a/WebKitTools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj
+++ b/WebKitTools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj
@@ -109,6 +109,7 @@
 		BC952ED311F3C318003398B4 /* CodeGeneratorTestRunner.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = CodeGeneratorTestRunner.pm; sourceTree = "<group>"; };
 		BC952F1D11F3C652003398B4 /* JSLayoutTestController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSLayoutTestController.cpp; path = DerivedSources/WebKitTestRunner/JSLayoutTestController.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
 		BC952F1E11F3C652003398B4 /* JSLayoutTestController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSLayoutTestController.h; path = DerivedSources/WebKitTestRunner/JSLayoutTestController.h; sourceTree = BUILT_PRODUCTS_DIR; };
+		BC99A4841208901A007E9F08 /* StringFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringFunctions.h; sourceTree = "<group>"; };
 		BCC997A011D3C8F60017BCA2 /* InjectedBundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundle.cpp; sourceTree = "<group>"; };
 		BCC997A111D3C8F60017BCA2 /* InjectedBundle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundle.h; sourceTree = "<group>"; };
 		BCC997A211D3C8F60017BCA2 /* InjectedBundlePage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundlePage.cpp; sourceTree = "<group>"; };
@@ -149,7 +150,8 @@
 			isa = PBXGroup;
 			children = (
 				BC952EC511F3C10F003398B4 /* DerivedSources.make */,
-				08FB7795FE84155DC02AAC07 /* Source */,
+				BC99CBF11207642D00FDEE76 /* Shared */,
+				08FB7795FE84155DC02AAC07 /* TestRunner */,
 				BC25183511D1571D002EBC01 /* InjectedBundle */,
 				BC793401118F7C8A005EA8E2 /* Configurations */,
 				08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */,
@@ -159,7 +161,7 @@
 			name = WebKitTestRunner;
 			sourceTree = "<group>";
 		};
-		08FB7795FE84155DC02AAC07 /* Source */ = {
+		08FB7795FE84155DC02AAC07 /* TestRunner */ = {
 			isa = PBXGroup;
 			children = (
 				BC7933FE118F7C74005EA8E2 /* mac */,
@@ -170,7 +172,7 @@
 				BCD7D2F611921278006DB7EE /* TestInvocation.h */,
 				BCD7D2F711921278006DB7EE /* TestInvocation.cpp */,
 			);
-			name = Source;
+			name = TestRunner;
 			sourceTree = "<group>";
 		};
 		08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */ = {
@@ -280,6 +282,14 @@
 			name = "Derived Sources";
 			sourceTree = "<group>";
 		};
+		BC99CBF11207642D00FDEE76 /* Shared */ = {
+			isa = PBXGroup;
+			children = (
+				BC99A4841208901A007E9F08 /* StringFunctions.h */,
+			);
+			name = Shared;
+			sourceTree = "<group>";
+		};
 /* End PBXGroup section */
 
 /* Begin PBXNativeTarget section */

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list