WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Adding binding test
bug-161961-20160914173553.patch (text/plain), 22.26 KB, created by
youenn fablet
on 2016-09-14 08:38:31 PDT
(
hide
)
Description:
Adding binding test
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2016-09-14 08:38:31 PDT
Size:
22.26 KB
patch
obsolete
>Subversion Revision: 205901 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index feb8f31edfa01759b898fc95dae5aa5b41f5472e..b853587cb4a254b7b653c5ecd1eccdcff7f00bf9 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,37 @@ >+2016-09-14 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 NOBODY (OOPS!). >+ >+ 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-13 Chris Dumez <cdumez@apple.com> > > Unreviewed, rolling out r205887. >diff --git a/Source/WebCore/bindings/js/JSDOMBinding.h b/Source/WebCore/bindings/js/JSDOMBinding.h >index 0f72a0332b8a23928bd50ab431e3bed320800098..a870a71fc6bf0305229af240805dfc5d0e2016b1 100644 >--- a/Source/WebCore/bindings/js/JSDOMBinding.h >+++ b/Source/WebCore/bindings/js/JSDOMBinding.h >@@ -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); >diff --git a/Source/WebCore/bindings/js/JSDOMPromise.h b/Source/WebCore/bindings/js/JSDOMPromise.h >index 54d68c7f4694e0c7f4974a3acfbe6b0dbd857f2a..7a82ec7cb5b60b264fbbd7f8a54f41e4a1696842 100644 >--- a/Source/WebCore/bindings/js/JSDOMPromise.h >+++ b/Source/WebCore/bindings/js/JSDOMPromise.h >@@ -157,7 +157,10 @@ 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>&&); >+ >+template<PromiseFunction promiseFunction, bool canBeCalledInWorker = false> >+inline JSC::JSValue callPromiseFunction(JSC::ExecState& state) > { > JSC::VM& vm = state.vm(); > auto scope = DECLARE_CATCH_SCOPE(vm); >@@ -166,16 +169,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 (canBeCalledInWorker && !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, bool canBeCalledInWorker> >+inline JSC::JSValue callPromiseFunction(JSC::ExecState& state) >+{ >+ return callPromiseFunction<bindingPromiseFunctionAdapter<bindingPromiseFunction>, canBeCalledInWorker>(state); >+} >+ > // At the moment, Value cannot be a Ref<T> or RefPtr<T>, it should be a DOM class. > template <typename Value> > class DOMPromise { >diff --git a/Source/WebCore/bindings/js/JSMediaDevicesCustom.cpp b/Source/WebCore/bindings/js/JSMediaDevicesCustom.cpp >index 4ce613ae13a95cdfda5461462127f8c05081e7ef..d1433c653154d6f386695ef53cbee434a8982cc0 100644 >--- a/Source/WebCore/bindings/js/JSMediaDevicesCustom.cpp >+++ b/Source/WebCore/bindings/js/JSMediaDevicesCustom.cpp >@@ -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, false>(state); > } > > } >diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm >index ddd650dfe94018e82a317054a23a1e404c37bf77..30295de379e39d9a04984320be6c584bc0b5fcb4 100644 >--- a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm >+++ b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm >@@ -3408,11 +3408,13 @@ sub GenerateImplementation > if (IsReturningPromise($function) && !$isCustom) { > AddToImplIncludes("JSDOMPromise.h"); > >+ my $canBeCalledInWorker = $interface->extendedAttributes->{"Exposed"} ? "true" : "false"; > 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, $canBeCalledInWorker>(*state)); > } > > static inline EncodedJSValue ${functionName}Promise(ExecState* state, Ref<DeferredWrapper>&& deferredWrapper) >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp >index 4fda740f8f52efc43c233b6387c99dee125460f7..7540b4105c8d1f8cbaeda762bdb5ad88578dd5a7 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp >@@ -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>; > >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp >index 6dbadecdc1496b06c7cdf1fe213c1d2291a8826b..d5dd6696e13de730e01cf7d171a83adb1e0521ac 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp >@@ -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) >diff --git a/Source/WebCore/bindings/scripts/test/TestNode.idl b/Source/WebCore/bindings/scripts/test/TestNode.idl >index 8dc0e49f6cd479752c9dc22a94559082306b12de..44f8ca8273e78ff1d53a1f9ec5f1fe53eb968bde 100644 >--- a/Source/WebCore/bindings/scripts/test/TestNode.idl >+++ b/Source/WebCore/bindings/scripts/test/TestNode.idl >@@ -21,9 +21,10 @@ > [ > Constructor, > ExportMacro=WEBCORE_TESTSUPPORT_EXPORT, >+ Exposed=(Window,Worker) > ] interface TestNode : Node { > attribute DOMString name; > > [EnabledAtRuntime=DOMIterator] iterable<TestNode>; >+ Promise testWorkerPromise(); > }; >- >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 8ce76df68790683544e958b0e0ff679d250e6bf4..1335946aa17cfcd0404ffe7b53b65076e6413a79 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,13 @@ >+2016-09-14 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 NOBODY (OOPS!). >+ >+ * fast/mediastream/MediaDevices-getUserMedia-expected.txt: >+ * fast/mediastream/MediaDevices-getUserMedia.html: Updated to expect a rejected promise in lieu of an exception. >+ > 2016-09-13 Ryan Haddad <ryanhaddad@apple.com> > > Marking imported/w3c/web-platform-tests/XMLHttpRequest/response-method.htm as failing on ios-simulator. >diff --git a/LayoutTests/fast/mediastream/MediaDevices-getUserMedia-expected.txt b/LayoutTests/fast/mediastream/MediaDevices-getUserMedia-expected.txt >index 8b690513fe4fa31906c51ad55a17099a53e48c6d..738825cd2cdfafd5cec5b9609258131a00fb3e9e 100644 >--- a/LayoutTests/fast/mediastream/MediaDevices-getUserMedia-expected.txt >+++ b/LayoutTests/fast/mediastream/MediaDevices-getUserMedia-expected.txt >@@ -3,9 +3,9 @@ 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: Not enough arguments > PASS navigator.mediaDevices.getUserMedia({}) rejected with error: TypeError: Type error > PASS Stream generated. > PASS stream.getAudioTracks().length is 1 >diff --git a/LayoutTests/fast/mediastream/MediaDevices-getUserMedia.html b/LayoutTests/fast/mediastream/MediaDevices-getUserMedia.html >index 0948af3243a46559fb3b8fca6046d2865474b3e1..eff540ff17c9434bbe0262bc15cde8dfb2e9c8ce 100644 >--- a/LayoutTests/fast/mediastream/MediaDevices-getUserMedia.html >+++ b/LayoutTests/fast/mediastream/MediaDevices-getUserMedia.html >@@ -136,7 +136,9 @@ > 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); > });
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 161961
:
288812
|
288817
|
288933