callPromiseFunction should be made usable for custom binding code
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Sep 2016 07:21:18 +0000 (07:21 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Sep 2016 07:21:18 +0000 (07:21 +0000)
https://bugs.webkit.org/show_bug.cgi?id=161961

Patch by Youenn Fablet <youenn@apple.com> on 2016-09-15
Reviewed by Darin Adler.

Source/WebCore:

Covered by updated test.

* bindings/js/JSDOMBinding.h:
(WebCore::castThisValue): Utility function to cast this value to a specific type.
* bindings/js/JSDOMPromise.h:
(WebCore::callPromiseFunction): Updated to take real promise function as a template parameter
for improved efficiency. Added workerMode template parameter.
(WebCore::bindingPromiseFunctionAdapter): Function signature adaptor.
* bindings/js/JSMediaDevicesCustom.cpp:
(WebCore::JSMediaDevicesGetUserMediaPromiseFunction):
(WebCore::JSMediaDevices::getUserMedia): Making use of callPromiseFunction to properly handle exceptions.
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation): Updated to use template parameter.
* bindings/scripts/test/JS/JSTestNode.cpp:
(WebCore::jsTestNodePrototypeFunctionTestWorkerPromise):
(WebCore::jsTestNodePrototypeFunctionTestWorkerPromisePromise):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjPrototypeFunctionTestPromiseFunction):
(WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgument):
(WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithException):
(WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgument):
(WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1):
(WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2):
(WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunction):
(WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionWithException):
* bindings/scripts/test/TestNode.idl: Adding Worker promise binding test.

LayoutTests:

* fast/mediastream/MediaDevices-getUserMedia-expected.txt:
* fast/mediastream/MediaDevices-getUserMedia.html: Updated to expect a rejected promise in lieu of an exception.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205953 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/mediastream/MediaDevices-getUserMedia-expected.txt
LayoutTests/fast/mediastream/MediaDevices-getUserMedia.html
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSDOMBinding.h
Source/WebCore/bindings/js/JSDOMPromise.h
Source/WebCore/bindings/js/JSMediaDevicesCustom.cpp
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
Source/WebCore/bindings/scripts/test/TestNode.idl

index 6f6a184..94e185d 100644 (file)
@@ -1,3 +1,13 @@
+2016-09-15  Youenn Fablet  <youenn@apple.com>
+
+        callPromiseFunction should be made usable for custom binding code
+        https://bugs.webkit.org/show_bug.cgi?id=161961
+
+        Reviewed by Darin Adler.
+
+        * fast/mediastream/MediaDevices-getUserMedia-expected.txt:
+        * fast/mediastream/MediaDevices-getUserMedia.html: Updated to expect a rejected promise in lieu of an exception.
+
 2016-09-14  Jiewen Tan  <jiewen_tan@apple.com>
 
         Unreviewed, update ios-simulator-wk1 test expectations after migrating to iOS 10
index 8b69051..309b542 100644 (file)
@@ -3,10 +3,10 @@ Tests getUserMedia (Promise-based version on navigator.mediaDevices)
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS navigator.mediaDevices.getUserMedia().then(invalidGotStream); threw exception TypeError: Not enough arguments.
 PASS typeof navigator.mediaDevices.webkitGetUserMedia is 'undefined'
 PASS navigator.mediaDevices.getUserMedia({audio:true}).then(gotStream1); did not throw exception.
-PASS  navigator.mediaDevices.getUserMedia({}) rejected with error: TypeError: Type error
+PASS navigator.mediaDevices.getUserMedia() rejected with error: TypeError: Not enough arguments
+PASS navigator.mediaDevices.getUserMedia({}) rejected with error: TypeError: Type error
 PASS Stream generated.
 PASS stream.getAudioTracks().length is 1
 PASS stream.getVideoTracks().length is 0
index 0948af3..4991a91 100644 (file)
                 shouldNotThrow("navigator.mediaDevices.getUserMedia({video:true}).then(gotStream2);")
             }
 
-            shouldThrow("navigator.mediaDevices.getUserMedia().then(invalidGotStream);");
+            navigator.mediaDevices.getUserMedia().then(invalidGotStream, function(error) {
+                testPassed("navigator.mediaDevices.getUserMedia() rejected with error: " + error);
+            });
             navigator.mediaDevices.getUserMedia({}).then(invalidGotStream, function(error) {
-                testPassed(" navigator.mediaDevices.getUserMedia({}) rejected with error: " + error);
+                testPassed("navigator.mediaDevices.getUserMedia({}) rejected with error: " + error);
             });
             shouldBe("typeof navigator.mediaDevices.webkitGetUserMedia", "'undefined'");
             setUserMediaPermission(true);
