<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[185493] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/185493">185493</a></dd>
<dt>Author</dt> <dd>youenn.fablet@crf.canon.fr</dd>
<dt>Date</dt> <dd>2015-06-12 02:25:46 -0700 (Fri, 12 Jun 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Bindings generator should generate code for Promise-based APIs
https://bugs.webkit.org/show_bug.cgi?id=145833
Reviewed by Darin Adler.
Covered by existing tests.
* Modules/webaudio/AudioContext.idl: Removing custom binding for resume, suspend and close.
* bindings/js/JSAudioContextCustom.cpp: Ditto.
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateHeader): Refactoring to use IsReturningPromise.
(GenerateImplementation): Disabling include for return type if it is a promise.
(GenerateParametersCheck): Adding DeferredWrapper() as argument to the DOM method if JS method returns a promise.
(GenerateImplementationFunctionCall): Added support for promise-returning API.
(IsReturningPromise): Checking whether function is returning a promise.
* bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
(webkit_dom_test_obj_test_promise_function):
* bindings/scripts/test/GObject/WebKitDOMTestObj.h:
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjPrototypeFunctionTestPromiseFunction):
* bindings/scripts/test/ObjC/DOMTestObj.h:
* bindings/scripts/test/ObjC/DOMTestObj.mm:
(-[DOMTestObj testPromiseFunction]):
* bindings/scripts/test/TestObj.idl: Adding promise returning function.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModuleswebaudioAudioContextidl">trunk/Source/WebCore/Modules/webaudio/AudioContext.idl</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSAudioContextCustomcpp">trunk/Source/WebCore/bindings/js/JSAudioContextCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestGObjectWebKitDOMTestObjcpp">trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestGObjectWebKitDOMTestObjh">trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestObjCDOMTestObjh">trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestObjCDOMTestObjmm">trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestTestObjidl">trunk/Source/WebCore/bindings/scripts/test/TestObj.idl</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (185492 => 185493)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-06-12 08:19:36 UTC (rev 185492)
+++ trunk/Source/WebCore/ChangeLog        2015-06-12 09:25:46 UTC (rev 185493)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2015-06-12 Youenn Fablet <youenn.fablet@crf.canon.fr>
+
+ Bindings generator should generate code for Promise-based APIs
+ https://bugs.webkit.org/show_bug.cgi?id=145833
+
+ Reviewed by Darin Adler.
+
+ Covered by existing tests.
+
+ * Modules/webaudio/AudioContext.idl: Removing custom binding for resume, suspend and close.
+ * bindings/js/JSAudioContextCustom.cpp: Ditto.
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateHeader): Refactoring to use IsReturningPromise.
+ (GenerateImplementation): Disabling include for return type if it is a promise.
+ (GenerateParametersCheck): Adding DeferredWrapper() as argument to the DOM method if JS method returns a promise.
+ (GenerateImplementationFunctionCall): Added support for promise-returning API.
+ (IsReturningPromise): Checking whether function is returning a promise.
+ * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
+ (webkit_dom_test_obj_test_promise_function):
+ * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ (WebCore::jsTestObjPrototypeFunctionTestPromiseFunction):
+ * bindings/scripts/test/ObjC/DOMTestObj.h:
+ * bindings/scripts/test/ObjC/DOMTestObj.mm:
+ (-[DOMTestObj testPromiseFunction]):
+ * bindings/scripts/test/TestObj.idl: Adding promise returning function.
+
+
</ins><span class="cx"> 2015-06-12 Manuel Rego Casasnovas <rego@igalia.com>
</span><span class="cx">
</span><span class="cx"> [CSS Grid Layout] Fix grid-template-areas parsing to avoid spaces
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebaudioAudioContextidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/webaudio/AudioContext.idl (185492 => 185493)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/webaudio/AudioContext.idl        2015-06-12 08:19:36 UTC (rev 185492)
+++ trunk/Source/WebCore/Modules/webaudio/AudioContext.idl        2015-06-12 09:25:46 UTC (rev 185493)
</span><span class="lines">@@ -50,9 +50,9 @@
</span><span class="cx"> // All panning is relative to this listener.
</span><span class="cx"> readonly attribute AudioListener listener;
</span><span class="cx">
</span><del>- [Custom] Promise suspend();
- [Custom] Promise resume();
- [Custom] Promise close();
</del><ins>+ Promise suspend();
+ Promise resume();
+ Promise close();
</ins><span class="cx">
</span><span class="cx"> readonly attribute AudioContextState state;
</span><span class="cx"> attribute EventHandler onstatechange;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSAudioContextCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSAudioContextCustom.cpp (185492 => 185493)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSAudioContextCustom.cpp        2015-06-12 08:19:36 UTC (rev 185492)
+++ trunk/Source/WebCore/bindings/js/JSAudioContextCustom.cpp        2015-06-12 09:25:46 UTC (rev 185493)
</span><span class="lines">@@ -111,33 +111,6 @@
</span><span class="cx"> return JSValue::encode(CREATE_DOM_WRAPPER(jsConstructor->globalObject(), AudioContext, audioContext.get()));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-JSValue JSAudioContext::suspend(ExecState* state)
-{
- JSPromiseDeferred* promiseDeferred = JSPromiseDeferred::create(state, globalObject());
-
- impl().suspend(DeferredWrapper(state, globalObject(), promiseDeferred));
-
- return promiseDeferred->promise();
-}
-
-JSValue JSAudioContext::resume(ExecState* state)
-{
- JSPromiseDeferred* promiseDeferred = JSPromiseDeferred::create(state, globalObject());
-
- impl().resume(DeferredWrapper(state, globalObject(), promiseDeferred));
-
- return promiseDeferred->promise();
-}
-
-JSValue JSAudioContext::close(ExecState* state)
-{
- JSPromiseDeferred* promiseDeferred = JSPromiseDeferred::create(state, globalObject());
-
- impl().close(DeferredWrapper(state, globalObject(), promiseDeferred));
-
- return promiseDeferred->promise();
-}
-
</del><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> #endif // ENABLE(WEB_AUDIO)
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (185492 => 185493)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2015-06-12 08:19:36 UTC (rev 185492)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2015-06-12 09:25:46 UTC (rev 185493)
</span><span class="lines">@@ -1047,7 +1047,7 @@
</span><span class="cx"> $needsVisitChildren = 1;
</span><span class="cx"> push(@headerContent, "#endif\n") if $conditionalString;
</span><span class="cx"> }
</span><del>- elsif ($attribute->signature->type eq "Promise") {
</del><ins>+ elsif (IsReturningPromise($attribute)) {
</ins><span class="cx"> $headerIncludes{"JSDOMPromise.h"} = 1;
</span><span class="cx">
</span><span class="cx"> my $conditionalString = $codeGenerator->GenerateConditionalString($attribute->signature);
</span><span class="lines">@@ -2759,7 +2759,7 @@
</span><span class="cx">
</span><span class="cx"> next if $isCustom && $isOverloaded && $function->{overloadIndex} > 1;
</span><span class="cx">
</span><del>- AddIncludesForTypeInImpl($function->signature->type) unless $isCustom;
</del><ins>+ AddIncludesForTypeInImpl($function->signature->type) unless $isCustom or IsReturningPromise($function);
</ins><span class="cx">
</span><span class="cx"> my $functionName = GetFunctionName($className, $function);
</span><span class="cx">
</span><span class="lines">@@ -3386,6 +3386,8 @@
</span><span class="cx"> $argsIndex++;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ push(@arguments, "DeferredWrapper(exec, castedThis->globalObject(), promiseDeferred)") if IsReturningPromise($function);
+
</ins><span class="cx"> push(@arguments, "ec") if $raisesException;
</span><span class="cx">
</span><span class="cx"> return ("$functionName(" . join(", ", @arguments) . ")", scalar @arguments);
</span><span class="lines">@@ -3654,9 +3656,17 @@
</span><span class="cx"> push(@implContent, "#else\n");
</span><span class="cx"> push(@implContent, $indent . "result = " . NativeToJSValue($function->signature, 1, $interfaceName, $functionString, $thisObject) . ";\n");
</span><span class="cx"> push(@implContent, "#endif\n");
</span><ins>+ } elsif (IsReturningPromise($function)) {
+ AddToImplIncludes("JSDOMPromise.h");
+
+ push(@implContent, $indent . "JSPromiseDeferred* promiseDeferred = JSPromiseDeferred::create(exec, castedThis->globalObject());\n");
+ push(@implContent, $indent . $functionString . ";\n");
+ push(@implContent, $indent . "JSValue result = promiseDeferred->promise();\n");
+
</ins><span class="cx"> } else {
</span><span class="cx"> push(@implContent, $indent . "JSValue result = " . NativeToJSValue($function->signature, 1, $interfaceName, $functionString, $thisObject) . ";\n");
</span><span class="cx"> }
</span><ins>+ # FIXME: In case of IsReturningPromise($function), the function should not throw. Exception should be used to reject the promise callback.
</ins><span class="cx"> push(@implContent, "\n" . $indent . "setDOMException(exec, ec);\n") if $raisesException;
</span><span class="cx">
</span><span class="cx"> if ($codeGenerator->ExtendedAttributeContains($function->signature->extendedAttributes->{"CallWith"}, "ScriptState")) {
</span><span class="lines">@@ -4774,6 +4784,13 @@
</span><span class="cx"> return !$interface->extendedAttributes->{"NoInterfaceObject"} || $interface->extendedAttributes->{"CustomConstructor"};
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+sub IsReturningPromise
+{
+ my $function = shift;
+
+ return $function->signature->type eq "Promise" if ($function->signature->type);
+}
+
</ins><span class="cx"> sub IsConstructable
</span><span class="cx"> {
</span><span class="cx"> my $interface = shift;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestGObjectWebKitDOMTestObjcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp (185492 => 185493)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp        2015-06-12 08:19:36 UTC (rev 185492)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp        2015-06-12 09:25:46 UTC (rev 185493)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #include "WebKitDOMDocumentPrivate.h"
</span><span class="cx"> #include "WebKitDOMNodePrivate.h"
</span><span class="cx"> #include "WebKitDOMPrivate.h"
</span><ins>+#include "WebKitDOMPromisePrivate.h"
</ins><span class="cx"> #include "WebKitDOMSVGPointPrivate.h"
</span><span class="cx"> #include "WebKitDOMTestEnumTypePrivate.h"
</span><span class="cx"> #include "WebKitDOMTestNodePrivate.h"
</span><span class="lines">@@ -1551,6 +1552,15 @@
</span><span class="cx"> item->any(a, b);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+WebKitDOMPromise* webkit_dom_test_obj_test_promise_function(WebKitDOMTestObj* self)
+{
+ WebCore::JSMainThreadNullState state;
+ g_return_val_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self), 0);
+ WebCore::TestObj* item = WebKit::core(self);
+ RefPtr<WebCore::Promise> gobjectResult = WTF::getPtr(item->testPromiseFunction());
+ return WebKit::kit(gobjectResult.get());
+}
+
</ins><span class="cx"> glong webkit_dom_test_obj_get_read_only_long_attr(WebKitDOMTestObj* self)
</span><span class="cx"> {
</span><span class="cx"> WebCore::JSMainThreadNullState state;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestGObjectWebKitDOMTestObjh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h (185492 => 185493)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h        2015-06-12 08:19:36 UTC (rev 185492)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h        2015-06-12 09:25:46 UTC (rev 185493)
</span><span class="lines">@@ -651,6 +651,17 @@
</span><span class="cx"> webkit_dom_test_obj_any(WebKitDOMTestObj* self, gfloat a, glong b);
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * webkit_dom_test_obj_test_promise_function:
+ * @self: A #WebKitDOMTestObj
+ *
+ * Returns: (transfer none): A #WebKitDOMPromise
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API WebKitDOMPromise*
+webkit_dom_test_obj_test_promise_function(WebKitDOMTestObj* self);
+
+/**
</ins><span class="cx"> * webkit_dom_test_obj_get_read_only_long_attr:
</span><span class="cx"> * @self: A #WebKitDOMTestObj
</span><span class="cx"> *
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (185492 => 185493)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2015-06-12 08:19:36 UTC (rev 185492)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2015-06-12 09:25:46 UTC (rev 185493)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #include "Frame.h"
</span><span class="cx"> #include "HTMLNames.h"
</span><span class="cx"> #include "JSDOMBinding.h"
</span><ins>+#include "JSDOMPromise.h"
</ins><span class="cx"> #include "JSDOMStringList.h"
</span><span class="cx"> #include "JSDocument.h"
</span><span class="cx"> #include "JSEventListener.h"
</span><span class="lines">@@ -154,6 +155,7 @@
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVariadicDoubleMethod(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVariadicNodeMethod(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAny(JSC::ExecState*);
</span><ins>+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionTestPromiseFunction(JSC::ExecState*);
</ins><span class="cx">
</span><span class="cx"> // Attributes
</span><span class="cx">
</span><span class="lines">@@ -648,6 +650,7 @@
</span><span class="cx"> { "variadicDoubleMethod", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionVariadicDoubleMethod), (intptr_t) (2) },
</span><span class="cx"> { "variadicNodeMethod", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionVariadicNodeMethod), (intptr_t) (2) },
</span><span class="cx"> { "any", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionAny), (intptr_t) (2) },
</span><ins>+ { "testPromiseFunction", JSC::Function, NoIntrinsic, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionTestPromiseFunction), (intptr_t) (0) },
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> const ClassInfo JSTestObjPrototype::s_info = { "TestObjectPrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestObjPrototype) };
</span><span class="lines">@@ -4423,6 +4426,20 @@
</span><span class="cx"> return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionTestPromiseFunction(ExecState* exec)
+{
+ JSValue thisValue = exec->thisValue();
+ JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(thisValue);
+ if (UNLIKELY(!castedThis))
+ return throwThisTypeError(*exec, "TestObj", "testPromiseFunction");
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+ auto& impl = castedThis->impl();
+ JSPromiseDeferred* promiseDeferred = JSPromiseDeferred::create(exec, castedThis->globalObject());
+ impl.testPromiseFunction(DeferredWrapper(exec, castedThis->globalObject(), promiseDeferred));
+ JSValue result = promiseDeferred->promise();
+ return JSValue::encode(result);
+}
+
</ins><span class="cx"> void JSTestObj::visitChildren(JSCell* cell, SlotVisitor& visitor)
</span><span class="cx"> {
</span><span class="cx"> auto* thisObject = jsCast<JSTestObj*>(cell);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestObjCDOMTestObjh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h (185492 => 185493)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h        2015-06-12 08:19:36 UTC (rev 185492)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h        2015-06-12 09:25:46 UTC (rev 185493)
</span><span class="lines">@@ -173,4 +173,5 @@
</span><span class="cx"> - (void)variadicDoubleMethod:(double)head tail:(double)tail;
</span><span class="cx"> - (void)variadicNodeMethod:(DOMNode *)head tail:(DOMNode *)tail;
</span><span class="cx"> - (void)any:(float)a b:(int)b;
</span><ins>+- (DOMPromise *)testPromiseFunction;
</ins><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestObjCDOMTestObjmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm (185492 => 185493)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm        2015-06-12 08:19:36 UTC (rev 185492)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm        2015-06-12 09:25:46 UTC (rev 185493)
</span><span class="lines">@@ -1183,6 +1183,12 @@
</span><span class="cx"> IMPL->any(a, b);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+- (DOMPromise *)testPromiseFunction
+{
+ WebCore::JSMainThreadNullState state;
+ return kit(WTF::getPtr(IMPL->testPromiseFunction()));
+}
+
</ins><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> WebCore::TestObj* core(DOMTestObj *wrapper)
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestTestObjidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (185492 => 185493)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2015-06-12 08:19:36 UTC (rev 185492)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2015-06-12 09:25:46 UTC (rev 185493)
</span><span class="lines">@@ -274,6 +274,8 @@
</span><span class="cx"> // Promise attributes
</span><span class="cx"> [CustomGetter] readonly attribute Promise testPromiseAttr;
</span><span class="cx">
</span><ins>+ // Promise function
+ Promise testPromiseFunction();
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> // The following comment should not generate any code.
</span></span></pre>
</div>
</div>
</body>
</html>