Title: [131777] trunk/Source
Revision
131777
Author
msab...@apple.com
Date
2012-10-18 11:07:09 -0700 (Thu, 18 Oct 2012)

Log Message

Make conversion between JSStringRef and WKStringRef work without character size conversions
https://bugs.webkit.org/show_bug.cgi?id=99727

Reviewed by Anders Carlsson.

Source/_javascript_Core:

Export the string() method for use in WebKit.

* API/OpaqueJSString.h:
(OpaqueJSString::string):

Source/WebKit2:

Use the wrapped WTFString object to convert between JSStringRef and WKStringRef.

* Shared/WebString.h:
(WebKit::JSStringCreateWithString):
(WebKit::WebString::create):
(WebKit::WebString::createJSString):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/API/OpaqueJSString.h (131776 => 131777)


--- trunk/Source/_javascript_Core/API/OpaqueJSString.h	2012-10-18 18:03:14 UTC (rev 131776)
+++ trunk/Source/_javascript_Core/API/OpaqueJSString.h	2012-10-18 18:07:09 UTC (rev 131777)
@@ -51,7 +51,7 @@
     const UChar* characters() { return !!this ? m_string.characters() : 0; }
     unsigned length() { return !!this ? m_string.length() : 0; }
 
-    String string() const;
+    JS_EXPORT_PRIVATE String string() const;
     JSC::Identifier identifier(JSC::JSGlobalData*) const;
 
 private:

Modified: trunk/Source/_javascript_Core/ChangeLog (131776 => 131777)


--- trunk/Source/_javascript_Core/ChangeLog	2012-10-18 18:03:14 UTC (rev 131776)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-10-18 18:07:09 UTC (rev 131777)
@@ -1,3 +1,15 @@
+2012-10-18  Michael Saboff  <msab...@apple.com>
+
+        Make conversion between JSStringRef and WKStringRef work without character size conversions
+        https://bugs.webkit.org/show_bug.cgi?id=99727
+
+        Reviewed by Anders Carlsson.
+
+        Export the string() method for use in WebKit.
+
+        * API/OpaqueJSString.h:
+        (OpaqueJSString::string):
+
 2012-10-18  Raphael Kubo da Costa  <raphael.kubo.da.co...@intel.com>
 
         [CMake] Avoid unnecessarily running the LLInt generation commands.

Modified: trunk/Source/WebKit2/ChangeLog (131776 => 131777)


--- trunk/Source/WebKit2/ChangeLog	2012-10-18 18:03:14 UTC (rev 131776)
+++ trunk/Source/WebKit2/ChangeLog	2012-10-18 18:07:09 UTC (rev 131777)
@@ -1,3 +1,17 @@
+2012-10-18  Michael Saboff  <msab...@apple.com>
+
+        Make conversion between JSStringRef and WKStringRef work without character size conversions
+        https://bugs.webkit.org/show_bug.cgi?id=99727
+
+        Reviewed by Anders Carlsson.
+
+        Use the wrapped WTFString object to convert between JSStringRef and WKStringRef.
+
+        * Shared/WebString.h:
+        (WebKit::JSStringCreateWithString):
+        (WebKit::WebString::create):
+        (WebKit::WebString::createJSString):
+
 2012-10-18  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [GTK] Don't use using namespace WebKit in private headers in WebKit2

Modified: trunk/Source/WebKit2/Shared/WebString.h (131776 => 131777)


--- trunk/Source/WebKit2/Shared/WebString.h	2012-10-18 18:03:14 UTC (rev 131776)
+++ trunk/Source/WebKit2/Shared/WebString.h	2012-10-18 18:07:09 UTC (rev 131777)
@@ -27,7 +27,9 @@
 #define WebString_h
 
 #include "APIObject.h"
+#include <_javascript_Core/InitializeThreading.h>
 #include <_javascript_Core/JSStringRef.h>
+#include <_javascript_Core/OpaqueJSString.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/text/WTFString.h>
 #include <wtf/unicode/UTF8.h>
@@ -52,7 +54,7 @@
 
     static PassRefPtr<WebString> create(JSStringRef jsStringRef)
     {
-        return adoptRef(new WebString(String(JSStringGetCharactersPtr(jsStringRef), JSStringGetLength(jsStringRef))));
+        return adoptRef(new WebString(String(jsStringRef->string())));
     }
 
     static PassRefPtr<WebString> createFromUTF8String(const char* string)
@@ -93,7 +95,11 @@
 
     const String& string() const { return m_string; }
 
-    JSStringRef createJSString() const { return JSStringCreateWithCharacters(m_string.characters(), m_string.length()); }
+    JSStringRef createJSString() const
+    {
+        JSC::initializeThreading();
+        return OpaqueJSString::create(m_string).leakRef();
+    }
 
 private:
     WebString()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to