index 7a24bf7..5cc1451 100644 (file)
@@ -1,3 +1,37 @@
+2016-09-15  Youenn Fablet  <youenn@apple.com>
+
+        callPromiseFunction should be made usable for custom binding code
+        https://bugs.webkit.org/show_bug.cgi?id=161961
+
+        Reviewed by Darin Adler.
+
+        Covered by updated test.
+
+        * bindings/js/JSDOMBinding.h:
+        (WebCore::castThisValue): Utility function to cast this value to a specific type.
+        * bindings/js/JSDOMPromise.h:
+        (WebCore::callPromiseFunction): Updated to take real promise function as a template parameter
+        for improved efficiency. Added workerMode template parameter.
+        (WebCore::bindingPromiseFunctionAdapter): Function signature adaptor.
+        * bindings/js/JSMediaDevicesCustom.cpp:
+        (WebCore::JSMediaDevicesGetUserMediaPromiseFunction):
+        (WebCore::JSMediaDevices::getUserMedia): Making use of callPromiseFunction to properly handle exceptions.
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateImplementation): Updated to use template parameter.
+        * bindings/scripts/test/JS/JSTestNode.cpp:
+        (WebCore::jsTestNodePrototypeFunctionTestWorkerPromise):
+        (WebCore::jsTestNodePrototypeFunctionTestWorkerPromisePromise):
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        (WebCore::jsTestObjPrototypeFunctionTestPromiseFunction):
+        (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgument):
+        (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithException):
+        (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgument):
+        (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1):
+        (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2):
+        (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunction):
+        (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionWithException):
+        * bindings/scripts/test/TestNode.idl: Adding Worker promise binding test.
+
 2016-09-14  Jiewen Tan  <jiewen_tan@apple.com>
 
         WebCrypto algorithms should be exposed via KeyAlgorithm dictionary
