[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 14:03:49 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 83f8340c4c7eab98b833750a7513dff3cd6d9043
Author: weinig at apple.com <weinig at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Oct 2 00:40:14 2010 +0000

    WebKit2: Add SPI to convert a WKStringRef to a JSStringRef and vice-versa.
    
    Reviewed by Anders Carlsson.
    
    API Test: WebKit2/WKStringJSString
    
    * Shared/API/c/WKString.cpp:
    (WKStringCreateWithJSString):
    (WKStringCopyJSString):
    * Shared/API/c/WKStringPrivate.h: Added.
    * Shared/WebString.h:
    (WebKit::WebString::create):
    (WebKit::WebString::createJSString):
    * WebKit2.pro:
    * WebKit2.xcodeproj/project.pbxproj:
    * win/WebKit2.vcproj:
    * win/WebKit2Generated.make:
    
    WebKitTools: Build Fix for Windows.
    
    Patch by Brian Weinstein <bweinstein at apple.com> on 2010-10-01
    * WebKitTestRunner/win/WebKitTestRunner.vcproj: Don't copy ForwardingHeaders from
        WebKitTestRunner/ForwardingHeaders, instead, add $(WebKitOutputDir)/include/WebCore/
        ForwardingHeaders to the include path.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68961 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index c35a928..9d785c4 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,23 @@
+2010-10-01  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Anders Carlsson.
+
+        Add SPI to convert a WKStringRef to a JSStringRef and vice-versa.
+
+        API Test: WebKit2/WKStringJSString
+
+        * Shared/API/c/WKString.cpp:
+        (WKStringCreateWithJSString):
+        (WKStringCopyJSString):
+        * Shared/API/c/WKStringPrivate.h: Added.
+        * Shared/WebString.h:
+        (WebKit::WebString::create):
+        (WebKit::WebString::createJSString):
+        * WebKit2.pro:
+        * WebKit2.xcodeproj/project.pbxproj:
+        * win/WebKit2.vcproj:
+        * win/WebKit2Generated.make:
+
 2010-10-01  Anders Carlsson  <andersca at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/WebKit2/Shared/API/c/WKString.cpp b/WebKit2/Shared/API/c/WKString.cpp
index eafed3c..bf484e2 100644
--- a/WebKit2/Shared/API/c/WKString.cpp
+++ b/WebKit2/Shared/API/c/WKString.cpp
@@ -24,6 +24,7 @@
  */
 
 #include "WKString.h"
+#include "WKStringPrivate.h"
 
 #include "WKAPICast.h"
 
@@ -64,3 +65,14 @@ bool WKStringIsEqualToUTF8CString(WKStringRef aRef, const char* b)
 {
     return toWK(aRef)->equalToUTF8String(b);
 }
+
+WKStringRef WKStringCreateWithJSString(JSStringRef jsStringRef)
+{
+    RefPtr<WebString> webString = WebString::create(jsStringRef);
+    return toRef(webString.release().leakRef());
+}
+
+JSStringRef WKStringCopyJSString(WKStringRef stringRef)
+{
+    return toWK(stringRef)->createJSString();
+}
diff --git a/WebKit2/Shared/API/c/WKStringPrivate.h b/WebKit2/Shared/API/c/WKStringPrivate.h
new file mode 100644
index 0000000..f174f01
--- /dev/null
+++ b/WebKit2/Shared/API/c/WKStringPrivate.h
@@ -0,0 +1,43 @@
+/*
+ * 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 WKStringPrivate_h
+#define WKStringPrivate_h
+
+#include <JavaScriptCore/JavaScript.h>
+#include <WebKit2/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKStringRef WKStringCreateWithJSString(JSStringRef jsString);
+WK_EXPORT JSStringRef WKStringCopyJSString(WKStringRef string);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WKStringPrivate_h */
diff --git a/WebKit2/Shared/WebString.h b/WebKit2/Shared/WebString.h
index aa36a6d..0053b8e 100644
--- a/WebKit2/Shared/WebString.h
+++ b/WebKit2/Shared/WebString.h
@@ -27,6 +27,7 @@
 #define WebString_h
 
 #include "APIObject.h"
+#include <JavaScriptCore/JSStringRef.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
 #include <wtf/unicode/UTF8.h>
@@ -44,6 +45,11 @@ public:
         return adoptRef(new WebString(string));
     }
 
