WebKit Bugzilla
Attachment 362134 Details for
Bug 194713
: Add binding tests for ContextAllowsMediaDevices and ContextHasServiceWorkerScheme
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-194713-20190215112059.patch (text/plain), 9.25 KB, created by
youenn fablet
on 2019-02-15 11:20:59 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
youenn fablet
Created:
2019-02-15 11:20:59 PST
Size:
9.25 KB
patch
obsolete
>Subversion Revision: 241548 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 74bff51a7a65845147a07e8597414c35c6cde09f..644b798d8c106070209959b0babaf0eb317a692b 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,24 @@ >+2019-02-15 Youenn Fablet <youenn@apple.com> >+ >+ Add binding tests for ContextAllowsMediaDevices and ContextHasServiceWorkerScheme >+ https://bugs.webkit.org/show_bug.cgi?id=194713 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Binding tests covering mediaDevices and serviceWorker attributes. >+ >+ * bindings/scripts/test/JS/JSTestObj.cpp: >+ (WebCore::JSTestObjPrototype::finishCreation): >+ (WebCore::jsTestObjMediaDevices1Getter): >+ (WebCore::jsTestObjMediaDevices1): >+ (WebCore::jsTestObjMediaDevices2Getter): >+ (WebCore::jsTestObjMediaDevices2): >+ (WebCore::jsTestObjServiceWorkers1Getter): >+ (WebCore::jsTestObjServiceWorkers1): >+ (WebCore::jsTestObjServiceWorkers2Getter): >+ (WebCore::jsTestObjServiceWorkers2): >+ * bindings/scripts/test/TestObj.idl: >+ > 2019-02-14 Youenn Fablet <youenn@apple.com> > > Make ServiceWorkerClientFetch closer to WebResourceLoader >diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp >index eae2f29e5fb5c8fc6f38bfbb2050055c6ef7c344..5df73bf451507f20d916fd11cf9203af9140fc42 100644 >--- a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp >+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp >@@ -61,9 +61,11 @@ > #include "JSElement.h" > #include "JSEventListener.h" > #include "JSFetchRequest.h" >+#include "JSMediaDevices.h" > #include "JSNode.h" > #include "JSSVGDocument.h" > #include "JSSVGPoint.h" >+#include "JSServiceWorker.h" > #include "JSTestCallbackFunction.h" > #include "JSTestCallbackInterface.h" > #include "JSTestInterface.h" >@@ -1659,6 +1661,8 @@ JSC::EncodedJSValue jsTestObjAnnotatedTypeInSequenceAttr(JSC::ExecState*, JSC::E > bool setJSTestObjAnnotatedTypeInSequenceAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); > JSC::EncodedJSValue jsTestObjImplementationEnumAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); > bool setJSTestObjImplementationEnumAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); >+JSC::EncodedJSValue jsTestObjMediaDevices(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); >+JSC::EncodedJSValue jsTestObjServiceWorkers(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); > JSC::EncodedJSValue jsTestObjXMLObjAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); > bool setJSTestObjXMLObjAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); > JSC::EncodedJSValue jsTestObjCreate(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); >@@ -2021,6 +2025,8 @@ static const HashTableValue JSTestObjPrototypeTableValues[] = > { "annotatedTypeInUnionAttr", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAnnotatedTypeInUnionAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjAnnotatedTypeInUnionAttr) } }, > { "annotatedTypeInSequenceAttr", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAnnotatedTypeInSequenceAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjAnnotatedTypeInSequenceAttr) } }, > { "implementationEnumAttr", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjImplementationEnumAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjImplementationEnumAttr) } }, >+ { "mediaDevices", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjMediaDevices), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, >+ { "serviceWorkers", static_cast<unsigned>(JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjServiceWorkers), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } }, > { "XMLObjAttr", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjXMLObjAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjXMLObjAttr) } }, > { "create", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCreate), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjCreate) } }, > { "reflectedStringAttr", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedStringAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjReflectedStringAttr) } }, >@@ -2377,6 +2383,18 @@ void JSTestObjPrototype::finishCreation(VM& vm) > VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable); > JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName); > } >+ if (!(jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext()->isSecureContext()|| jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext()->allowsMediaDevices())) { >+ hasDisabledRuntimeProperties = true; >+ auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("mediaDevices"), strlen("mediaDevices")); >+ VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable); >+ JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName); >+ } >+ if (!(jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext()->isSecureContext()|| jsCast<JSDOMGlobalObject*>(globalObject())->scriptExecutionContext()->hasServiceWorkerScheme())) { >+ hasDisabledRuntimeProperties = true; >+ auto propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>("serviceWorkers"), strlen("serviceWorkers")); >+ VM::DeletePropertyModeScope scope(vm, VM::DeletePropertyMode::IgnoreConfigurable); >+ JSObject::deleteProperty(this, globalObject()->globalExec(), propertyName); >+ } > #if ENABLE(TEST_FEATURE) > if (!(RuntimeEnabledFeatures::sharedFeatures().testFeatureEnabled() && RuntimeEnabledFeatures::sharedFeatures().testFeature1Enabled())) { > hasDisabledRuntimeProperties = true; >@@ -3579,6 +3597,34 @@ bool setJSTestObjImplementationEnumAttr(ExecState* state, EncodedJSValue thisVal > return IDLAttribute<JSTestObj>::set<setJSTestObjImplementationEnumAttrSetter>(*state, thisValue, encodedValue, "implementationEnumAttr"); > } > >+static inline JSValue jsTestObjMediaDevicesGetter(ExecState& state, JSTestObj& thisObject, ThrowScope& throwScope) >+{ >+ UNUSED_PARAM(throwScope); >+ UNUSED_PARAM(state); >+ auto& impl = thisObject.wrapped(); >+ JSValue result = toJS<IDLInterface<MediaDevices>>(state, *thisObject.globalObject(), throwScope, impl.mediaDevices()); >+ return result; >+} >+ >+EncodedJSValue jsTestObjMediaDevices(ExecState* state, EncodedJSValue thisValue, PropertyName) >+{ >+ return IDLAttribute<JSTestObj>::get<jsTestObjMediaDevicesGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "mediaDevices"); >+} >+ >+static inline JSValue jsTestObjServiceWorkersGetter(ExecState& state, JSTestObj& thisObject, ThrowScope& throwScope) >+{ >+ UNUSED_PARAM(throwScope); >+ UNUSED_PARAM(state); >+ auto& impl = thisObject.wrapped(); >+ JSValue result = toJS<IDLInterface<ServiceWorker>>(state, *thisObject.globalObject(), throwScope, impl.serviceWorkers()); >+ return result; >+} >+ >+EncodedJSValue jsTestObjServiceWorkers(ExecState* state, EncodedJSValue thisValue, PropertyName) >+{ >+ return IDLAttribute<JSTestObj>::get<jsTestObjServiceWorkersGetter, CastedThisErrorBehavior::Assert>(*state, thisValue, "serviceWorkers"); >+} >+ > static inline JSValue jsTestObjXMLObjAttrGetter(ExecState& state, JSTestObj& thisObject, ThrowScope& throwScope) > { > UNUSED_PARAM(throwScope); >diff --git a/Source/WebCore/bindings/scripts/test/TestObj.idl b/Source/WebCore/bindings/scripts/test/TestObj.idl >index b77e953617a8ef2ccfb56aa2194baa7a2fb0da61..2771752214c9e65ae1de06c0d580ddffdb208205 100644 >--- a/Source/WebCore/bindings/scripts/test/TestObj.idl >+++ b/Source/WebCore/bindings/scripts/test/TestObj.idl >@@ -90,6 +90,9 @@ enum TestConfidence { "high", "kinda-low" }; > > attribute TestEnumTypeWithAlternateImplementationName implementationEnumAttr; > >+ [SecureContext, ContextAllowsMediaDevices] readonly attribute MediaDevices mediaDevices; >+ [SecureContext, ContextHasServiceWorkerScheme] readonly attribute ServiceWorker serviceWorkers; >+ > // WK_ucfirst, WK_lcfirst exceptional cases. > attribute TestObj XMLObjAttr; > attribute boolean create;
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 194713
:
362133
| 362134