Diff
Added: trunk/Source/_javascript_Core/API/JSStringRefQt.cpp (0 => 145700)
--- trunk/Source/_javascript_Core/API/JSStringRefQt.cpp (rev 0)
+++ trunk/Source/_javascript_Core/API/JSStringRefQt.cpp 2013-03-13 10:14:50 UTC (rev 145700)
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+ *
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. OR
+ * 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 "config.h"
+#include "JSStringRefQt.h"
+
+#include "APICast.h"
+#include "InitializeThreading.h"
+#include "JSStringRef.h"
+#include "OpaqueJSString.h"
+#include <runtime/JSCJSValue.h>
+#include <wtf/OwnArrayPtr.h>
+
+QString JSStringCopyQString(JSStringRef string)
+{
+ return string->qString();
+}
Added: trunk/Source/_javascript_Core/API/JSStringRefQt.h (0 => 145700)
--- trunk/Source/_javascript_Core/API/JSStringRefQt.h (rev 0)
+++ trunk/Source/_javascript_Core/API/JSStringRefQt.h 2013-03-13 10:14:50 UTC (rev 145700)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2006, 2007 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+ *
+ * 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 COMPUTER, INC. ``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 COMPUTER, INC. OR
+ * 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 JSStringRefQt_h
+#define JSStringRefQt_h
+
+#include "JSBase.h"
+#include <QString>
+
+/* QString convenience methods */
+
+/*!
+@function
+@abstract Creates a QString from a _javascript_ string.
+@param string The JSString to copy into the new QString.
+@result A QString containing string.
+*/
+JS_EXPORT QString JSStringCopyQString(JSStringRef string);
+
+#endif /* JSStringRefQt_h */
Modified: trunk/Source/_javascript_Core/API/OpaqueJSString.h (145699 => 145700)
--- trunk/Source/_javascript_Core/API/OpaqueJSString.h 2013-03-13 10:13:00 UTC (rev 145699)
+++ trunk/Source/_javascript_Core/API/OpaqueJSString.h 2013-03-13 10:14:50 UTC (rev 145700)
@@ -58,6 +58,9 @@
JS_EXPORT_PRIVATE String string() const;
JSC::Identifier identifier(JSC::JSGlobalData*) const;
+#if PLATFORM(QT)
+ QString qString() const { return m_string; }
+#endif
private:
friend class WTF::ThreadSafeRefCounted<OpaqueJSString>;
Modified: trunk/Source/_javascript_Core/ChangeLog (145699 => 145700)
--- trunk/Source/_javascript_Core/ChangeLog 2013-03-13 10:13:00 UTC (rev 145699)
+++ trunk/Source/_javascript_Core/ChangeLog 2013-03-13 10:14:50 UTC (rev 145700)
@@ -1,3 +1,22 @@
+2013-02-13 Simon Hausmann <simon.hausm...@digia.com>
+
+ Add support for convenient conversion from JSStringRef to QString
+ https://bugs.webkit.org/show_bug.cgi?id=109694
+
+ Reviewed by Allan Sandfeld Jensen.
+
+ Add JSStringCopyQString helper function that allows for the convenient
+ extraction of a QString out of a JSStringRef.
+
+ * API/JSStringRefQt.cpp: Added.
+ (JSStringCopyQString):
+ * API/JSStringRefQt.h: Added.
+ * API/OpaqueJSString.h:
+ (OpaqueJSString):
+ (OpaqueJSString::qString):
+ (OpaqueJSString::OpaqueJSString):
+ * Target.pri:
+
2013-03-13 Peter Gal <galpe...@inf.u-szeged.hu>
Token 'not' is ignored in the offlineasm.
Modified: trunk/Source/_javascript_Core/Target.pri (145699 => 145700)
--- trunk/Source/_javascript_Core/Target.pri 2013-03-13 10:13:00 UTC (rev 145699)
+++ trunk/Source/_javascript_Core/Target.pri 2013-03-13 10:14:50 UTC (rev 145700)
@@ -43,6 +43,7 @@
API/JSObjectRef.cpp \
API/JSScriptRef.cpp \
API/JSStringRef.cpp \
+ API/JSStringRefQt.cpp \
API/JSValueRef.cpp \
API/JSWeakObjectMapRefPrivate.cpp \
API/OpaqueJSString.cpp \