+    static PassRefPtr<WebString> create(JSStringRef jsStringRef)
+    {
+        return adoptRef(new WebString(String(JSStringGetCharactersPtr(jsStringRef), JSStringGetLength(jsStringRef))));
+    }
+
     static PassRefPtr<WebString> createFromUTF8String(const char* string)
     {
         return adoptRef(new WebString(String::fromUTF8(string)));
@@ -71,6 +77,8 @@ public:
 
     const String& string() const { return m_string; }
 
+    JSStringRef createJSString() const { return JSStringCreateWithCharacters(m_string.characters(), m_string.length()); }
+
 private:
     WebString(const String& string)
         : m_string(string)
diff --git a/WebKit2/WebKit2.pro b/WebKit2/WebKit2.pro
index 5f1731b..8c718f6 100644
--- a/WebKit2/WebKit2.pro
+++ b/WebKit2/WebKit2.pro
@@ -167,6 +167,7 @@ HEADERS += \
     Shared/API/c/WKSerializedScriptValue.h \
     Shared/API/c/WKSharedAPICast.h \
     Shared/API/c/WKString.h \
+    Shared/API/c/WKStringPrivate.h \
     Shared/API/c/WKType.h \
     Shared/API/c/WKURL.h \
     Shared/API/c/WKURLRequest.h \
diff --git a/WebKit2/WebKit2.xcodeproj/project.pbxproj b/WebKit2/WebKit2.xcodeproj/project.pbxproj
index 8f7ae04..6be3b18 100644
--- a/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -302,6 +302,7 @@
 		BC8780FC1161C2B800CC2768 /* PlatformProcessIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8780FB1161C2B800CC2768 /* PlatformProcessIdentifier.h */; };
 		BC87DFAA1018101400564216 /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = BC87DFA91018101400564216 /* libicucore.dylib */; };
 		BC8A501511765F5600757573 /* WKRetainPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8A501411765F5600757573 /* WKRetainPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		BC9099801256A98200083756 /* WKStringPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = BC90997F1256A98200083756 /* WKStringPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		BC90A1D2122DD55E00CC8C50 /* WebURLResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = BC90A1D0122DD55E00CC8C50 /* WebURLResponse.h */; };
 		BC90A1D3122DD55E00CC8C50 /* WebURLResponse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC90A1D1122DD55E00CC8C50 /* WebURLResponse.cpp */; };
 		BC90A1D7122DD66A00CC8C50 /* WebURLResponseMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC90A1D5122DD66A00CC8C50 /* WebURLResponseMac.mm */; };
@@ -748,6 +749,7 @@
 		BC87DFA91018101400564216 /* libicucore.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libicucore.dylib; path = /usr/lib/libicucore.dylib; sourceTree = "<absolute>"; };
 		BC8A501011765AF700757573 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = WebProcess/Info.plist; sourceTree = "<group>"; };
 		BC8A501411765F5600757573 /* WKRetainPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKRetainPtr.h; sourceTree = "<group>"; };
+		BC90997F1256A98200083756 /* WKStringPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKStringPrivate.h; sourceTree = "<group>"; };
 		BC90A1D0122DD55E00CC8C50 /* WebURLResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebURLResponse.h; sourceTree = "<group>"; };
 		BC90A1D1122DD55E00CC8C50 /* WebURLResponse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebURLResponse.cpp; sourceTree = "<group>"; };
 		BC90A1D5122DD66A00CC8C50 /* WebURLResponseMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebURLResponseMac.mm; sourceTree = "<group>"; };
@@ -1659,6 +1661,7 @@
 				BCDDB32A124EC2AB0048D13C /* WKSharedAPICast.h */,
 				BC4075E9124FF0270068F20A /* WKString.cpp */,
 				BC4075EA124FF0270068F20A /* WKString.h */,
