Modified: trunk/Source/WebCore/ChangeLog (199011 => 199012)
--- trunk/Source/WebCore/ChangeLog 2016-04-04 18:20:37 UTC (rev 199011)
+++ trunk/Source/WebCore/ChangeLog 2016-04-04 18:30:28 UTC (rev 199012)
@@ -1,3 +1,19 @@
+2016-04-04 Anders Carlsson <[email protected]>
+
+ Properly generate static functions that return Promises
+ https://bugs.webkit.org/show_bug.cgi?id=156169
+
+ Reviewed by Sam Weinig.
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateReturnParameters):
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunction):
+ (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionPromise):
+ (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionWithException):
+ (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionWithExceptionPromise):
+ * bindings/scripts/test/TestObj.idl:
+
2016-04-04 Joonghun Park <[email protected]>
[EFL] Fix build break since r198800
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (199011 => 199012)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-04-04 18:20:37 UTC (rev 199011)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-04-04 18:30:28 UTC (rev 199012)
@@ -3595,7 +3595,13 @@
my $function = shift;
my @arguments;
- push(@arguments, "DeferredWrapper(state, castedThis->globalObject(), promiseDeferred)") if IsReturningPromise($function);
+ if (IsReturningPromise($function)) {
+ if ($function->isStatic) {
+ push(@arguments, "DeferredWrapper(state, jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject()), promiseDeferred)");
+ } else {
+ push(@arguments, "DeferredWrapper(state, castedThis->globalObject(), promiseDeferred)");
+ }
+ }
push(@arguments, "ec") if $function->signature->extendedAttributes->{"RaisesException"} || $function->signature->extendedAttributes->{"RaisesExceptionWithMessage"};
return @arguments;
}
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (199011 => 199012)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-04-04 18:20:37 UTC (rev 199011)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-04-04 18:30:28 UTC (rev 199012)
@@ -189,6 +189,8 @@
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionTestPromiseFunctionWithException(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgument(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionTestPromiseOverloadedFunction(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionTestStaticPromiseFunction(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionTestStaticPromiseFunctionWithException(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNeedsLifecycleProcessingStack(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSymbolIterator(JSC::ExecState*);
JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionEntries(JSC::ExecState*);
@@ -466,6 +468,8 @@
#else
{ 0, 0, NoIntrinsic, { 0, 0 } },
#endif
+ { "testStaticPromiseFunction", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjConstructorFunctionTestStaticPromiseFunction), (intptr_t) (0) } },
+ { "testStaticPromiseFunctionWithException", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjConstructorFunctionTestStaticPromiseFunctionWithException), (intptr_t) (0) } },
};
@@ -5154,6 +5158,32 @@
return throwVMTypeError(state);
}
+static EncodedJSValue jsTestObjConstructorFunctionTestStaticPromiseFunctionPromise(ExecState*, JSPromiseDeferred*);
+EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionTestStaticPromiseFunction(ExecState* state)
+{
+ return JSValue::encode(callPromiseFunction(*state, jsTestObjConstructorFunctionTestStaticPromiseFunctionPromise));
+}
+
+static inline EncodedJSValue jsTestObjConstructorFunctionTestStaticPromiseFunctionPromise(ExecState* state, JSPromiseDeferred* promiseDeferred)
+{
+ TestObj::testStaticPromiseFunction(DeferredWrapper(state, jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject()), promiseDeferred));
+ return JSValue::encode(jsUndefined());
+}
+
+static EncodedJSValue jsTestObjConstructorFunctionTestStaticPromiseFunctionWithExceptionPromise(ExecState*, JSPromiseDeferred*);
+EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionTestStaticPromiseFunctionWithException(ExecState* state)
+{
+ return JSValue::encode(callPromiseFunction(*state, jsTestObjConstructorFunctionTestStaticPromiseFunctionWithExceptionPromise));
+}
+
+static inline EncodedJSValue jsTestObjConstructorFunctionTestStaticPromiseFunctionWithExceptionPromise(ExecState* state, JSPromiseDeferred* promiseDeferred)
+{
+ ExceptionCode ec = 0;
+ TestObj::testStaticPromiseFunctionWithException(DeferredWrapper(state, jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject()), promiseDeferred), ec);
+ setDOMException(state, ec);
+ return JSValue::encode(jsUndefined());
+}
+
EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNeedsLifecycleProcessingStack(ExecState* state)
{
#if ENABLE(CUSTOM_ELEMENTS)
Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (199011 => 199012)
--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl 2016-04-04 18:20:37 UTC (rev 199011)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl 2016-04-04 18:30:28 UTC (rev 199012)
@@ -331,6 +331,8 @@
Promise testPromiseFunctionWithOptionalIntArgument(optional long a);
Promise testPromiseOverloadedFunction(float a);
Promise testPromiseOverloadedFunction(FetchRequest request);
+ static Promise testStaticPromiseFunction();
+ [RaisesException] static Promise testStaticPromiseFunctionWithException();
// PutForwards
[PutForwards=name] readonly attribute TestNode putForwardsAttribute;