index 0f72a03..a870a71 100644 (file)
@@ -173,6 +173,8 @@ template<typename DOMClass, typename T> auto createWrapper(JSDOMGlobalObject*, R
 
 template<typename DOMClass> JSC::JSValue wrap(JSC::ExecState*, JSDOMGlobalObject*, DOMClass&);
 
+template<typename JSClass> JSClass& castThisValue(JSC::ExecState&);
+
 void addImpureProperty(const AtomicString&);
 
 const JSC::HashTable& getHashTableForGlobalData(JSC::VM&, const JSC::HashTable& staticTable);
@@ -529,6 +531,14 @@ template<typename DOMClass> inline JSC::JSValue wrap(JSC::ExecState* state, JSDO
     return toJSNewlyCreated(state, globalObject, Ref<DOMClass>(domObject));
 }
 
+template<typename JSClass> inline JSClass& castThisValue(JSC::ExecState& state)
+{
+    auto thisValue = state.thisValue();
+    auto castedThis = JSC::jsDynamicCast<JSClass*>(thisValue);
+    ASSERT(castedThis);
+    return *castedThis;
+}
+
 inline int32_t finiteInt32Value(JSC::JSValue value, JSC::ExecState* exec, bool& okay)
 {
     double number = value.toNumber(exec);
index 54d68c7..2e29172 100644 (file)
@@ -157,7 +157,12 @@ void fulfillPromiseWithArrayBuffer(Ref<DeferredWrapper>&&, ArrayBuffer*);
 void fulfillPromiseWithArrayBuffer(Ref<DeferredWrapper>&&, const void*, size_t);
 void rejectPromiseWithExceptionIfAny(JSC::ExecState&, JSDOMGlobalObject&, JSC::JSPromiseDeferred&);
 
-inline JSC::JSValue callPromiseFunction(JSC::ExecState& state, JSC::EncodedJSValue promiseFunction(JSC::ExecState*, Ref<DeferredWrapper>&&))
+using PromiseFunction = void(JSC::ExecState&, Ref<DeferredWrapper>&&);
+
+enum class PromiseExecutionScope { WindowOnly, WindowOrWorker };
+
+template<PromiseFunction promiseFunction, PromiseExecutionScope executionScope>
+inline JSC::JSValue callPromiseFunction(JSC::ExecState& state)
 {
     JSC::VM& vm = state.vm();
     auto scope = DECLARE_CATCH_SCOPE(vm);
@@ -166,16 +171,29 @@ inline JSC::JSValue callPromiseFunction(JSC::ExecState& state, JSC::EncodedJSVal
     JSC::JSPromiseDeferred* promiseDeferred = JSC::JSPromiseDeferred::create(&state, &globalObject);
 
     // promiseDeferred can be null when terminating a Worker abruptly.
-    if (!promiseDeferred)
+    if (executionScope == PromiseExecutionScope::WindowOrWorker && !promiseDeferred)
         return JSC::jsUndefined();
 
-    promiseFunction(&state, DeferredWrapper::create(&state, &globalObject, promiseDeferred));
+    promiseFunction(state, DeferredWrapper::create(&state, &globalObject, promiseDeferred));
 
     rejectPromiseWithExceptionIfAny(state, globalObject, *promiseDeferred);
     ASSERT_UNUSED(scope, !scope.exception());
     return promiseDeferred->promise();
 }
 
+using BindingPromiseFunction = JSC::EncodedJSValue(JSC::ExecState*, Ref<DeferredWrapper>&&);
+template<BindingPromiseFunction bindingFunction>
+inline void bindingPromiseFunctionAdapter(JSC::ExecState& state, Ref<DeferredWrapper>&& promise)
+{
+    bindingFunction(&state, WTFMove(promise));
+}
+
+template<BindingPromiseFunction bindingPromiseFunction, PromiseExecutionScope executionScope>
+inline JSC::JSValue callPromiseFunction(JSC::ExecState& state)
+{
+    return callPromiseFunction<bindingPromiseFunctionAdapter<bindingPromiseFunction>, executionScope>(state);
+}
+
 // At the moment, Value cannot be a Ref<T> or RefPtr<T>, it should be a DOM class.
 template <typename Value>
 class DOMPromise {
index 4ce613a..c31e94e 100644 (file)
@@ -340,13 +340,16 @@ void parseMediaConstraintsDictionary(const Dictionary& mediaTrackConstraints, Me
     }
 }
 
-JSValue JSMediaDevices::getUserMedia(ExecState& state)
+static void JSMediaDevicesGetUserMediaPromiseFunction(ExecState& state, Ref<DeferredWrapper>&& promise)
 {
     VM& vm = state.vm();
     auto scope = DECLARE_THROW_SCOPE(vm);
 
-    if (UNLIKELY(state.argumentCount() < 1))
-        return JSValue::decode(throwVMError(&state, scope, createNotEnoughArgumentsError(&state)));
+    if (UNLIKELY(state.argumentCount() < 1)) {
+        throwVMError(&state, scope, createNotEnoughArgumentsError(&state));
+        return;
+    }
+
     ExceptionCode ec = 0;
     auto constraintsDictionary = Dictionary(&state, state.uncheckedArgument(0));
 
@@ -374,10 +377,13 @@ JSValue JSMediaDevices::getUserMedia(ExecState& state)
 
     auto audioConstraints = MediaConstraintsImpl::create(WTFMove(mandatoryAudioConstraints), WTFMove(advancedAudioConstraints), areAudioConstraintsValid);
     auto videoConstraints = MediaConstraintsImpl::create(WTFMove(mandatoryVideoConstraints), WTFMove(advancedVideoConstraints), areVideoConstraintsValid);
-    JSC::JSPromiseDeferred* promiseDeferred = JSC::JSPromiseDeferred::create(&state, globalObject());
-    wrapped().getUserMedia(WTFMove(audioConstraints), WTFMove(videoConstraints), DeferredWrapper::create(&state, globalObject(), promiseDeferred), ec);
+    castThisValue<JSMediaDevices>(state).wrapped().getUserMedia(WTFMove(audioConstraints), WTFMove(videoConstraints), WTFMove(promise), ec);
     setDOMException(&state, ec);
-    return promiseDeferred->promise();
+}
+
+JSValue JSMediaDevices::getUserMedia(ExecState& state)
+{
+    return callPromiseFunction<JSMediaDevicesGetUserMediaPromiseFunction, PromiseExecutionScope::WindowOnly>(state);
 }
 
 }
index cd018c2..3b3a516 100644 (file)
@@ -3421,14 +3421,17 @@ sub GenerateImplementation
             if (IsReturningPromise($function) && !$isCustom) {
                 AddToImplIncludes("JSDOMPromise.h");
 
+                my $scope = $interface->extendedAttributes->{"Exposed"} ? "WindowOrWorker" : "WindowOnly";
                 push(@implContent, <<END);
 static EncodedJSValue ${functionName}Promise(ExecState*, Ref<DeferredWrapper>&&);
+
 ${functionReturn} ${functionName}(ExecState* state)
 {
-    return JSValue::encode(callPromiseFunction(*state, ${functionName}Promise));
+    ASSERT(state);
+    return JSValue::encode(callPromiseFunction<${functionName}Promise, PromiseExecutionScope::${scope}>(*state));
 }
 
-static inline EncodedJSValue ${functionName}Promise(ExecState* state, Ref<DeferredWrapper>&&  deferredWrapper)
+static inline EncodedJSValue ${functionName}Promise(ExecState* state, Ref<DeferredWrapper>&& deferredWrapper)
 END
             }
             else {
index 4fda740..7540b41 100644 (file)
@@ -25,6 +25,7 @@
 #include "JSDOMBinding.h"
 #include "JSDOMConstructor.h"
 #include "JSDOMIterator.h"
+#include "JSDOMPromise.h"
 #include "RuntimeEnabledFeatures.h"
 #include "URL.h"
 #include <runtime/Error.h>
@@ -37,6 +38,7 @@ namespace WebCore {
 
 // Functions
 
+JSC::EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionTestWorkerPromise(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionSymbolIterator(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionEntries(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionKeys(JSC::ExecState*);
@@ -108,6 +110,7 @@ static const HashTableValue JSTestNodePrototypeTableValues[] =
 {
     { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestNodeConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestNodeConstructor) } },
     { "name", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestNodeName), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestNodeName) } },
+    { "testWorkerPromise", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestNodePrototypeFunctionTestWorkerPromise), (intptr_t) (0) } },
     { "entries", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestNodePrototypeFunctionEntries), (intptr_t) (0) } },
     { "keys", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestNodePrototypeFunctionKeys), (intptr_t) (0) } },
     { "values", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestNodePrototypeFunctionValues), (intptr_t) (0) } },