+				BC90997F1256A98200083756 /* WKStringPrivate.h */,
 				BC4075EB124FF0270068F20A /* WKType.cpp */,
 				BC4075EC124FF0270068F20A /* WKType.h */,
 				BC4075ED124FF0270068F20A /* WKURL.cpp */,
@@ -1914,6 +1917,7 @@
 				1A8EF96F1252AF6B00F7067F /* PluginControllerProxyMessages.h in Headers */,
 				1A8EFA711252B84100F7067F /* PluginProxyMessages.h in Headers */,
 				1A8EFDFA1253CAA200F7067F /* DataReference.h in Headers */,
+				BC9099801256A98200083756 /* WKStringPrivate.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebKit2/win/WebKit2.vcproj b/WebKit2/win/WebKit2.vcproj
index a36094f..d1278d5 100755
--- a/WebKit2/win/WebKit2.vcproj
+++ b/WebKit2/win/WebKit2.vcproj
@@ -632,6 +632,10 @@
 					>
 				</File>
 				<File
+					RelativePath="..\Shared\API\c\WKStringPrivate.h"
+					>
+				</File>
+				<File
 					RelativePath="..\Shared\API\c\WKType.cpp"
 					>
 				</File>
diff --git a/WebKit2/win/WebKit2Generated.make b/WebKit2/win/WebKit2Generated.make
index 6256b2f..ebd72ca 100644
--- a/WebKit2/win/WebKit2Generated.make
+++ b/WebKit2/win/WebKit2Generated.make
@@ -18,6 +18,7 @@ all:
     xcopy /y /d "..\Shared\API\c\WKMutableDictionary.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
     xcopy /y /d "..\Shared\API\c\WKNumber.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
     xcopy /y /d "..\Shared\API\c\WKString.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
+    xcopy /y /d "..\Shared\API\c\WKStringPrivate.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
     xcopy /y /d "..\Shared\API\c\WKType.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
     xcopy /y /d "..\Shared\API\c\WKURL.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
     xcopy /y /d "..\Shared\API\c\WKURLRequest.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index c58a1e8..4d89846 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -8,6 +8,18 @@
 
 2010-10-01  Sam Weinig  <sam at webkit.org>
 
+        Reviewed by Anders Carlsson.
+
+        Add SPI to convert a WKStringRef to a JSStringRef and vice-versa.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebKit2/WKString.cpp:
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/WebKit2/WKStringJSString.cpp: Added.
+        (TestWebKitAPI::TEST):
+
+2010-10-01  Sam Weinig  <sam at webkit.org>
+
         Reviewed by Kenneth Rohde Christiansen.
 
         Add additional WKString API
diff --git a/WebKitTools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj b/WebKitTools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
index 0a38bf6..af94fc6 100644
--- a/WebKitTools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
+++ b/WebKitTools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
@@ -16,6 +16,7 @@
 		BC90977A125571AB00083756 /* PageLoadBasic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC909779125571AB00083756 /* PageLoadBasic.cpp */; };
 		BC909784125571CF00083756 /* basic-1.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = BC909778125571AB00083756 /* basic-1.html */; };
 		BC90995E12567BC100083756 /* WKString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC90995D12567BC100083756 /* WKString.cpp */; };
+		BC9099941256ACF100083756 /* WKStringJSString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC9099931256ACF100083756 /* WKStringJSString.cpp */; };
 		BCA61DB511700EFD00460D1E /* WebKit2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BCA61DB411700EFD00460D1E /* WebKit2.framework */; };
 		BCB9E9F111235BDE00A137E0 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BCB9E9F011235BDE00A137E0 /* Cocoa.framework */; };
 /* End PBXBuildFile section */
