Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (188993 => 188994)
--- trunk/Source/_javascript_Core/ChangeLog 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/_javascript_Core/ChangeLog 2015-08-26 22:09:29 UTC (rev 188994)
@@ -1,3 +1,15 @@
+2015-08-26 Chris Dumez <cdu...@apple.com>
+
+ Distinguish Web IDL callback interfaces from Web IDL callback functions
+ https://bugs.webkit.org/show_bug.cgi?id=148434
+
+ Reviewed by Geoffrey Garen.
+
+ Add isNull() convenience method on PropertyName.
+
+ * runtime/PropertyName.h:
+ (JSC::PropertyName::isNull):
+
2015-08-26 Filip Pizlo <fpi...@apple.com>
Node::origin should be able to tell you if it's OK to exit
Modified: trunk/Source/_javascript_Core/runtime/PropertyName.h (188993 => 188994)
--- trunk/Source/_javascript_Core/runtime/PropertyName.h 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/_javascript_Core/runtime/PropertyName.h 2015-08-26 22:09:29 UTC (rev 188994)
@@ -51,6 +51,8 @@
ASSERT(m_impl->isSymbol());
}
+ bool isNull() const { return m_impl; }
+
bool isSymbol()
{
return m_impl && m_impl->isSymbol();
Modified: trunk/Source/WebCore/ChangeLog (188993 => 188994)
--- trunk/Source/WebCore/ChangeLog 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/WebCore/ChangeLog 2015-08-26 22:09:29 UTC (rev 188994)
@@ -1,3 +1,148 @@
+2015-08-26 Chris Dumez <cdu...@apple.com>
+
+ Distinguish Web IDL callback interfaces from Web IDL callback functions
+ https://bugs.webkit.org/show_bug.cgi?id=148434
+
+ Reviewed by Geoffrey Garen.
+
+ Distinguish Web IDL callback interfaces [1] from Web IDL callback
+ functions [2].
+
+ One Web-exposed difference is that when using a callback interface,
+ the user can pass either a function / callable object or a non-callable
+ object that has a method with the same name as the callback interface
+ operation:
+ https://heycam.github.io/webidl/#es-user-objects
+
+ When using a callback function, the user needs to pass a function /
+ callable object:
+ https://heycam.github.io/webidl/#es-callback-function
+
+ This patch adds a new [Callback=FunctionOnly] IDL extended attribute to
+ indicate that a callback interface should be function-only (i.e. a callback
+ function in the latest Web IDL specification). Without this IDL extended
+ attribute, the callback interface will be treated as a regular callback
+ interface. This will be needed for Bug 148415, as NodeFilter should be
+ an actual callback interface.
+
+ Note that longer term, we should really drop the old-style
+ [Callback=FunctionOnly] extendd attribute and use actual IDL callback
+ functions as per the latest Web IDL specification. However, I did not
+ do this in this patch to minimize patch size.
+
+ This patch adds Callback=FunctionOnly] IDL extended attribute to all
+ our pre-existing callback interfaces so that there is no behavior
+ change.
+
+ [1] https://heycam.github.io/webidl/#dfn-callback-interface
+ [2] https://heycam.github.io/webidl/#idl-callback-functions
+
+ * Modules/geolocation/PositionCallback.idl:
+ * Modules/geolocation/PositionErrorCallback.idl:
+ * Modules/mediastream/MediaStreamTrackSourcesCallback.idl:
+ * Modules/mediastream/NavigatorUserMediaErrorCallback.idl:
+ * Modules/mediastream/NavigatorUserMediaSuccessCallback.idl:
+ * Modules/mediastream/RTCPeerConnectionErrorCallback.idl:
+ * Modules/mediastream/RTCSessionDescriptionCallback.idl:
+ * Modules/mediastream/RTCStatsCallback.idl:
+ * Modules/notifications/NotificationPermissionCallback.idl:
+ * Modules/quota/StorageErrorCallback.idl:
+ * Modules/quota/StorageQuotaCallback.idl:
+ * Modules/quota/StorageUsageCallback.idl:
+ * Modules/webaudio/AudioBufferCallback.idl:
+ * Modules/webdatabase/DatabaseCallback.idl:
+ * Modules/webdatabase/SQLStatementCallback.idl:
+ * Modules/webdatabase/SQLStatementErrorCallback.idl:
+ * Modules/webdatabase/SQLTransactionCallback.idl:
+ * Modules/webdatabase/SQLTransactionErrorCallback.idl:
+ * bindings/js/JSCallbackData.cpp:
+ (WebCore::JSCallbackData::invokeCallback):
+ * bindings/js/JSCallbackData.h:
+ * bindings/js/JSCustomSQLStatementErrorCallback.cpp:
+ (WebCore::JSSQLStatementErrorCallback::handleEvent):
+ * bindings/scripts/CodeGenerator.pm:
+ (trim):
+ (IsFunctionOnlyCallbackInterface):
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateParametersCheckExpression):
+ (GenerateParametersCheck):
+ (GenerateCallbackImplementation):
+ * bindings/scripts/IDLAttributes.txt:
+ * bindings/scripts/test/GObject/WebKitDOMTestCallbackFunction.cpp: Added.
+ (WebKit::kit):
+ (WebKit::core):
+ (WebKit::wrapTestCallbackFunction):
+ (webkit_dom_test_callback_function_finalize):
+ (webkit_dom_test_callback_function_constructor):
+ (webkit_dom_test_callback_function_class_init):
+ (webkit_dom_test_callback_function_init):
+ (webkit_dom_test_callback_function_callback_with_no_param):
+ (webkit_dom_test_callback_function_callback_with_array_param):
+ (webkit_dom_test_callback_function_callback_with_serialized_script_value_param):
+ (webkit_dom_test_callback_function_callback_with_non_bool_return_type):
+ (webkit_dom_test_callback_function_callback_with_string_list):
+ (webkit_dom_test_callback_function_callback_with_boolean):
+ (webkit_dom_test_callback_function_callback_requires_this_to_pass):
+ * bindings/scripts/test/GObject/WebKitDOMTestCallbackFunction.h: Added.
+ * bindings/scripts/test/GObject/WebKitDOMTestCallbackFunctionPrivate.h: Copied from Source/WebCore/css/MediaQueryListListener.idl.
+ * bindings/scripts/test/JS/JSTestCallback.cpp:
+ (WebCore::JSTestCallback::callbackWithNoParam):
+ (WebCore::JSTestCallback::callbackWithArrayParam):
+ (WebCore::JSTestCallback::callbackWithSerializedScriptValueParam):
+ (WebCore::JSTestCallback::callbackWithStringList):
+ (WebCore::JSTestCallback::callbackWithBoolean):
+ (WebCore::JSTestCallback::callbackRequiresThisToPass):
+ * bindings/scripts/test/JS/JSTestCallbackFunction.cpp: Copied from Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp.
+ (WebCore::JSTestCallbackFunction::JSTestCallbackFunction):
+ (WebCore::JSTestCallbackFunction::~JSTestCallbackFunction):
+ (WebCore::JSTestCallbackFunction::callbackWithNoParam):
+ (WebCore::JSTestCallbackFunction::callbackWithArrayParam):
+ (WebCore::JSTestCallbackFunction::callbackWithSerializedScriptValueParam):
+ (WebCore::JSTestCallbackFunction::callbackWithStringList):
+ (WebCore::JSTestCallbackFunction::callbackWithBoolean):
+ (WebCore::JSTestCallbackFunction::callbackRequiresThisToPass):
+ * bindings/scripts/test/JS/JSTestCallbackFunction.h: Added.
+ (WebCore::JSTestCallbackFunction::create):
+ (WebCore::JSTestCallbackFunction::scriptExecutionContext):
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ (WebCore::JSTestObjConstructor::constructJSTestObj):
+ (WebCore::JSTestObjConstructor::finishCreation):
+ (WebCore::jsTestObjPrototypeFunctionMethodWithCallbackArg):
+ (WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg):
+ (WebCore::jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArg):
+ (WebCore::jsTestObjPrototypeFunctionMethodWithCallbackFunctionArg):
+ (WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackFunctionArg):
+ (WebCore::jsTestObjPrototypeFunctionMethodWithCallbackFunctionAndOptionalArg):
+ (WebCore::jsTestObjConstructorFunctionStaticMethodWithCallbackAndOptionalArg):
+ (WebCore::jsTestObjConstructorFunctionStaticMethodWithCallbackArg):
+ (WebCore::jsTestObjPrototypeFunctionOverloadedMethod5):
+ (WebCore::jsTestObjPrototypeFunctionOverloadedMethod):
+ (WebCore::jsTestObjPrototypeFunctionOverloadedMethod2): Deleted.
+ (WebCore::jsTestObjPrototypeFunctionOverloadedMethod10): Deleted.
+ * bindings/scripts/test/JS/JSTestTypedefs.cpp:
+ (WebCore::JSTestTypedefsConstructor::constructJSTestTypedefs):
+ * bindings/scripts/test/ObjC/DOMTestCallbackFunction.h: Copied from Source/WebCore/html/VoidCallback.idl.
+ * bindings/scripts/test/ObjC/DOMTestCallbackFunction.mm: Added.
+ (-[DOMTestCallbackFunction dealloc]):
+ (-[DOMTestCallbackFunction finalize]):
+ (-[DOMTestCallbackFunction callbackWithNoParam]):
+ (-[DOMTestCallbackFunction callbackWithArrayParam:]):
+ (-[DOMTestCallbackFunction callbackWithSerializedScriptValueParam:strArg:]):
+ (-[DOMTestCallbackFunction callbackWithNonBoolReturnType:]):
+ (-[DOMTestCallbackFunction customCallback:class6Param:]):
+ (-[DOMTestCallbackFunction callbackWithStringList:]):
+ (-[DOMTestCallbackFunction callbackWithBoolean:]):
+ (-[DOMTestCallbackFunction callbackRequiresThisToPass:testNodeParam:]):
+ (core):
+ (kit):
+ * bindings/scripts/test/ObjC/DOMTestCallbackFunctionInternal.h: Copied from Source/WebCore/html/VoidCallback.idl.
+ * bindings/scripts/test/TestCallbackFunction.idl: Copied from Source/WebCore/Modules/webdatabase/DatabaseCallback.idl.
+ * bindings/scripts/test/TestObj.idl:
+ * css/MediaQueryListListener.idl:
+ * dom/RequestAnimationFrameCallback.idl:
+ * dom/StringCallback.idl:
+ * html/VoidCallback.idl:
+
2015-08-26 Beth Dakin <bda...@apple.com>
REGRESSION: Safari navigates after a cancelled force click
Modified: trunk/Source/WebCore/Modules/geolocation/PositionCallback.idl (188993 => 188994)
--- trunk/Source/WebCore/Modules/geolocation/PositionCallback.idl 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/WebCore/Modules/geolocation/PositionCallback.idl 2015-08-26 22:09:29 UTC (rev 188994)
@@ -24,6 +24,7 @@
[
Conditional=GEOLOCATION,
+ Callback=FunctionOnly,
] callback interface PositionCallback {
boolean handleEvent(Geoposition position);
};
Modified: trunk/Source/WebCore/Modules/geolocation/PositionErrorCallback.idl (188993 => 188994)
--- trunk/Source/WebCore/Modules/geolocation/PositionErrorCallback.idl 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/WebCore/Modules/geolocation/PositionErrorCallback.idl 2015-08-26 22:09:29 UTC (rev 188994)
@@ -24,6 +24,7 @@
[
Conditional=GEOLOCATION,
+ Callback=FunctionOnly,
] callback interface PositionErrorCallback {
boolean handleEvent(PositionError error);
};
Modified: trunk/Source/WebCore/Modules/mediastream/MediaStreamTrackSourcesCallback.idl (188993 => 188994)
--- trunk/Source/WebCore/Modules/mediastream/MediaStreamTrackSourcesCallback.idl 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/WebCore/Modules/mediastream/MediaStreamTrackSourcesCallback.idl 2015-08-26 22:09:29 UTC (rev 188994)
@@ -25,7 +25,7 @@
[
Conditional=MEDIA_STREAM,
- NoInterfaceObject,
+ Callback=FunctionOnly,
] callback interface MediaStreamTrackSourcesCallback {
boolean handleEvent(sequence<SourceInfo> sources);
};
Modified: trunk/Source/WebCore/Modules/mediastream/NavigatorUserMediaErrorCallback.idl (188993 => 188994)
--- trunk/Source/WebCore/Modules/mediastream/NavigatorUserMediaErrorCallback.idl 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/WebCore/Modules/mediastream/NavigatorUserMediaErrorCallback.idl 2015-08-26 22:09:29 UTC (rev 188994)
@@ -24,6 +24,7 @@
[
Conditional=MEDIA_STREAM,
+ Callback=FunctionOnly,
] callback interface NavigatorUserMediaErrorCallback {
boolean handleEvent(NavigatorUserMediaError error);
};
Modified: trunk/Source/WebCore/Modules/mediastream/NavigatorUserMediaSuccessCallback.idl (188993 => 188994)
--- trunk/Source/WebCore/Modules/mediastream/NavigatorUserMediaSuccessCallback.idl 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/WebCore/Modules/mediastream/NavigatorUserMediaSuccessCallback.idl 2015-08-26 22:09:29 UTC (rev 188994)
@@ -24,6 +24,7 @@
[
Conditional=MEDIA_STREAM,
+ Callback=FunctionOnly,
] callback interface NavigatorUserMediaSuccessCallback {
boolean handleEvent(MediaStream stream);
};
Modified: trunk/Source/WebCore/Modules/mediastream/RTCPeerConnectionErrorCallback.idl (188993 => 188994)
--- trunk/Source/WebCore/Modules/mediastream/RTCPeerConnectionErrorCallback.idl 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/WebCore/Modules/mediastream/RTCPeerConnectionErrorCallback.idl 2015-08-26 22:09:29 UTC (rev 188994)
@@ -25,6 +25,7 @@
[
Conditional=MEDIA_STREAM,
+ Callback=FunctionOnly,
] callback interface RTCPeerConnectionErrorCallback {
boolean handleEvent(DOMError error);
};
Modified: trunk/Source/WebCore/Modules/mediastream/RTCSessionDescriptionCallback.idl (188993 => 188994)
--- trunk/Source/WebCore/Modules/mediastream/RTCSessionDescriptionCallback.idl 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/WebCore/Modules/mediastream/RTCSessionDescriptionCallback.idl 2015-08-26 22:09:29 UTC (rev 188994)
@@ -30,6 +30,7 @@
[
Conditional=MEDIA_STREAM,
+ Callback=FunctionOnly,
] callback interface RTCSessionDescriptionCallback {
boolean handleEvent(RTCSessionDescription sdp);
};
Modified: trunk/Source/WebCore/Modules/mediastream/RTCStatsCallback.idl (188993 => 188994)
--- trunk/Source/WebCore/Modules/mediastream/RTCStatsCallback.idl 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/WebCore/Modules/mediastream/RTCStatsCallback.idl 2015-08-26 22:09:29 UTC (rev 188994)
@@ -24,6 +24,7 @@
[
Conditional=MEDIA_STREAM,
+ Callback=FunctionOnly,
] callback interface RTCStatsCallback {
boolean handleEvent(RTCStatsResponse response);
};
Modified: trunk/Source/WebCore/Modules/notifications/NotificationPermissionCallback.idl (188993 => 188994)
--- trunk/Source/WebCore/Modules/notifications/NotificationPermissionCallback.idl 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/WebCore/Modules/notifications/NotificationPermissionCallback.idl 2015-08-26 22:09:29 UTC (rev 188994)
@@ -25,6 +25,7 @@
[
Conditional=NOTIFICATIONS,
+ Callback=FunctionOnly,
] callback interface NotificationPermissionCallback {
boolean handleEvent(DOMString permission);
};
Modified: trunk/Source/WebCore/Modules/quota/StorageErrorCallback.idl (188993 => 188994)
--- trunk/Source/WebCore/Modules/quota/StorageErrorCallback.idl 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/WebCore/Modules/quota/StorageErrorCallback.idl 2015-08-26 22:09:29 UTC (rev 188994)
@@ -30,6 +30,7 @@
[
Conditional=QUOTA,
+ Callback=FunctionOnly,
] callback interface StorageErrorCallback {
boolean handleEvent(DOMCoreException error);
};
Modified: trunk/Source/WebCore/Modules/quota/StorageQuotaCallback.idl (188993 => 188994)
--- trunk/Source/WebCore/Modules/quota/StorageQuotaCallback.idl 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/WebCore/Modules/quota/StorageQuotaCallback.idl 2015-08-26 22:09:29 UTC (rev 188994)
@@ -30,6 +30,7 @@
[
Conditional=QUOTA,
+ Callback=FunctionOnly,
] callback interface StorageQuotaCallback {
boolean handleEvent(unsigned long long grantedQuotaInBytes);
};
Modified: trunk/Source/WebCore/Modules/quota/StorageUsageCallback.idl (188993 => 188994)
--- trunk/Source/WebCore/Modules/quota/StorageUsageCallback.idl 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/WebCore/Modules/quota/StorageUsageCallback.idl 2015-08-26 22:09:29 UTC (rev 188994)
@@ -30,6 +30,7 @@
[
Conditional=QUOTA,
+ Callback=FunctionOnly,
] callback interface StorageUsageCallback {
boolean handleEvent(unsigned long long currentUsageInBytes, unsigned long long currentQuotaInBytes);
};
Modified: trunk/Source/WebCore/Modules/webaudio/AudioBufferCallback.idl (188993 => 188994)
--- trunk/Source/WebCore/Modules/webaudio/AudioBufferCallback.idl 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/WebCore/Modules/webaudio/AudioBufferCallback.idl 2015-08-26 22:09:29 UTC (rev 188994)
@@ -25,6 +25,7 @@
[
Conditional=WEB_AUDIO,
JSGenerateToJSObject,
+ Callback=FunctionOnly,
] callback interface AudioBufferCallback {
boolean handleEvent(AudioBuffer audioBuffer);
};
Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseCallback.idl (188993 => 188994)
--- trunk/Source/WebCore/Modules/webdatabase/DatabaseCallback.idl 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseCallback.idl 2015-08-26 22:09:29 UTC (rev 188994)
@@ -26,6 +26,8 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-callback interface DatabaseCallback {
+[
+ Callback=FunctionOnly,
+] callback interface DatabaseCallback {
boolean handleEvent(Database database);
};
Modified: trunk/Source/WebCore/Modules/webdatabase/SQLStatementCallback.idl (188993 => 188994)
--- trunk/Source/WebCore/Modules/webdatabase/SQLStatementCallback.idl 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLStatementCallback.idl 2015-08-26 22:09:29 UTC (rev 188994)
@@ -25,7 +25,8 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
-callback interface SQLStatementCallback {
+[
+ Callback=FunctionOnly,
+] callback interface SQLStatementCallback {
boolean handleEvent(SQLTransaction transaction, SQLResultSet resultSet);
};
Modified: trunk/Source/WebCore/Modules/webdatabase/SQLStatementErrorCallback.idl (188993 => 188994)
--- trunk/Source/WebCore/Modules/webdatabase/SQLStatementErrorCallback.idl 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLStatementErrorCallback.idl 2015-08-26 22:09:29 UTC (rev 188994)
@@ -25,7 +25,8 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
-callback interface SQLStatementErrorCallback {
+[
+ Callback=FunctionOnly,
+] callback interface SQLStatementErrorCallback {
[Custom] boolean handleEvent(SQLTransaction transaction, SQLError error);
};
Modified: trunk/Source/WebCore/Modules/webdatabase/SQLTransactionCallback.idl (188993 => 188994)
--- trunk/Source/WebCore/Modules/webdatabase/SQLTransactionCallback.idl 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLTransactionCallback.idl 2015-08-26 22:09:29 UTC (rev 188994)
@@ -25,7 +25,8 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
-callback interface SQLTransactionCallback {
+[
+ Callback=FunctionOnly,
+] callback interface SQLTransactionCallback {
boolean handleEvent(SQLTransaction transaction);
};
Modified: trunk/Source/WebCore/Modules/webdatabase/SQLTransactionErrorCallback.idl (188993 => 188994)
--- trunk/Source/WebCore/Modules/webdatabase/SQLTransactionErrorCallback.idl 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/WebCore/Modules/webdatabase/SQLTransactionErrorCallback.idl 2015-08-26 22:09:29 UTC (rev 188994)
@@ -26,6 +26,8 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-callback interface SQLTransactionErrorCallback {
+[
+ Callback=FunctionOnly,
+] callback interface SQLTransactionErrorCallback {
boolean handleEvent(SQLError error);
};
Modified: trunk/Source/WebCore/bindings/js/JSCallbackData.cpp (188993 => 188994)
--- trunk/Source/WebCore/bindings/js/JSCallbackData.cpp 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/WebCore/bindings/js/JSCallbackData.cpp 2015-08-26 22:09:29 UTC (rev 188994)
@@ -43,29 +43,40 @@
delete static_cast<JSCallbackData*>(context);
}
-JSValue JSCallbackData::invokeCallback(MarkedArgumentBuffer& args, PropertyName functionName, bool* raisedException)
+JSValue JSCallbackData::invokeCallback(MarkedArgumentBuffer& args, CallbackType method, PropertyName functionName, bool* raisedException)
{
ASSERT(callback());
- return invokeCallback(callback(), args, functionName, raisedException);
+ return invokeCallback(callback(), args, method, functionName, raisedException);
}
-JSValue JSCallbackData::invokeCallback(JSValue thisValue, MarkedArgumentBuffer& args, PropertyName functionName, bool* raisedException)
+JSValue JSCallbackData::invokeCallback(JSValue thisValue, MarkedArgumentBuffer& args, CallbackType method, PropertyName functionName, bool* raisedException)
{
ASSERT(callback());
ASSERT(globalObject());
ExecState* exec = globalObject()->globalExec();
- JSValue function = callback();
+ JSValue function;
+ CallData callData;
+ CallType callType = CallTypeNone;
- CallData callData;
- CallType callType = callback()->methodTable()->getCallData(callback(), callData);
+ if (method != CallbackType::Object) {
+ function = callback();
+ callType = callback()->methodTable()->getCallData(callback(), callData);
+ }
if (callType == CallTypeNone) {
+ if (method == CallbackType::Function)
+ return JSValue();
+
+ ASSERT(!functionName.isNull());
function = callback()->get(exec, functionName);
callType = getCallData(function, callData);
if (callType == CallTypeNone)
return JSValue();
}
+ ASSERT(!function.isEmpty());
+ ASSERT(callType != CallTypeNone);
+
ScriptExecutionContext* context = globalObject()->scriptExecutionContext();
// We will fail to get the context if the frame has been detached.
if (!context)
Modified: trunk/Source/WebCore/bindings/js/JSCallbackData.h (188993 => 188994)
--- trunk/Source/WebCore/bindings/js/JSCallbackData.h 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/WebCore/bindings/js/JSCallbackData.h 2015-08-26 22:09:29 UTC (rev 188994)
@@ -66,8 +66,9 @@
JSC::JSObject* callback() { return m_callback.get(); }
JSDOMGlobalObject* globalObject() { return m_globalObject.get(); }
- JSC::JSValue invokeCallback(JSC::MarkedArgumentBuffer&, JSC::PropertyName functionName, bool* raisedException = nullptr);
- JSC::JSValue invokeCallback(JSC::JSValue thisValue, JSC::MarkedArgumentBuffer&, JSC::PropertyName functionName, bool* raisedException = nullptr);
+ enum class CallbackType { Function, Object, FunctionOrObject };
+ JSC::JSValue invokeCallback(JSC::MarkedArgumentBuffer&, CallbackType, JSC::PropertyName functionName, bool* raisedException = nullptr);
+ JSC::JSValue invokeCallback(JSC::JSValue thisValue, JSC::MarkedArgumentBuffer&, CallbackType, JSC::PropertyName functionName, bool* raisedException = nullptr);
private:
JSC::Strong<JSC::JSObject> m_callback;
Modified: trunk/Source/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp (188993 => 188994)
--- trunk/Source/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp 2015-08-26 22:09:29 UTC (rev 188994)
@@ -54,7 +54,7 @@
args.append(toJS(exec, m_data->globalObject(), error));
bool raisedException = false;
- JSValue result = m_data->invokeCallback(args, Identifier::fromString(exec, "handleEvent"), &raisedException);
+ JSValue result = m_data->invokeCallback(args, JSCallbackData::CallbackType::Function, Identifier(), &raisedException);
if (raisedException) {
// The spec says:
// "If the error callback returns false, then move on to the next statement..."
Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (188993 => 188994)
--- trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm 2015-08-26 22:09:29 UTC (rev 188994)
@@ -496,6 +496,13 @@
return $ret;
}
+sub trim
+{
+ my $string = shift;
+ $string =~ s/^\s+|\s+$//g;
+ return $string;
+}
+
# Return the C++ namespace that a given attribute name string is defined in.
sub NamespaceForAttributeName
{
@@ -653,6 +660,40 @@
return ($fileContents =~ /callback\s+interface\s+(\w+)/gs);
}
+# Callback interface with [Callback=FunctionOnly].
+# FIXME: This should be a callback function:
+# https://heycam.github.io/webidl/#idl-callback-functions
+sub IsFunctionOnlyCallbackInterface
+{
+ my $object = shift;
+ my $type = shift;
+
+ return 0 unless $object->IsCallbackInterface($type);
+
+ my $idlFile = $object->IDLFileForInterface($type)
+ or die("Could NOT find IDL file for interface \"$type\"!\n");
+
+ open FILE, "<", $idlFile;
+ my @lines = <FILE>;
+ close FILE;
+
+ my $fileContents = join('', @lines);
+ if ($fileContents =~ /\[(.*)\]\s+callback\s+interface\s+(\w+)/gs) {
+ my @parts = split(',', $1);
+ foreach my $part (@parts) {
+ my @keyValue = split('=', $part);
+ my $key = trim($keyValue[0]);
+ next unless length($key);
+ my $value = "VALUE_IS_MISSING";
+ $value = trim($keyValue[1]) if @keyValue > 1;
+
+ return 1 if ($key eq "Callback" && $value eq "FunctionOnly");
+ }
+ }
+
+ return 0;
+}
+
sub GenerateConditionalString
{
my $generator = shift;
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (188993 => 188994)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2015-08-26 22:09:29 UTC (rev 188994)
@@ -1379,7 +1379,11 @@
}
} elsif ($codeGenerator->IsCallbackInterface($parameter->type)) {
# For Callbacks only checks if the value is null or object.
- push(@andExpression, "(${value}.isNull() || ${value}.isFunction())");
+ if ($codeGenerator->IsFunctionOnlyCallbackInterface($parameter->type)) {
+ push(@andExpression, "(${value}.isNull() || ${value}.isFunction())");
+ } else {
+ push(@andExpression, "(${value}.isNull() || ${value}.isObject())");
+ }
$usedArguments{$parameterIndex} = 1;
} elsif (!IsNativeType($type)) {
my $condition = "";
@@ -3271,7 +3275,11 @@
if ($optional) {
push(@$outputArray, " RefPtr<$argType> $name;\n");
push(@$outputArray, " if (!exec->argument($argsIndex).isUndefinedOrNull()) {\n");
- push(@$outputArray, " if (!exec->uncheckedArgument($argsIndex).isFunction())\n");
+ if ($codeGenerator->IsFunctionOnlyCallbackInterface($parameter->type)) {
+ push(@$outputArray, " if (!exec->uncheckedArgument($argsIndex).isFunction())\n");
+ } else {
+ push(@$outputArray, " if (!exec->uncheckedArgument($argsIndex).isObject())\n");
+ }
push(@$outputArray, " return throwArgumentMustBeFunctionError(*exec, $argsIndex, \"$name\", \"$interfaceName\", $quotedFunctionName);\n");
if ($function->isStatic) {
AddToImplIncludes("CallbackFunction.h");
@@ -3281,7 +3289,11 @@
}
push(@$outputArray, " }\n");
} else {
- push(@$outputArray, " if (!exec->argument($argsIndex).isFunction())\n");
+ if ($codeGenerator->IsFunctionOnlyCallbackInterface($parameter->type)) {
+ push(@$outputArray, " if (!exec->argument($argsIndex).isFunction())\n");
+ } else {
+ push(@$outputArray, " if (!exec->argument($argsIndex).isObject())\n");
+ }
push(@$outputArray, " return throwArgumentMustBeFunctionError(*exec, $argsIndex, \"$name\", \"$interfaceName\", $quotedFunctionName);\n");
if ($function->isStatic) {
AddToImplIncludes("CallbackFunction.h");
@@ -3598,7 +3610,22 @@
}
push(@implContent, "\n bool raisedException = false;\n");
- push(@implContent, " m_data->invokeCallback(args, Identifier::fromString(exec, \"${functionName}\"), &raisedException);\n");
+
+ my $propertyToLookup = "Identifier::fromString(exec, \"${functionName}\")";
+ my $invokeMethod = "JSCallbackData::CallbackType::FunctionOrObject";
+ if ($codeGenerator->ExtendedAttributeContains($interface->extendedAttributes->{"Callback"}, "FunctionOnly")) {
+ # For callback functions, do not look up callable property on the user object.
+ # https://heycam.github.io/webidl/#es-callback-function
+ $invokeMethod = "JSCallbackData::CallbackType::Function";
+ $propertyToLookup = "Identifier()";
+ push(@implContent, " UNUSED_PARAM(exec);\n");
+ } elsif ($numFunctions > 1) {
+ # The callback interface has more than one operation so we should not call the user object as a function.
+ # instead, we should look for a property with the same name as the operation on the user object.
+ # https://heycam.github.io/webidl/#es-user-objects
+ $invokeMethod = "JSCallbackData::CallbackType::Object";
+ }
+ push(@implContent, " m_data->invokeCallback(args, $invokeMethod, $propertyToLookup, &raisedException);\n");
push(@implContent, " return !raisedException;\n");
push(@implContent, "}\n");
}
Modified: trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt (188993 => 188994)
--- trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt 2015-08-26 22:09:29 UTC (rev 188994)
@@ -23,6 +23,7 @@
CPPPureInterface
CachedAttribute
CallbackNeedsOperatorEqual
+Callback=FunctionOnly
CallWith=ScriptExecutionContext|ScriptState|ScriptArguments|CallStack
CheckSecurity
CheckSecurityForNode
Added: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallbackFunction.cpp (0 => 188994)
--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallbackFunction.cpp (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallbackFunction.cpp 2015-08-26 22:09:29 UTC (rev 188994)
@@ -0,0 +1,238 @@
+/*
+ * This file is part of the WebKit open source project.
+ * This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebKitDOMTestCallbackFunction.h"
+
+#include "CSSImportRule.h"
+#include "DOMObjectCache.h"
+#include "Document.h"
+#include "ExceptionCode.h"
+#include "ExceptionCodeDescription.h"
+#include "JSMainThreadExecState.h"
+#include "SerializedScriptValue.h"
+#include "WebKitDOMDOMStringListPrivate.h"
+#include "WebKitDOMFloat32ArrayPrivate.h"
+#include "WebKitDOMPrivate.h"
+#include "WebKitDOMTestCallbackFunctionPrivate.h"
+#include "WebKitDOMTestNodePrivate.h"
+#include "gobject/ConvertToUTF8String.h"
+#include <wtf/GetPtr.h>
+#include <wtf/RefPtr.h>
+
+#define WEBKIT_DOM_TEST_CALLBACK_FUNCTION_GET_PRIVATE(obj) G_TYPE_INSTANCE_GET_PRIVATE(obj, WEBKIT_DOM_TYPE_TEST_CALLBACK_FUNCTION, WebKitDOMTestCallbackFunctionPrivate)
+
+typedef struct _WebKitDOMTestCallbackFunctionPrivate {
+#if ENABLE(SPEECH_SYNTHESIS)
+ RefPtr<WebCore::TestCallbackFunction> coreObject;
+#endif // ENABLE(SPEECH_SYNTHESIS)
+} WebKitDOMTestCallbackFunctionPrivate;
+
+#if ENABLE(SPEECH_SYNTHESIS)
+
+namespace WebKit {
+
+WebKitDOMTestCallbackFunction* kit(WebCore::TestCallbackFunction* obj)
+{
+ if (!obj)
+ return 0;
+
+ if (gpointer ret = DOMObjectCache::get(obj))
+ return WEBKIT_DOM_TEST_CALLBACK_FUNCTION(ret);
+
+ return wrapTestCallbackFunction(obj);
+}
+
+WebCore::TestCallbackFunction* core(WebKitDOMTestCallbackFunction* request)
+{
+ return request ? static_cast<WebCore::TestCallbackFunction*>(WEBKIT_DOM_OBJECT(request)->coreObject) : 0;
+}
+
+WebKitDOMTestCallbackFunction* wrapTestCallbackFunction(WebCore::TestCallbackFunction* coreObject)
+{
+ ASSERT(coreObject);
+ return WEBKIT_DOM_TEST_CALLBACK_FUNCTION(g_object_new(WEBKIT_DOM_TYPE_TEST_CALLBACK_FUNCTION, "core-object", coreObject, nullptr));
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(SPEECH_SYNTHESIS)
+
+G_DEFINE_TYPE(WebKitDOMTestCallbackFunction, webkit_dom_test_callback_function, WEBKIT_DOM_TYPE_OBJECT)
+
+static void webkit_dom_test_callback_function_finalize(GObject* object)
+{
+ WebKitDOMTestCallbackFunctionPrivate* priv = WEBKIT_DOM_TEST_CALLBACK_FUNCTION_GET_PRIVATE(object);
+#if ENABLE(SPEECH_SYNTHESIS)
+ WebKit::DOMObjectCache::forget(priv->coreObject.get());
+#endif // ENABLE(SPEECH_SYNTHESIS)
+ priv->~WebKitDOMTestCallbackFunctionPrivate();
+ G_OBJECT_CLASS(webkit_dom_test_callback_function_parent_class)->finalize(object);
+}
+
+static GObject* webkit_dom_test_callback_function_constructor(GType type, guint constructPropertiesCount, GObjectConstructParam* constructProperties)
+{
+ GObject* object = G_OBJECT_CLASS(webkit_dom_test_callback_function_parent_class)->constructor(type, constructPropertiesCount, constructProperties);
+#if ENABLE(SPEECH_SYNTHESIS)
+ WebKitDOMTestCallbackFunctionPrivate* priv = WEBKIT_DOM_TEST_CALLBACK_FUNCTION_GET_PRIVATE(object);
+ priv->coreObject = static_cast<WebCore::TestCallbackFunction*>(WEBKIT_DOM_OBJECT(object)->coreObject);
+ WebKit::DOMObjectCache::put(priv->coreObject.get(), object);
+#endif // ENABLE(SPEECH_SYNTHESIS)
+ return object;
+}
+
+static void webkit_dom_test_callback_function_class_init(WebKitDOMTestCallbackFunctionClass* requestClass)
+{
+ GObjectClass* gobjectClass = G_OBJECT_CLASS(requestClass);
+ g_type_class_add_private(gobjectClass, sizeof(WebKitDOMTestCallbackFunctionPrivate));
+ gobjectClass->constructor = webkit_dom_test_callback_function_constructor;
+ gobjectClass->finalize = webkit_dom_test_callback_function_finalize;
+}
+
+static void webkit_dom_test_callback_function_init(WebKitDOMTestCallbackFunction* request)
+{
+ WebKitDOMTestCallbackFunctionPrivate* priv = WEBKIT_DOM_TEST_CALLBACK_FUNCTION_GET_PRIVATE(request);
+ new (priv) WebKitDOMTestCallbackFunctionPrivate();
+}
+
+gboolean webkit_dom_test_callback_function_callback_with_no_param(WebKitDOMTestCallbackFunction* self)
+{
+#if ENABLE(SPEECH_SYNTHESIS)
+ WebCore::JSMainThreadNullState state;
+ g_return_val_if_fail(WEBKIT_DOM_IS_TEST_CALLBACK_FUNCTION(self), FALSE);
+ WebCore::TestCallbackFunction* item = WebKit::core(self);
+ gboolean result = item->callbackWithNoParam();
+ return result;
+#else
+ UNUSED_PARAM(self);
+ WEBKIT_WARN_FEATURE_NOT_PRESENT("Speech Synthesis")
+ return static_cast<gboolean>(0);
+#endif /* ENABLE(SPEECH_SYNTHESIS) */
+}
+
+gboolean webkit_dom_test_callback_function_callback_with_array_param(WebKitDOMTestCallbackFunction* self, WebKitDOMFloat32Array* arrayParam)
+{
+#if ENABLE(SPEECH_SYNTHESIS)
+ WebCore::JSMainThreadNullState state;
+ g_return_val_if_fail(WEBKIT_DOM_IS_TEST_CALLBACK_FUNCTION(self), FALSE);
+ g_return_val_if_fail(WEBKIT_DOM_IS_FLOAT32ARRAY(arrayParam), FALSE);
+ WebCore::TestCallbackFunction* item = WebKit::core(self);
+ WebCore::Float32Array* convertedArrayParam = WebKit::core(arrayParam);
+ gboolean result = item->callbackWithArrayParam(convertedArrayParam);
+ return result;
+#else
+ UNUSED_PARAM(self);
+ UNUSED_PARAM(arrayParam);
+ WEBKIT_WARN_FEATURE_NOT_PRESENT("Speech Synthesis")
+ return static_cast<gboolean>(0);
+#endif /* ENABLE(SPEECH_SYNTHESIS) */
+}
+
+gboolean webkit_dom_test_callback_function_callback_with_serialized_script_value_param(WebKitDOMTestCallbackFunction* self, const gchar* srzParam, const gchar* strArg)
+{
+#if ENABLE(SPEECH_SYNTHESIS)
+ WebCore::JSMainThreadNullState state;
+ g_return_val_if_fail(WEBKIT_DOM_IS_TEST_CALLBACK_FUNCTION(self), FALSE);
+ g_return_val_if_fail(srzParam, FALSE);
+ g_return_val_if_fail(strArg, FALSE);
+ WebCore::TestCallbackFunction* item = WebKit::core(self);
+ WTF::String convertedStrArg = WTF::String::fromUTF8(strArg);
+ gboolean result = item->callbackWithSerializedScriptValueParam(WebCore::SerializedScriptValue::create(WTF::String::fromUTF8(srzParam)), convertedStrArg);
+ return result;
+#else
+ UNUSED_PARAM(self);
+ UNUSED_PARAM(srzParam);
+ UNUSED_PARAM(strArg);
+ WEBKIT_WARN_FEATURE_NOT_PRESENT("Speech Synthesis")
+ return static_cast<gboolean>(0);
+#endif /* ENABLE(SPEECH_SYNTHESIS) */
+}
+
+glong webkit_dom_test_callback_function_callback_with_non_bool_return_type(WebKitDOMTestCallbackFunction* self, const gchar* strArg)
+{
+#if ENABLE(SPEECH_SYNTHESIS)
+ WebCore::JSMainThreadNullState state;
+ g_return_val_if_fail(WEBKIT_DOM_IS_TEST_CALLBACK_FUNCTION(self), 0);
+ g_return_val_if_fail(strArg, 0);
+ WebCore::TestCallbackFunction* item = WebKit::core(self);
+ WTF::String convertedStrArg = WTF::String::fromUTF8(strArg);
+ glong result = item->callbackWithNonBoolReturnType(convertedStrArg);
+ return result;
+#else
+ UNUSED_PARAM(self);
+ UNUSED_PARAM(strArg);
+ WEBKIT_WARN_FEATURE_NOT_PRESENT("Speech Synthesis")
+ return static_cast<glong>(0);
+#endif /* ENABLE(SPEECH_SYNTHESIS) */
+}
+
+gboolean webkit_dom_test_callback_function_callback_with_string_list(WebKitDOMTestCallbackFunction* self, WebKitDOMDOMStringList* listParam)
+{
+#if ENABLE(SPEECH_SYNTHESIS)
+ WebCore::JSMainThreadNullState state;
+ g_return_val_if_fail(WEBKIT_DOM_IS_TEST_CALLBACK_FUNCTION(self), FALSE);
+ g_return_val_if_fail(WEBKIT_DOM_IS_DOM_STRING_LIST(listParam), FALSE);
+ WebCore::TestCallbackFunction* item = WebKit::core(self);
+ WebCore::DOMStringList* convertedListParam = WebKit::core(listParam);
+ gboolean result = item->callbackWithStringList(convertedListParam);
+ return result;
+#else
+ UNUSED_PARAM(self);
+ UNUSED_PARAM(listParam);
+ WEBKIT_WARN_FEATURE_NOT_PRESENT("Speech Synthesis")
+ return static_cast<gboolean>(0);
+#endif /* ENABLE(SPEECH_SYNTHESIS) */
+}
+
+gboolean webkit_dom_test_callback_function_callback_with_boolean(WebKitDOMTestCallbackFunction* self, gboolean boolParam)
+{
+#if ENABLE(SPEECH_SYNTHESIS)
+ WebCore::JSMainThreadNullState state;
+ g_return_val_if_fail(WEBKIT_DOM_IS_TEST_CALLBACK_FUNCTION(self), FALSE);
+ WebCore::TestCallbackFunction* item = WebKit::core(self);
+ gboolean result = item->callbackWithBoolean(boolParam);
+ return result;
+#else
+ UNUSED_PARAM(self);
+ UNUSED_PARAM(boolParam);
+ WEBKIT_WARN_FEATURE_NOT_PRESENT("Speech Synthesis")
+ return static_cast<gboolean>(0);
+#endif /* ENABLE(SPEECH_SYNTHESIS) */
+}
+
+gboolean webkit_dom_test_callback_function_callback_requires_this_to_pass(WebKitDOMTestCallbackFunction* self, glong longParam, WebKitDOMTestNode* testNodeParam)
+{
+#if ENABLE(SPEECH_SYNTHESIS)
+ WebCore::JSMainThreadNullState state;
+ g_return_val_if_fail(WEBKIT_DOM_IS_TEST_CALLBACK_FUNCTION(self), FALSE);
+ g_return_val_if_fail(WEBKIT_DOM_IS_TEST_NODE(testNodeParam), FALSE);
+ WebCore::TestCallbackFunction* item = WebKit::core(self);
+ WebCore::TestNode* convertedTestNodeParam = WebKit::core(testNodeParam);
+ gboolean result = item->callbackRequiresThisToPass(longParam, convertedTestNodeParam);
+ return result;
+#else
+ UNUSED_PARAM(self);
+ UNUSED_PARAM(longParam);
+ UNUSED_PARAM(testNodeParam);
+ WEBKIT_WARN_FEATURE_NOT_PRESENT("Speech Synthesis")
+ return static_cast<gboolean>(0);
+#endif /* ENABLE(SPEECH_SYNTHESIS) */
+}
+
Added: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallbackFunction.h (0 => 188994)
--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallbackFunction.h (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallbackFunction.h 2015-08-26 22:09:29 UTC (rev 188994)
@@ -0,0 +1,138 @@
+/*
+ * This file is part of the WebKit open source project.
+ * This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WebKitDOMTestCallbackFunction_h
+#define WebKitDOMTestCallbackFunction_h
+
+#ifdef WEBKIT_DOM_USE_UNSTABLE_API
+
+#include <glib-object.h>
+#include <webkitdom/WebKitDOMObject.h>
+#include <webkitdom/webkitdomdefines-unstable.h>
+
+G_BEGIN_DECLS
+
+#define WEBKIT_DOM_TYPE_TEST_CALLBACK_FUNCTION (webkit_dom_test_callback_function_get_type())
+#define WEBKIT_DOM_TEST_CALLBACK_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_DOM_TYPE_TEST_CALLBACK_FUNCTION, WebKitDOMTestCallbackFunction))
+#define WEBKIT_DOM_TEST_CALLBACK_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_DOM_TYPE_TEST_CALLBACK_FUNCTION, WebKitDOMTestCallbackFunctionClass)
+#define WEBKIT_DOM_IS_TEST_CALLBACK_FUNCTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_DOM_TYPE_TEST_CALLBACK_FUNCTION))
+#define WEBKIT_DOM_IS_TEST_CALLBACK_FUNCTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_DOM_TYPE_TEST_CALLBACK_FUNCTION))
+#define WEBKIT_DOM_TEST_CALLBACK_FUNCTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_DOM_TYPE_TEST_CALLBACK_FUNCTION, WebKitDOMTestCallbackFunctionClass))
+
+struct _WebKitDOMTestCallbackFunction {
+ WebKitDOMObject parent_instance;
+};
+
+struct _WebKitDOMTestCallbackFunctionClass {
+ WebKitDOMObjectClass parent_class;
+};
+
+WEBKIT_API GType
+webkit_dom_test_callback_function_get_type(void);
+
+/**
+ * webkit_dom_test_callback_function_callback_with_no_param:
+ * @self: A #WebKitDOMTestCallbackFunction
+ *
+ * Returns: A #gboolean
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API gboolean
+webkit_dom_test_callback_function_callback_with_no_param(WebKitDOMTestCallbackFunction* self);
+
+/**
+ * webkit_dom_test_callback_function_callback_with_array_param:
+ * @self: A #WebKitDOMTestCallbackFunction
+ * @arrayParam: A #WebKitDOMFloat32Array
+ *
+ * Returns: A #gboolean
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API gboolean
+webkit_dom_test_callback_function_callback_with_array_param(WebKitDOMTestCallbackFunction* self, WebKitDOMFloat32Array* arrayParam);
+
+/**
+ * webkit_dom_test_callback_function_callback_with_serialized_script_value_param:
+ * @self: A #WebKitDOMTestCallbackFunction
+ * @srzParam: A #gchar
+ * @strArg: A #gchar
+ *
+ * Returns: A #gboolean
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API gboolean
+webkit_dom_test_callback_function_callback_with_serialized_script_value_param(WebKitDOMTestCallbackFunction* self, const gchar* srzParam, const gchar* strArg);
+
+/**
+ * webkit_dom_test_callback_function_callback_with_non_bool_return_type:
+ * @self: A #WebKitDOMTestCallbackFunction
+ * @strArg: A #gchar
+ *
+ * Returns: A #glong
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API glong
+webkit_dom_test_callback_function_callback_with_non_bool_return_type(WebKitDOMTestCallbackFunction* self, const gchar* strArg);
+
+/**
+ * webkit_dom_test_callback_function_callback_with_string_list:
+ * @self: A #WebKitDOMTestCallbackFunction
+ * @listParam: A #WebKitDOMDOMStringList
+ *
+ * Returns: A #gboolean
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API gboolean
+webkit_dom_test_callback_function_callback_with_string_list(WebKitDOMTestCallbackFunction* self, WebKitDOMDOMStringList* listParam);
+
+/**
+ * webkit_dom_test_callback_function_callback_with_boolean:
+ * @self: A #WebKitDOMTestCallbackFunction
+ * @boolParam: A #gboolean
+ *
+ * Returns: A #gboolean
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API gboolean
+webkit_dom_test_callback_function_callback_with_boolean(WebKitDOMTestCallbackFunction* self, gboolean boolParam);
+
+/**
+ * webkit_dom_test_callback_function_callback_requires_this_to_pass:
+ * @self: A #WebKitDOMTestCallbackFunction
+ * @longParam: A #glong
+ * @testNodeParam: A #WebKitDOMTestNode
+ *
+ * Returns: A #gboolean
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API gboolean
+webkit_dom_test_callback_function_callback_requires_this_to_pass(WebKitDOMTestCallbackFunction* self, glong longParam, WebKitDOMTestNode* testNodeParam);
+
+G_END_DECLS
+
+#endif /* WEBKIT_DOM_USE_UNSTABLE_API */
+#endif /* WebKitDOMTestCallbackFunction_h */
Copied: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallbackFunctionPrivate.h (from rev 188993, trunk/Source/WebCore/css/MediaQueryListListener.idl) (0 => 188994)
--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallbackFunctionPrivate.h (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallbackFunctionPrivate.h 2015-08-26 22:09:29 UTC (rev 188994)
@@ -0,0 +1,36 @@
+/*
+ * This file is part of the WebKit open source project.
+ * This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WebKitDOMTestCallbackFunctionPrivate_h
+#define WebKitDOMTestCallbackFunctionPrivate_h
+
+#include "TestCallbackFunction.h"
+#include <webkitdom/WebKitDOMTestCallbackFunction.h>
+#if ENABLE(SPEECH_SYNTHESIS)
+
+namespace WebKit {
+WebKitDOMTestCallbackFunction* wrapTestCallbackFunction(WebCore::TestCallbackFunction*);
+WebKitDOMTestCallbackFunction* kit(WebCore::TestCallbackFunction*);
+WebCore::TestCallbackFunction* core(WebKitDOMTestCallbackFunction*);
+} // namespace WebKit
+
+#endif /* ENABLE(SPEECH_SYNTHESIS) */
+
+#endif /* WebKitDOMTestCallbackFunctionPrivate_h */
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp (188993 => 188994)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp 2015-08-26 22:09:29 UTC (rev 188994)
@@ -75,7 +75,7 @@
MarkedArgumentBuffer args;
bool raisedException = false;
- m_data->invokeCallback(args, Identifier::fromString(exec, "callbackWithNoParam"), &raisedException);
+ m_data->invokeCallback(args, JSCallbackData::CallbackType::Object, Identifier::fromString(exec, "callbackWithNoParam"), &raisedException);
return !raisedException;
}
@@ -93,7 +93,7 @@
args.append(toJS(exec, m_data->globalObject(), WTF::getPtr(arrayParam)));
bool raisedException = false;
- m_data->invokeCallback(args, Identifier::fromString(exec, "callbackWithArrayParam"), &raisedException);
+ m_data->invokeCallback(args, JSCallbackData::CallbackType::Object, Identifier::fromString(exec, "callbackWithArrayParam"), &raisedException);
return !raisedException;
}
@@ -112,7 +112,7 @@
args.append(jsStringWithCache(exec, strArg));
bool raisedException = false;
- m_data->invokeCallback(args, Identifier::fromString(exec, "callbackWithSerializedScriptValueParam"), &raisedException);
+ m_data->invokeCallback(args, JSCallbackData::CallbackType::Object, Identifier::fromString(exec, "callbackWithSerializedScriptValueParam"), &raisedException);
return !raisedException;
}
@@ -130,7 +130,7 @@
args.append(toJS(exec, m_data->globalObject(), WTF::getPtr(listParam)));
bool raisedException = false;
- m_data->invokeCallback(args, Identifier::fromString(exec, "callbackWithStringList"), &raisedException);
+ m_data->invokeCallback(args, JSCallbackData::CallbackType::Object, Identifier::fromString(exec, "callbackWithStringList"), &raisedException);
return !raisedException;
}
@@ -148,7 +148,7 @@
args.append(jsBoolean(boolParam));
bool raisedException = false;
- m_data->invokeCallback(args, Identifier::fromString(exec, "callbackWithBoolean"), &raisedException);
+ m_data->invokeCallback(args, JSCallbackData::CallbackType::Object, Identifier::fromString(exec, "callbackWithBoolean"), &raisedException);
return !raisedException;
}
@@ -167,7 +167,7 @@
args.append(toJS(exec, m_data->globalObject(), WTF::getPtr(testNodeParam)));
bool raisedException = false;
- m_data->invokeCallback(args, Identifier::fromString(exec, "callbackRequiresThisToPass"), &raisedException);
+ m_data->invokeCallback(args, JSCallbackData::CallbackType::Object, Identifier::fromString(exec, "callbackRequiresThisToPass"), &raisedException);
return !raisedException;
}
Copied: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.cpp (from rev 188993, trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp) (0 => 188994)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.cpp (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.cpp 2015-08-26 22:09:29 UTC (rev 188994)
@@ -0,0 +1,182 @@
+/*
+ This file is part of the WebKit open source project.
+ This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+
+#if ENABLE(SPEECH_SYNTHESIS)
+
+#include "JSTestCallbackFunction.h"
+
+#include "DOMStringList.h"
+#include "JSDOMStringList.h"
+#include "JSTestNode.h"
+#include "ScriptExecutionContext.h"
+#include "SerializedScriptValue.h"
+#include "TestNode.h"
+#include "URL.h"
+#include <runtime/JSLock.h>
+#include <runtime/JSString.h>
+
+using namespace JSC;
+
+namespace WebCore {
+
+JSTestCallbackFunction::JSTestCallbackFunction(JSObject* callback, JSDOMGlobalObject* globalObject)
+ : TestCallbackFunction()
+ , ActiveDOMCallback(globalObject->scriptExecutionContext())
+ , m_data(new JSCallbackData(callback, globalObject))
+{
+}
+
+JSTestCallbackFunction::~JSTestCallbackFunction()
+{
+ ScriptExecutionContext* context = scriptExecutionContext();
+ // When the context is destroyed, all tasks with a reference to a callback
+ // should be deleted. So if the context is 0, we are on the context thread.
+ if (!context || context->isContextThread())
+ delete m_data;
+ else
+ context->postTask(DeleteCallbackDataTask(m_data));
+#ifndef NDEBUG
+ m_data = 0;
+#endif
+}
+
+
+// Functions
+
+bool JSTestCallbackFunction::callbackWithNoParam()
+{
+ if (!canInvokeCallback())
+ return true;
+
+ Ref<JSTestCallbackFunction> protect(*this);
+
+ JSLockHolder lock(m_data->globalObject()->vm());
+
+ ExecState* exec = m_data->globalObject()->globalExec();
+ MarkedArgumentBuffer args;
+
+ bool raisedException = false;
+ UNUSED_PARAM(exec);
+ m_data->invokeCallback(args, JSCallbackData::CallbackType::Function, Identifier(), &raisedException);
+ return !raisedException;
+}
+
+bool JSTestCallbackFunction::callbackWithArrayParam(RefPtr<Float32Array> arrayParam)
+{
+ if (!canInvokeCallback())
+ return true;
+
+ Ref<JSTestCallbackFunction> protect(*this);
+
+ JSLockHolder lock(m_data->globalObject()->vm());
+
+ ExecState* exec = m_data->globalObject()->globalExec();
+ MarkedArgumentBuffer args;
+ args.append(toJS(exec, m_data->globalObject(), WTF::getPtr(arrayParam)));
+
+ bool raisedException = false;
+ UNUSED_PARAM(exec);
+ m_data->invokeCallback(args, JSCallbackData::CallbackType::Function, Identifier(), &raisedException);
+ return !raisedException;
+}
+
+bool JSTestCallbackFunction::callbackWithSerializedScriptValueParam(PassRefPtr<SerializedScriptValue> srzParam, const String& strArg)
+{
+ if (!canInvokeCallback())
+ return true;
+
+ Ref<JSTestCallbackFunction> protect(*this);
+
+ JSLockHolder lock(m_data->globalObject()->vm());
+
+ ExecState* exec = m_data->globalObject()->globalExec();
+ MarkedArgumentBuffer args;
+ args.append(srzParam ? srzParam->deserialize(exec, castedThis->globalObject(), 0) : jsNull());
+ args.append(jsStringWithCache(exec, strArg));
+
+ bool raisedException = false;
+ UNUSED_PARAM(exec);
+ m_data->invokeCallback(args, JSCallbackData::CallbackType::Function, Identifier(), &raisedException);
+ return !raisedException;
+}
+
+bool JSTestCallbackFunction::callbackWithStringList(PassRefPtr<DOMStringList> listParam)
+{
+ if (!canInvokeCallback())
+ return true;
+
+ Ref<JSTestCallbackFunction> protect(*this);
+
+ JSLockHolder lock(m_data->globalObject()->vm());
+
+ ExecState* exec = m_data->globalObject()->globalExec();
+ MarkedArgumentBuffer args;
+ args.append(toJS(exec, m_data->globalObject(), WTF::getPtr(listParam)));
+
+ bool raisedException = false;
+ UNUSED_PARAM(exec);
+ m_data->invokeCallback(args, JSCallbackData::CallbackType::Function, Identifier(), &raisedException);
+ return !raisedException;
+}
+
+bool JSTestCallbackFunction::callbackWithBoolean(bool boolParam)
+{
+ if (!canInvokeCallback())
+ return true;
+
+ Ref<JSTestCallbackFunction> protect(*this);
+
+ JSLockHolder lock(m_data->globalObject()->vm());
+
+ ExecState* exec = m_data->globalObject()->globalExec();
+ MarkedArgumentBuffer args;
+ args.append(jsBoolean(boolParam));
+
+ bool raisedException = false;
+ UNUSED_PARAM(exec);
+ m_data->invokeCallback(args, JSCallbackData::CallbackType::Function, Identifier(), &raisedException);
+ return !raisedException;
+}
+
+bool JSTestCallbackFunction::callbackRequiresThisToPass(int longParam, TestNode* testNodeParam)
+{
+ if (!canInvokeCallback())
+ return true;
+
+ Ref<JSTestCallbackFunction> protect(*this);
+
+ JSLockHolder lock(m_data->globalObject()->vm());
+
+ ExecState* exec = m_data->globalObject()->globalExec();
+ MarkedArgumentBuffer args;
+ args.append(jsNumber(longParam));
+ args.append(toJS(exec, m_data->globalObject(), WTF::getPtr(testNodeParam)));
+
+ bool raisedException = false;
+ UNUSED_PARAM(exec);
+ m_data->invokeCallback(args, JSCallbackData::CallbackType::Function, Identifier(), &raisedException);
+ return !raisedException;
+}
+
+}
+
+#endif // ENABLE(SPEECH_SYNTHESIS)
Added: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.h (0 => 188994)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.h (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallbackFunction.h 2015-08-26 22:09:29 UTC (rev 188994)
@@ -0,0 +1,64 @@
+/*
+ This file is part of the WebKit open source project.
+ This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef JSTestCallbackFunction_h
+#define JSTestCallbackFunction_h
+
+#if ENABLE(SPEECH_SYNTHESIS)
+
+#include "ActiveDOMCallback.h"
+#include "JSCallbackData.h"
+#include "TestCallbackFunction.h"
+#include <wtf/Forward.h>
+
+namespace WebCore {
+
+class JSTestCallbackFunction : public TestCallbackFunction, public ActiveDOMCallback {
+public:
+ static Ref<JSTestCallbackFunction> create(JSC::JSObject* callback, JSDOMGlobalObject* globalObject)
+ {
+ return adoptRef(*new JSTestCallbackFunction(callback, globalObject));
+ }
+
+ virtual ScriptExecutionContext* scriptExecutionContext() const { return ContextDestructionObserver::scriptExecutionContext(); }
+
+ virtual ~JSTestCallbackFunction();
+
+ // Functions
+ virtual bool callbackWithNoParam();
+ virtual bool callbackWithArrayParam(RefPtr<Float32Array> arrayParam);
+ virtual bool callbackWithSerializedScriptValueParam(PassRefPtr<SerializedScriptValue> srzParam, const String& strArg);
+ COMPILE_ASSERT(false) virtual int callbackWithNonBoolReturnType(const String& strArg);
+ virtual int customCallback(Class5* class5Param, Class6* class6Param);
+ virtual bool callbackWithStringList(PassRefPtr<DOMStringList> listParam);
+ virtual bool callbackWithBoolean(bool boolParam);
+ virtual bool callbackRequiresThisToPass(int longParam, TestNode* testNodeParam);
+
+private:
+ JSTestCallbackFunction(JSC::JSObject* callback, JSDOMGlobalObject*);
+
+ JSCallbackData* m_data;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SPEECH_SYNTHESIS)
+
+#endif
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (188993 => 188994)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2015-08-26 22:09:29 UTC (rev 188994)
@@ -38,6 +38,7 @@
#include "JSSVGPoint.h"
#include "JSScriptProfile.h"
#include "JSTestCallback.h"
+#include "JSTestCallbackFunction.h"
#include "JSTestNode.h"
#include "JSTestObj.h"
#include "JSTestSubObj.h"
@@ -116,6 +117,9 @@
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackArg(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArg(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackFunctionArg(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackFunctionArg(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackFunctionAndOptionalArg(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionStaticMethodWithCallbackAndOptionalArg(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionStaticMethodWithCallbackArg(JSC::ExecState*);
#if ENABLE(Condition1)
@@ -451,12 +455,15 @@
EncodedJSValue JSC_HOST_CALL JSTestObjConstructor::constructJSTestObj(ExecState* exec)
{
auto* castedThis = jsCast<JSTestObjConstructor*>(exec->callee());
- if (UNLIKELY(exec->argumentCount() < 1))
+ if (UNLIKELY(exec->argumentCount() < 2))
return throwVMError(exec, createNotEnoughArgumentsError(exec));
- if (!exec->argument(0).isFunction())
+ if (!exec->argument(0).isObject())
return throwArgumentMustBeFunctionError(*exec, 0, "testCallback", "TestObj", nullptr);
RefPtr<TestCallback> testCallback = JSTestCallback::create(asObject(exec->uncheckedArgument(0)), castedThis->globalObject());
- RefPtr<TestObj> object = TestObj::create(testCallback);
+ if (!exec->argument(1).isFunction())
+ return throwArgumentMustBeFunctionError(*exec, 1, "testCallbackFunction", "TestObj", nullptr);
+ RefPtr<TestCallbackFunction> testCallbackFunction = JSTestCallbackFunction::create(asObject(exec->uncheckedArgument(1)), castedThis->globalObject());
+ RefPtr<TestObj> object = TestObj::create(testCallback, testCallbackFunction);
return JSValue::encode(asObject(toJS(exec, castedThis->globalObject(), object.get())));
}
@@ -473,7 +480,7 @@
ASSERT(inherits(info()));
putDirect(vm, vm.propertyNames->prototype, JSTestObj::getPrototype(vm, globalObject), DontDelete | ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("TestObject"))), ReadOnly | DontEnum);
- putDirect(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontEnum);
+ putDirect(vm, vm.propertyNames->length, jsNumber(2), ReadOnly | DontEnum);
reifyStaticProperties(vm, JSTestObjConstructorTableValues, *this);
}
@@ -618,6 +625,9 @@
{ "methodWithCallbackArg", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithCallbackArg), (intptr_t) (1) },
{ "methodWithNonCallbackArgAndCallbackArg", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg), (intptr_t) (2) },
{ "methodWithCallbackAndOptionalArg", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArg), (intptr_t) (0) },
+ { "methodWithCallbackFunctionArg", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithCallbackFunctionArg), (intptr_t) (1) },
+ { "methodWithNonCallbackArgAndCallbackFunctionArg", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackFunctionArg), (intptr_t) (2) },
+ { "methodWithCallbackFunctionAndOptionalArg", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithCallbackFunctionAndOptionalArg), (intptr_t) (0) },
#if ENABLE(Condition1)
{ "conditionalMethod1", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionConditionalMethod1), (intptr_t) (0) },
#else
@@ -3599,7 +3609,7 @@
auto& impl = castedThis->impl();
if (UNLIKELY(exec->argumentCount() < 1))
return throwVMError(exec, createNotEnoughArgumentsError(exec));
- if (!exec->argument(0).isFunction())
+ if (!exec->argument(0).isObject())
return throwArgumentMustBeFunctionError(*exec, 0, "callback", "TestObj", "methodWithCallbackArg");
RefPtr<TestCallback> callback = JSTestCallback::create(asObject(exec->uncheckedArgument(0)), castedThis->globalObject());
impl.methodWithCallbackArg(callback);
@@ -3619,7 +3629,7 @@
int nonCallback = toInt32(exec, exec->argument(0), NormalConversion);
if (UNLIKELY(exec->hadException()))
return JSValue::encode(jsUndefined());
- if (!exec->argument(1).isFunction())
+ if (!exec->argument(1).isObject())
return throwArgumentMustBeFunctionError(*exec, 1, "callback", "TestObj", "methodWithNonCallbackArgAndCallbackArg");
RefPtr<TestCallback> callback = JSTestCallback::create(asObject(exec->uncheckedArgument(1)), castedThis->globalObject());
impl.methodWithNonCallbackArgAndCallbackArg(nonCallback, callback);
@@ -3636,7 +3646,7 @@
auto& impl = castedThis->impl();
RefPtr<TestCallback> callback;
if (!exec->argument(0).isUndefinedOrNull()) {
- if (!exec->uncheckedArgument(0).isFunction())
+ if (!exec->uncheckedArgument(0).isObject())
return throwArgumentMustBeFunctionError(*exec, 0, "callback", "TestObj", "methodWithCallbackAndOptionalArg");
callback = JSTestCallback::create(asObject(exec->uncheckedArgument(0)), castedThis->globalObject());
}
@@ -3644,11 +3654,66 @@
return JSValue::encode(jsUndefined());
}
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackFunctionArg(ExecState* exec)
+{
+ JSValue thisValue = exec->thisValue();
+ JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(thisValue);
+ if (UNLIKELY(!castedThis))
+ return throwThisTypeError(*exec, "TestObj", "methodWithCallbackFunctionArg");
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+ auto& impl = castedThis->impl();
+ if (UNLIKELY(exec->argumentCount() < 1))
+ return throwVMError(exec, createNotEnoughArgumentsError(exec));
+ if (!exec->argument(0).isFunction())
+ return throwArgumentMustBeFunctionError(*exec, 0, "callback", "TestObj", "methodWithCallbackFunctionArg");
+ RefPtr<TestCallbackFunction> callback = JSTestCallbackFunction::create(asObject(exec->uncheckedArgument(0)), castedThis->globalObject());
+ impl.methodWithCallbackFunctionArg(callback);
+ return JSValue::encode(jsUndefined());
+}
+
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackFunctionArg(ExecState* exec)
+{
+ JSValue thisValue = exec->thisValue();
+ JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(thisValue);
+ if (UNLIKELY(!castedThis))
+ return throwThisTypeError(*exec, "TestObj", "methodWithNonCallbackArgAndCallbackFunctionArg");
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+ auto& impl = castedThis->impl();
+ if (UNLIKELY(exec->argumentCount() < 2))
+ return throwVMError(exec, createNotEnoughArgumentsError(exec));
+ int nonCallback = toInt32(exec, exec->argument(0), NormalConversion);
+ if (UNLIKELY(exec->hadException()))
+ return JSValue::encode(jsUndefined());
+ if (!exec->argument(1).isFunction())
+ return throwArgumentMustBeFunctionError(*exec, 1, "callback", "TestObj", "methodWithNonCallbackArgAndCallbackFunctionArg");
+ RefPtr<TestCallbackFunction> callback = JSTestCallbackFunction::create(asObject(exec->uncheckedArgument(1)), castedThis->globalObject());
+ impl.methodWithNonCallbackArgAndCallbackFunctionArg(nonCallback, callback);
+ return JSValue::encode(jsUndefined());
+}
+
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackFunctionAndOptionalArg(ExecState* exec)
+{
+ JSValue thisValue = exec->thisValue();
+ JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(thisValue);
+ if (UNLIKELY(!castedThis))
+ return throwThisTypeError(*exec, "TestObj", "methodWithCallbackFunctionAndOptionalArg");
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+ auto& impl = castedThis->impl();
+ RefPtr<TestCallbackFunction> callback;
+ if (!exec->argument(0).isUndefinedOrNull()) {
+ if (!exec->uncheckedArgument(0).isFunction())
+ return throwArgumentMustBeFunctionError(*exec, 0, "callback", "TestObj", "methodWithCallbackFunctionAndOptionalArg");
+ callback = JSTestCallbackFunction::create(asObject(exec->uncheckedArgument(0)), castedThis->globalObject());
+ }
+ impl.methodWithCallbackFunctionAndOptionalArg(callback);
+ return JSValue::encode(jsUndefined());
+}
+
EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionStaticMethodWithCallbackAndOptionalArg(ExecState* exec)
{
RefPtr<TestCallback> callback;
if (!exec->argument(0).isUndefinedOrNull()) {
- if (!exec->uncheckedArgument(0).isFunction())
+ if (!exec->uncheckedArgument(0).isObject())
return throwArgumentMustBeFunctionError(*exec, 0, "callback", "TestObj", "staticMethodWithCallbackAndOptionalArg");
callback = createFunctionOnlyCallback<JSTestCallback>(exec, jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), exec->uncheckedArgument(0));
}
@@ -3660,7 +3725,7 @@
{
if (UNLIKELY(exec->argumentCount() < 1))
return throwVMError(exec, createNotEnoughArgumentsError(exec));
- if (!exec->argument(0).isFunction())
+ if (!exec->argument(0).isObject())
return throwArgumentMustBeFunctionError(*exec, 0, "callback", "TestObj", "staticMethodWithCallbackArg");
RefPtr<TestCallback> callback = createFunctionOnlyCallback<JSTestCallback>(exec, jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()), exec->uncheckedArgument(0));
TestObj::staticMethodWithCallbackArg(callback);
@@ -3803,7 +3868,7 @@
auto& impl = castedThis->impl();
if (UNLIKELY(exec->argumentCount() < 1))
return throwVMError(exec, createNotEnoughArgumentsError(exec));
- if (!exec->argument(0).isFunction())
+ if (!exec->argument(0).isObject())
return throwArgumentMustBeFunctionError(*exec, 0, "callback", "TestObj", "overloadedMethod");
RefPtr<TestCallback> callback = JSTestCallback::create(asObject(exec->uncheckedArgument(0)), castedThis->globalObject());
impl.overloadedMethod(callback);
@@ -3943,7 +4008,7 @@
return jsTestObjPrototypeFunctionOverloadedMethod3(exec);
if (argsCount == 1)
return jsTestObjPrototypeFunctionOverloadedMethod4(exec);
- if ((argsCount == 1 && (arg0.isNull() || arg0.isFunction())))
+ if ((argsCount == 1 && (arg0.isNull() || arg0.isObject())))
return jsTestObjPrototypeFunctionOverloadedMethod5(exec);
if ((argsCount == 1 && (arg0.isNull() || (arg0.isObject() && asObject(arg0)->inherits(JSDOMStringList::info())))))
return jsTestObjPrototypeFunctionOverloadedMethod6(exec);
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp (188993 => 188994)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp 2015-08-26 22:09:29 UTC (rev 188994)
@@ -151,7 +151,7 @@
String hello = exec->argument(0).toString(exec)->value(exec);
if (UNLIKELY(exec->hadException()))
return JSValue::encode(jsUndefined());
- if (!exec->argument(1).isFunction())
+ if (!exec->argument(1).isObject())
return throwArgumentMustBeFunctionError(*exec, 1, "testCallback", "TestTypedefs", nullptr);
RefPtr<TestCallback> testCallback = JSTestCallback::create(asObject(exec->uncheckedArgument(1)), castedThis->globalObject());
RefPtr<TestTypedefs> object = TestTypedefs::create(hello, testCallback);
Copied: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallbackFunction.h (from rev 188993, trunk/Source/WebCore/html/VoidCallback.idl) (0 => 188994)
--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallbackFunction.h (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallbackFunction.h 2015-08-26 22:09:29 UTC (rev 188994)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.wei...@gmail.com>
+ *
+ * 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. ``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
+ * 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.
+ */
+
+#import <WebCore/DOMObject.h>
+
+@class DOMClass5;
+@class DOMClass6;
+@class DOMDOMStringList;
+@class DOMFloat32Array;
+@class DOMTestNode;
+@class NSString;
+
+WEBKIT_CLASS_AVAILABLE_MAC(9876_5)
+WEBCORE_EXPORT @interface DOMTestCallbackFunction : DOMObject
+- (BOOL)callbackWithNoParam;
+- (BOOL)callbackWithArrayParam:(DOMFloat32Array *)arrayParam;
+- (BOOL)callbackWithSerializedScriptValueParam:(NSString *)srzParam strArg:(NSString *)strArg;
+- (int)callbackWithNonBoolReturnType:(NSString *)strArg;
+- (int)customCallback:(DOMClass5 *)class5Param class6Param:(DOMClass6 *)class6Param;
+- (BOOL)callbackWithStringList:(DOMDOMStringList *)listParam;
+- (BOOL)callbackWithBoolean:(BOOL)boolParam;
+- (BOOL)callbackRequiresThisToPass:(int)longParam testNodeParam:(DOMTestNode *)testNodeParam;
+@end
Added: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallbackFunction.mm (0 => 188994)
--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallbackFunction.mm (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallbackFunction.mm 2015-08-26 22:09:29 UTC (rev 188994)
@@ -0,0 +1,146 @@
+/*
+ * This file is part of the WebKit open source project.
+ * This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+ *
+ * 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. ``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
+ * 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.
+ */
+
+#import "config.h"
+
+#if ENABLE(SPEECH_SYNTHESIS)
+
+#import "DOMInternal.h"
+
+#import "DOMTestCallbackFunction.h"
+
+#import "Class5.h"
+#import "Class6.h"
+#import "DOMClass5Internal.h"
+#import "DOMClass6Internal.h"
+#import "DOMDOMStringListInternal.h"
+#import "DOMFloat32ArrayInternal.h"
+#import "DOMNodeInternal.h"
+#import "DOMStringList.h"
+#import "DOMTestCallbackFunctionInternal.h"
+#import "DOMTestNodeInternal.h"
+#import "ExceptionHandlers.h"
+#import "JSMainThreadExecState.h"
+#import "SerializedScriptValue.h"
+#import "TestCallbackFunction.h"
+#import "TestNode.h"
+#import "ThreadCheck.h"
+#import "URL.h"
+#import "WebCoreObjCExtras.h"
+#import "WebScriptObjectPrivate.h"
+#import <wtf/GetPtr.h>
+
+#define IMPL reinterpret_cast<WebCore::TestCallbackFunction*>(_internal)
+
+@implementation DOMTestCallbackFunction
+
+- (void)dealloc
+{
+ if (WebCoreObjCScheduleDeallocateOnMainThread([DOMTestCallbackFunction class], self))
+ return;
+
+ if (_internal)
+ IMPL->deref();
+ [super dealloc];
+}
+
+- (void)finalize
+{
+ if (_internal)
+ IMPL->deref();
+ [super finalize];
+}
+
+- (BOOL)callbackWithNoParam
+{
+ WebCore::JSMainThreadNullState state;
+ return IMPL->callbackWithNoParam();
+}
+
+- (BOOL)callbackWithArrayParam:(DOMFloat32Array *)arrayParam
+{
+ WebCore::JSMainThreadNullState state;
+ return IMPL->callbackWithArrayParam(core(arrayParam));
+}
+
+- (BOOL)callbackWithSerializedScriptValueParam:(NSString *)srzParam strArg:(NSString *)strArg
+{
+ WebCore::JSMainThreadNullState state;
+ return IMPL->callbackWithSerializedScriptValueParam(WebCore::SerializedScriptValue::create(WTF::String(srzParam)), strArg);
+}
+
+- (int)callbackWithNonBoolReturnType:(NSString *)strArg
+{
+ WebCore::JSMainThreadNullState state;
+ return IMPL->callbackWithNonBoolReturnType(strArg);
+}
+
+- (int)customCallback:(DOMClass5 *)class5Param class6Param:(DOMClass6 *)class6Param
+{
+ WebCore::JSMainThreadNullState state;
+ return IMPL->customCallback(core(class5Param), core(class6Param));
+}
+
+- (BOOL)callbackWithStringList:(DOMDOMStringList *)listParam
+{
+ WebCore::JSMainThreadNullState state;
+ return IMPL->callbackWithStringList(core(listParam));
+}
+
+- (BOOL)callbackWithBoolean:(BOOL)boolParam
+{
+ WebCore::JSMainThreadNullState state;
+ return IMPL->callbackWithBoolean(boolParam);
+}
+
+- (BOOL)callbackRequiresThisToPass:(int)longParam testNodeParam:(DOMTestNode *)testNodeParam
+{
+ WebCore::JSMainThreadNullState state;
+ return IMPL->callbackRequiresThisToPass(longParam, core(testNodeParam));
+}
+
+@end
+
+WebCore::TestCallbackFunction* core(DOMTestCallbackFunction *wrapper)
+{
+ return wrapper ? reinterpret_cast<WebCore::TestCallbackFunction*>(wrapper->_internal) : 0;
+}
+
+DOMTestCallbackFunction *kit(WebCore::TestCallbackFunction* value)
+{
+ WebCoreThreadViolationCheckRoundOne();
+ if (!value)
+ return nil;
+ if (DOMTestCallbackFunction *wrapper = getDOMWrapper(value))
+ return [[wrapper retain] autorelease];
+ DOMTestCallbackFunction *wrapper = [[DOMTestCallbackFunction alloc] _init];
+ wrapper->_internal = reinterpret_cast<DOMObjectInternal*>(value);
+ value->ref();
+ addDOMWrapper(wrapper, value);
+ return [wrapper autorelease];
+}
+
+#endif // ENABLE(SPEECH_SYNTHESIS)
Copied: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallbackFunctionInternal.h (from rev 188993, trunk/Source/WebCore/html/VoidCallback.idl) (0 => 188994)
--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallbackFunctionInternal.h (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallbackFunctionInternal.h 2015-08-26 22:09:29 UTC (rev 188994)
@@ -0,0 +1,34 @@
+/*
+ * This file is part of the WebKit open source project.
+ * This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+ *
+ * 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. ``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
+ * 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.
+ */
+
+#import <WebCore/DOMTestCallbackFunction.h>
+
+namespace WebCore {
+class TestCallbackFunction;
+}
+
+WEBCORE_EXPORT WebCore::TestCallbackFunction* core(DOMTestCallbackFunction *);
+WEBCORE_EXPORT DOMTestCallbackFunction *kit(WebCore::TestCallbackFunction*);
Copied: trunk/Source/WebCore/bindings/scripts/test/TestCallbackFunction.idl (from rev 188993, trunk/Source/WebCore/Modules/webdatabase/SQLStatementCallback.idl) (0 => 188994)
--- trunk/Source/WebCore/bindings/scripts/test/TestCallbackFunction.idl (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/TestCallbackFunction.idl 2015-08-26 22:09:29 UTC (rev 188994)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary formstrArg, 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.
+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIEstrArg, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE 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.
+ */
+
+// This IDL file is for testing the bindings code generator with function only callback
+// interface and for tracking changes in its ouput.
+[
+ Conditional=SPEECH_SYNTHESIS,
+ Callback=FunctionOnly,
+] callback interface TestCallbackFunction {
+ boolean callbackWithNoParam();
+ boolean callbackWithArrayParam(Float32Array arrayParam);
+ boolean callbackWithSerializedScriptValueParam(SerializedScriptValue srzParam, DOMString strArg);
+ long callbackWithNonBoolReturnType(DOMString strArg);
+ [Custom] long customCallback(Class5 class5Param, Class6 class6Param);
+ boolean callbackWithStringList(DOMStringList listParam);
+ boolean callbackWithBoolean(boolean boolParam);
+ boolean callbackRequiresThisToPass(long longParam, TestNode testNodeParam);
+};
Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (188993 => 188994)
--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl 2015-08-26 22:09:29 UTC (rev 188994)
@@ -36,7 +36,7 @@
enum _optional { "", "OptionalValue1", "OptionalValue2", "OptionalValue3" };
[
- Constructor(TestCallback testCallback),
+ Constructor(TestCallback testCallback, TestCallbackFunction testCallbackFunction),
InterfaceName=TestObject
] interface TestObj {
// Attributes
@@ -146,10 +146,16 @@
void methodWithOptionalStringIsNullString([Default=NullString] optional DOMString str);
#if defined(TESTING_JS)
- // 'Callback' extended attribute
+ // Callback interface parameters.
void methodWithCallbackArg(TestCallback callback);
void methodWithNonCallbackArgAndCallbackArg(long nonCallback, TestCallback callback);
void methodWithCallbackAndOptionalArg(optional TestCallback callback);
+
+ // Callback function parameters.
+ void methodWithCallbackFunctionArg(TestCallbackFunction callback);
+ void methodWithNonCallbackArgAndCallbackFunctionArg(long nonCallback, TestCallbackFunction callback);
+ void methodWithCallbackFunctionAndOptionalArg(optional TestCallbackFunction callback);
+
// static methods with 'Callback' extended attribute
static void staticMethodWithCallbackAndOptionalArg(optional TestCallback callback);
static void staticMethodWithCallbackArg(TestCallback callback);
Modified: trunk/Source/WebCore/css/MediaQueryListListener.idl (188993 => 188994)
--- trunk/Source/WebCore/css/MediaQueryListListener.idl 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/WebCore/css/MediaQueryListListener.idl 2015-08-26 22:09:29 UTC (rev 188994)
@@ -19,6 +19,7 @@
[
CallbackNeedsOperatorEqual,
+ Callback=FunctionOnly,
] callback interface MediaQueryListListener {
boolean queryChanged([Default=Undefined] optional MediaQueryList list);
};
Modified: trunk/Source/WebCore/dom/RequestAnimationFrameCallback.idl (188993 => 188994)
--- trunk/Source/WebCore/dom/RequestAnimationFrameCallback.idl 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/WebCore/dom/RequestAnimationFrameCallback.idl 2015-08-26 22:09:29 UTC (rev 188994)
@@ -30,6 +30,7 @@
[
Conditional=REQUEST_ANIMATION_FRAME,
+ Callback=FunctionOnly,
] callback interface RequestAnimationFrameCallback {
// highResTime is passed as high resolution timestamp, see
// http://www.w3.org/TR/hr-time/ for details.
Modified: trunk/Source/WebCore/dom/StringCallback.idl (188993 => 188994)
--- trunk/Source/WebCore/dom/StringCallback.idl 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/WebCore/dom/StringCallback.idl 2015-08-26 22:09:29 UTC (rev 188994)
@@ -28,6 +28,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-callback interface StringCallback {
+[
+ Callback=FunctionOnly,
+] callback interface StringCallback {
boolean handleEvent(DOMString data);
};
Modified: trunk/Source/WebCore/html/VoidCallback.idl (188993 => 188994)
--- trunk/Source/WebCore/html/VoidCallback.idl 2015-08-26 22:07:18 UTC (rev 188993)
+++ trunk/Source/WebCore/html/VoidCallback.idl 2015-08-26 22:09:29 UTC (rev 188994)
@@ -22,7 +22,8 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
-callback interface VoidCallback {
+[
+ Callback=FunctionOnly,
+] callback interface VoidCallback {
boolean handleEvent();
};