@@ -228,6 +231,28 @@ JSValue JSTestNode::getConstructor(VM& vm, const JSGlobalObject* globalObject)
     return getDOMConstructor<JSTestNodeConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
 }
 
+static EncodedJSValue jsTestNodePrototypeFunctionTestWorkerPromisePromise(ExecState*, Ref<DeferredWrapper>&&);
+EncodedJSValue JSC_HOST_CALL jsTestNodePrototypeFunctionTestWorkerPromise(ExecState* state)
+{
+    ASSERT(state);
+    return JSValue::encode(callPromiseFunction<jsTestNodePrototypeFunctionTestWorkerPromisePromise, true>(*state));
+}
+
+static inline EncodedJSValue jsTestNodePrototypeFunctionTestWorkerPromisePromise(ExecState* state, Ref<DeferredWrapper>&&  deferredWrapper)
+{
+    VM& vm = state->vm();
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    UNUSED_PARAM(throwScope);
+    JSValue thisValue = state->thisValue();
+    auto castedThis = jsDynamicCast<JSTestNode*>(thisValue);
+    if (UNLIKELY(!castedThis))
+        return throwThisTypeError(*state, throwScope, "TestNode", "testWorkerPromise");
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestNode::info());
+    auto& impl = castedThis->wrapped();
+    impl.testWorkerPromise(WTFMove(deferredWrapper));
+    return JSValue::encode(jsUndefined());
+}
+
 using TestNodeIterator = JSDOMIterator<JSTestNode>;
 using TestNodeIteratorPrototype = JSDOMIteratorPrototype<JSTestNode>;
 
index 6dbadec..d5dd669 100644 (file)
@@ -7160,7 +7160,8 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAny(ExecState* state)
 static EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionPromise(ExecState*, Ref<DeferredWrapper>&&);
 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionTestPromiseFunction(ExecState* state)
 {
-    return JSValue::encode(callPromiseFunction(*state, jsTestObjPrototypeFunctionTestPromiseFunctionPromise));
+    ASSERT(state);
+    return JSValue::encode(callPromiseFunction<jsTestObjPrototypeFunctionTestPromiseFunctionPromise, false>(*state));
 }
 
 static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionPromise(ExecState* state, Ref<DeferredWrapper>&&  deferredWrapper)
@@ -7181,7 +7182,8 @@ static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionPromis
 static EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise(ExecState*, Ref<DeferredWrapper>&&);
 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgument(ExecState* state)
 {
-    return JSValue::encode(callPromiseFunction(*state, jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise));
+    ASSERT(state);
+    return JSValue::encode(callPromiseFunction<jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise, false>(*state));
 }
 
 static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise(ExecState* state, Ref<DeferredWrapper>&&  deferredWrapper)