@@ -60,6 +61,7 @@
 		BC909778125571AB00083756 /* basic-1.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "basic-1.html"; sourceTree = "<group>"; };
 		BC909779125571AB00083756 /* PageLoadBasic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageLoadBasic.cpp; sourceTree = "<group>"; };
 		BC90995D12567BC100083756 /* WKString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKString.cpp; sourceTree = "<group>"; };
+		BC9099931256ACF100083756 /* WKStringJSString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKStringJSString.cpp; sourceTree = "<group>"; };
 		BCA61DB411700EFD00460D1E /* WebKit2.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = WebKit2.framework; sourceTree = BUILT_PRODUCTS_DIR; };
 		BCB9E7C711234E3A00A137E0 /* TestsController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestsController.h; sourceTree = "<group>"; };
 		BCB9E7FA112359A300A137E0 /* Test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Test.h; sourceTree = "<group>"; };
@@ -140,6 +142,7 @@
 				BC90977B125571AE00083756 /* Resources */,
 				BC909779125571AB00083756 /* PageLoadBasic.cpp */,
 				BC90995D12567BC100083756 /* WKString.cpp */,
+				BC9099931256ACF100083756 /* WKStringJSString.cpp */,
 			);
 			path = WebKit2;
 			sourceTree = "<group>";
@@ -230,6 +233,7 @@
 				BC90964C125561BF00083756 /* VectorBasic.cpp in Sources */,
 				BC90977A125571AB00083756 /* PageLoadBasic.cpp in Sources */,
 				BC90995E12567BC100083756 /* WKString.cpp in Sources */,
+				BC9099941256ACF100083756 /* WKStringJSString.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebKitTools/TestWebKitAPI/Tests/WebKit2/WKString.cpp b/WebKitTools/TestWebKitAPI/Tests/WebKit2/WKString.cpp
index 2b69989..c415a0d 100644
--- a/WebKitTools/TestWebKitAPI/Tests/WebKit2/WKString.cpp
+++ b/WebKitTools/TestWebKitAPI/Tests/WebKit2/WKString.cpp
@@ -45,6 +45,8 @@ TEST(WKString)
     TEST_ASSERT(strcmp(buffer, "hello") == 0);
 
     free(buffer);
+    
+    WKRelease(string);
 }
 
 } // namespace TestWebKitAPI
diff --git a/WebKitTools/TestWebKitAPI/Tests/WebKit2/WKStringJSString.cpp b/WebKitTools/TestWebKitAPI/Tests/WebKit2/WKStringJSString.cpp
new file mode 100644
index 0000000..3831143
--- /dev/null
+++ b/WebKitTools/TestWebKitAPI/Tests/WebKit2/WKStringJSString.cpp
@@ -0,0 +1,52 @@
+/*
+ * 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.
+ */
+
+#include "Test.h"
+
+#include <WebKit2/WKString.h>
+#include <WebKit2/WKStringPrivate.h>
+#include <JavaScriptCore/JSStringRef.h>
+
+namespace TestWebKitAPI {
+
+TEST(WKStringJSString)
+{
+    WKStringRef wkString = WKStringCreateWithUTF8CString("hello");
+    JSStringRef jsString = JSStringCreateWithUTF8CString("hello");
+    
+    WKStringRef convertedJSString = WKStringCreateWithJSString(jsString);
+    TEST_ASSERT(WKStringIsEqual(wkString, convertedJSString));
+    
+    JSStringRef convertedWKString = WKStringCopyJSString(wkString);
+    TEST_ASSERT(JSStringIsEqual(jsString, convertedWKString));
+
+    WKRelease(wkString);
+    WKRelease(convertedJSString);
+
+    JSStringRelease(jsString);
+    JSStringRelease(convertedWKString);
+}
+
+} // namespace TestWebKitAPI

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list