@@ -7207,7 +7209,8 @@ static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionWithFl
 static EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionWithExceptionPromise(ExecState*, Ref<DeferredWrapper>&&);
 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionTestPromiseFunctionWithException(ExecState* state)
 {
-    return JSValue::encode(callPromiseFunction(*state, jsTestObjPrototypeFunctionTestPromiseFunctionWithExceptionPromise));
+    ASSERT(state);
+    return JSValue::encode(callPromiseFunction<jsTestObjPrototypeFunctionTestPromiseFunctionWithExceptionPromise, false>(*state));
 }
 
 static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionWithExceptionPromise(ExecState* state, Ref<DeferredWrapper>&&  deferredWrapper)
@@ -7230,7 +7233,8 @@ static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionWithEx
 static EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentPromise(ExecState*, Ref<DeferredWrapper>&&);
 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgument(ExecState* state)
 {
-    return JSValue::encode(callPromiseFunction(*state, jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentPromise));
+    ASSERT(state);
+    return JSValue::encode(callPromiseFunction<jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentPromise, false>(*state));
 }
 
 static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentPromise(ExecState* state, Ref<DeferredWrapper>&&  deferredWrapper)
@@ -7254,7 +7258,8 @@ static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseFunctionWithOp
 static EncodedJSValue jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise(ExecState*, Ref<DeferredWrapper>&&);
 static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1(ExecState* state)
 {
-    return JSValue::encode(callPromiseFunction(*state, jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise));
+    ASSERT(state);
+    return JSValue::encode(callPromiseFunction<jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise, false>(*state));
 }
 
 static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise(ExecState* state, Ref<DeferredWrapper>&&  deferredWrapper)
@@ -7280,7 +7285,8 @@ static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseOverloadedFunc
 static EncodedJSValue jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise(ExecState*, Ref<DeferredWrapper>&&);
 static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2(ExecState* state)
 {
-    return JSValue::encode(callPromiseFunction(*state, jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise));
+    ASSERT(state);
+    return JSValue::encode(callPromiseFunction<jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise, false>(*state));
 }
 
 static inline EncodedJSValue jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise(ExecState* state, Ref<DeferredWrapper>&&  deferredWrapper)
@@ -7323,7 +7329,8 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionTestPromiseOverloadedFunc
 static EncodedJSValue jsTestObjConstructorFunctionTestStaticPromiseFunctionPromise(ExecState*, Ref<DeferredWrapper>&&);
 EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionTestStaticPromiseFunction(ExecState* state)
 {
-    return JSValue::encode(callPromiseFunction(*state, jsTestObjConstructorFunctionTestStaticPromiseFunctionPromise));
+    ASSERT(state);
+    return JSValue::encode(callPromiseFunction<jsTestObjConstructorFunctionTestStaticPromiseFunctionPromise, false>(*state));
 }
 
 static inline EncodedJSValue jsTestObjConstructorFunctionTestStaticPromiseFunctionPromise(ExecState* state, Ref<DeferredWrapper>&&  deferredWrapper)
@@ -7338,7 +7345,8 @@ static inline EncodedJSValue jsTestObjConstructorFunctionTestStaticPromiseFuncti
 static EncodedJSValue jsTestObjConstructorFunctionTestStaticPromiseFunctionWithExceptionPromise(ExecState*, Ref<DeferredWrapper>&&);
 EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionTestStaticPromiseFunctionWithException(ExecState* state)
 {
-    return JSValue::encode(callPromiseFunction(*state, jsTestObjConstructorFunctionTestStaticPromiseFunctionWithExceptionPromise));
+    ASSERT(state);
+    return JSValue::encode(callPromiseFunction<jsTestObjConstructorFunctionTestStaticPromiseFunctionWithExceptionPromise, false>(*state));
 }
 
 static inline EncodedJSValue jsTestObjConstructorFunctionTestStaticPromiseFunctionWithExceptionPromise(ExecState* state, Ref<DeferredWrapper>&&  deferredWrapper)
index 8dc0e49..44f8ca8 100644 (file)
 [
     Constructor,
     ExportMacro=WEBCORE_TESTSUPPORT_EXPORT,
+    Exposed=(Window,Worker)
 ] interface TestNode : Node {
     attribute DOMString name;
 
     [EnabledAtRuntime=DOMIterator] iterable<TestNode>;
+    Promise testWorkerPromise();
 };
-