Source/WebCore/ChangeLog

 12016-10-12 Rawinder Singh <rawinder.singh-webkit@cisra.canon.com.au>
 2
 3 [WebIDL] Add support to bindings generator for half-open dictionaries
 4 https://bugs.webkit.org/show_bug.cgi?id=163381
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Add convertDictionaryProperties and generate binding code to perform processing for
 9 WebKit IDL extended dictionary attribute "OpenPropertyType".
 10
 11 * bindings/js/JSDOMConvert.h:
 12 (WebCore::Detail::addResultIfValid):
 13 (WebCore::Detail::ArrayConverter::convert):
 14 (WebCore::convertDictionaryProperties):
 15 * bindings/scripts/CodeGeneratorJS.pm:
 16 (GenerateDictionaryImplementationContent):
 17 * bindings/scripts/IDLParser.pm:
 18 (parseExtendedAttributeRest):
 19 * bindings/scripts/test/JS/JSTestDictionaryOpenPropertyType.cpp: Added.
 20 (WebCore::convertDictionary<TestDictionaryOpenPropertyType::Dictionary1>):
 21 (WebCore::JSTestDictionaryOpenPropertyTypePrototype::create):
 22 (WebCore::JSTestDictionaryOpenPropertyTypePrototype::createStructure):
 23 (WebCore::JSTestDictionaryOpenPropertyTypePrototype::JSTestDictionaryOpenPropertyTypePrototype):
 24 (WebCore::JSTestDictionaryOpenPropertyTypeConstructor::construct):
 25 (WebCore::JSTestDictionaryOpenPropertyTypeConstructor::prototypeForStructure):
 26 (WebCore::JSTestDictionaryOpenPropertyTypeConstructor::initializeProperties):
 27 (WebCore::JSTestDictionaryOpenPropertyTypePrototype::finishCreation):
 28 (WebCore::JSTestDictionaryOpenPropertyType::JSTestDictionaryOpenPropertyType):
 29 (WebCore::JSTestDictionaryOpenPropertyType::createPrototype):
 30 (WebCore::JSTestDictionaryOpenPropertyType::prototype):
 31 (WebCore::JSTestDictionaryOpenPropertyType::destroy):
 32 (WebCore::jsTestDictionaryOpenPropertyTypeConstructor):
 33 (WebCore::setJSTestDictionaryOpenPropertyTypeConstructor):
 34 (WebCore::JSTestDictionaryOpenPropertyType::getConstructor):
 35 (WebCore::JSTestDictionaryOpenPropertyTypeOwner::isReachableFromOpaqueRoots):
 36 (WebCore::JSTestDictionaryOpenPropertyTypeOwner::finalize):
 37 (WebCore::toJSNewlyCreated):
 38 (WebCore::toJS):
 39 (WebCore::JSTestDictionaryOpenPropertyType::toWrapped):
 40 * bindings/scripts/test/JS/JSTestDictionaryOpenPropertyType.h: Added.
 41 (WebCore::JSTestDictionaryOpenPropertyType::create):
 42 (WebCore::JSTestDictionaryOpenPropertyType::createStructure):
 43 (WebCore::JSTestDictionaryOpenPropertyType::finishCreation):
 44 (WebCore::wrapperOwner):
 45 (WebCore::wrapperKey):
 46 (WebCore::toJS):
 47 (WebCore::toJSNewlyCreated):
 48 * bindings/scripts/test/TestDictionaryOpenPropertyType.idl: Added.
 49
1502016-10-12 Chris Dumez <cdumez@apple.com>
251
352 Update HTMLSelectElement::recalcListItems() to ignore nested optgroup elements

Source/WebCore/bindings/js/JSDOMConvert.h

@@namespace Detail {
335335 using ReturnType = Vector<RefPtr<T>>;
336336 };
337337
 338 // Check if input is optional and add to the result (so that we can handle it differently).
 339 template<typename ReturnType, typename T> bool addResultIfValid(ReturnType &result, T& value)
 340 {
 341 result.append(WTFMove(value));
 342 return true;
 343 }
 344
 345 template<typename ReturnType, typename T> bool addResultIfValid(ReturnType &result, WTF::Optional<T> &value)
 346 {
 347 if (value) {
 348 result.append(WTFMove(*value));
 349 return true;
 350 }
 351 return false;
 352 }
 353
338354 template<typename IDLType>
339355 struct ArrayConverter : ArrayConverterBase<IDLType> {
340356 using ReturnType = typename ArrayConverterBase<IDLType>::ReturnType;

@@namespace Detail {
356372 auto convertedValue = Converter<IDLType>::convert(*state, jsValue);
357373 if (UNLIKELY(scope.exception()))
358374 return;
359  result.append(WTFMove(convertedValue));
 375 if (!addResultIfValid(result, convertedValue))
 376 return;
360377 });
361378 return result;
362379 }

@@template<typename IDLType> typename Detail::VariadicConverter<IDLType>::Result c
618635 return { length, WTFMove(result) };
619636}
620637
 638template<typename IDLType> HashMap<String, typename IDLType::ImplementationType> convertDictionaryProperties(JSC::ExecState& state, JSC::JSObject& object)
 639{
 640 HashMap<String, typename IDLType::ImplementationType> result;
 641
 642 JSC::PropertyNameArray propertyNames(&state, JSC::PropertyNameMode::Strings);
 643 JSC::JSObject::getOwnPropertyNames(&object, &state, propertyNames, JSC::EnumerationMode());
 644
 645 for (auto& propertyName : propertyNames) {
 646 JSC::JSValue jsValue = object.get(&state, propertyName);
 647 auto value = Converter<IDLType>::convert(state, jsValue);
 648 result.add(propertyName.string(), value);
 649 }
 650
 651 return result;
 652}
 653
621654} // namespace WebCore

Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

@@sub GenerateDictionaryImplementationContent
11511151 }
11521152 }
11531153
 1154 # 6. Process WebKit extended IDL attribute (OpenPropertyType) for half-open dictionary:
 1155 my $idlOpenPropertyType = $dictionary->extendedAttributes->{"OpenPropertyType"};
 1156 if ($idlOpenPropertyType) {
 1157 $implIncludes{"JSDOMConvert.h"} = 1;
 1158 my $openPropertyType = GetIDLType($dictionary, $idlOpenPropertyType);
 1159 $result .= " result.properties = convertDictionaryProperties<${openPropertyType}>(state, *object);\n";
 1160 $result .= " RETURN_IF_EXCEPTION(throwScope, Nullopt);\n";
 1161 }
 1162
11541163 $result .= " return WTFMove(result);\n";
11551164 $result .= "}\n\n";
11561165 $result .= "#endif\n\n" if $conditionalString;

Source/WebCore/bindings/scripts/IDLParser.pm

@@sub parseExtendedAttributeRest
18001800 $self->assertTokenValue($self->getToken(), ")", __LINE__);
18011801 return $attrs;
18021802 }
 1803 # Perform processing for special case WebKit IDL extended dictionary attribute "OpenPropertyType":
 1804 if ($next->value() eq "=" && $name eq "OpenPropertyType") {
 1805 $self->assertTokenValue($self->getToken(), "=", __LINE__);
 1806 $attrs->{$name} = $self->parseType();
 1807 return $attrs;
 1808 }
18031809 if ($next->value() eq "=") {
18041810 $self->assertTokenValue($self->getToken(), "=", __LINE__);
18051811 $attrs->{$name} = $self->parseExtendedAttributeRest2();

Source/WebCore/bindings/scripts/test/JS/JSTestDictionaryOpenPropertyType.cpp

 1/*
 2 This file is part of the WebKit open source project.
 3 This file has been generated by generate-bindings.pl. DO NOT MODIFY!
 4
 5 This library is free software; you can redistribute it and/or
 6 modify it under the terms of the GNU Library General Public
 7 License as published by the Free Software Foundation; either
 8 version 2 of the License, or (at your option) any later version.
 9
 10 This library is distributed in the hope that it will be useful,
 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 13 Library General Public License for more details.
 14
 15 You should have received a copy of the GNU Library General Public License
 16 along with this library; see the file COPYING.LIB. If not, write to
 17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 18 Boston, MA 02110-1301, USA.
 19*/
 20
 21#include "config.h"
 22#include "JSTestDictionaryOpenPropertyType.h"
 23
 24#include "ExceptionCode.h"
 25#include "JSDOMBinding.h"
 26#include "JSDOMConstructor.h"
 27#include <runtime/Error.h>
 28#include <runtime/FunctionPrototype.h>
 29#include <wtf/GetPtr.h>
 30
 31using namespace JSC;
 32
 33namespace WebCore {
 34
 35template<> Optional<TestDictionaryOpenPropertyType::Dictionary1> convertDictionary<TestDictionaryOpenPropertyType::Dictionary1>(ExecState& state, JSValue value)
 36{
 37 VM& vm = state.vm();
 38 auto throwScope = DECLARE_THROW_SCOPE(vm);
 39 bool isNullOrUndefined = value.isUndefinedOrNull();
 40 auto* object = isNullOrUndefined ? nullptr : value.getObject();
 41 if (UNLIKELY(!isNullOrUndefined && !object)) {
 42 throwTypeError(&state, throwScope);
 43 return Nullopt;
 44 }
 45 if (UNLIKELY(object && object->type() == RegExpObjectType)) {
 46 throwTypeError(&state, throwScope);
 47 return Nullopt;
 48 }
 49 TestDictionaryOpenPropertyType::Dictionary1 result;
 50 result.properties = convertDictionaryProperties<IDLDOMString>(state, *object);
 51 RETURN_IF_EXCEPTION(throwScope, Nullopt);
 52 return WTFMove(result);
 53}
 54
 55// Attributes
 56
 57JSC::EncodedJSValue jsTestDictionaryOpenPropertyTypeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
 58bool setJSTestDictionaryOpenPropertyTypeConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
 59
 60class JSTestDictionaryOpenPropertyTypePrototype : public JSC::JSNonFinalObject {
 61public:
 62 using Base = JSC::JSNonFinalObject;
 63 static JSTestDictionaryOpenPropertyTypePrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
 64 {
 65 JSTestDictionaryOpenPropertyTypePrototype* ptr = new (NotNull, JSC::allocateCell<JSTestDictionaryOpenPropertyTypePrototype>(vm.heap)) JSTestDictionaryOpenPropertyTypePrototype(vm, globalObject, structure);
 66 ptr->finishCreation(vm);
 67 return ptr;
 68 }
 69
 70 DECLARE_INFO;
 71 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
 72 {
 73 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
 74 }
 75
 76private:
 77 JSTestDictionaryOpenPropertyTypePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
 78 : JSC::JSNonFinalObject(vm, structure)
 79 {
 80 }
 81
 82 void finishCreation(JSC::VM&);
 83};
 84
 85using JSTestDictionaryOpenPropertyTypeConstructor = JSDOMConstructor<JSTestDictionaryOpenPropertyType>;
 86
 87template<> EncodedJSValue JSC_HOST_CALL JSTestDictionaryOpenPropertyTypeConstructor::construct(ExecState* state)
 88{
 89 VM& vm = state->vm();
 90 auto throwScope = DECLARE_THROW_SCOPE(vm);
 91 UNUSED_PARAM(throwScope);
 92 auto* castedThis = jsCast<JSTestDictionaryOpenPropertyTypeConstructor*>(state->callee());
 93 ASSERT(castedThis);
 94 if (UNLIKELY(state->argumentCount() < 1))
 95 return throwVMError(state, throwScope, createNotEnoughArgumentsError(state));
 96 auto test1 = convert<IDLSequence<IDLDictionary<TestDictionaryOpenPropertyType::Dictionary1>>>(*state, state->uncheckedArgument(0));
 97 RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
 98 auto object = TestDictionaryOpenPropertyType::create(WTFMove(test1));
 99 return JSValue::encode(toJSNewlyCreated(state, castedThis->globalObject(), WTFMove(object)));
 100}
 101
 102template<> JSValue JSTestDictionaryOpenPropertyTypeConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
 103{
 104 UNUSED_PARAM(vm);
 105 return globalObject.functionPrototype();
 106}
 107
 108template<> void JSTestDictionaryOpenPropertyTypeConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
 109{
 110 putDirect(vm, vm.propertyNames->prototype, JSTestDictionaryOpenPropertyType::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum);
 111 putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("TestDictionaryOpenPropertyType"))), ReadOnly | DontEnum);
 112 putDirect(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontEnum);
 113}
 114
 115template<> const ClassInfo JSTestDictionaryOpenPropertyTypeConstructor::s_info = { "TestDictionaryOpenPropertyType", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestDictionaryOpenPropertyTypeConstructor) };
 116
 117/* Hash table for prototype */
 118
 119static const HashTableValue JSTestDictionaryOpenPropertyTypePrototypeTableValues[] =
 120{
 121 { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestDictionaryOpenPropertyTypeConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestDictionaryOpenPropertyTypeConstructor) } },
 122};
 123
 124const ClassInfo JSTestDictionaryOpenPropertyTypePrototype::s_info = { "TestDictionaryOpenPropertyTypePrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestDictionaryOpenPropertyTypePrototype) };
 125
 126void JSTestDictionaryOpenPropertyTypePrototype::finishCreation(VM& vm)
 127{
 128 Base::finishCreation(vm);
 129 reifyStaticProperties(vm, JSTestDictionaryOpenPropertyTypePrototypeTableValues, *this);
 130}
 131
 132const ClassInfo JSTestDictionaryOpenPropertyType::s_info = { "TestDictionaryOpenPropertyType", &Base::s_info, 0, CREATE_METHOD_TABLE(JSTestDictionaryOpenPropertyType) };
 133
 134JSTestDictionaryOpenPropertyType::JSTestDictionaryOpenPropertyType(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestDictionaryOpenPropertyType>&& impl)
 135 : JSDOMWrapper<TestDictionaryOpenPropertyType>(structure, globalObject, WTFMove(impl))
 136{
 137}
 138
 139JSObject* JSTestDictionaryOpenPropertyType::createPrototype(VM& vm, JSGlobalObject* globalObject)
 140{
 141 return JSTestDictionaryOpenPropertyTypePrototype::create(vm, globalObject, JSTestDictionaryOpenPropertyTypePrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
 142}
 143
 144JSObject* JSTestDictionaryOpenPropertyType::prototype(VM& vm, JSGlobalObject* globalObject)
 145{
 146 return getDOMPrototype<JSTestDictionaryOpenPropertyType>(vm, globalObject);
 147}
 148
 149void JSTestDictionaryOpenPropertyType::destroy(JSC::JSCell* cell)
 150{
 151 JSTestDictionaryOpenPropertyType* thisObject = static_cast<JSTestDictionaryOpenPropertyType*>(cell);
 152 thisObject->JSTestDictionaryOpenPropertyType::~JSTestDictionaryOpenPropertyType();
 153}
 154
 155EncodedJSValue jsTestDictionaryOpenPropertyTypeConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
 156{
 157 VM& vm = state->vm();
 158 auto throwScope = DECLARE_THROW_SCOPE(vm);
 159 JSTestDictionaryOpenPropertyTypePrototype* domObject = jsDynamicCast<JSTestDictionaryOpenPropertyTypePrototype*>(JSValue::decode(thisValue));
 160 if (UNLIKELY(!domObject))
 161 return throwVMTypeError(state, throwScope);
 162 return JSValue::encode(JSTestDictionaryOpenPropertyType::getConstructor(state->vm(), domObject->globalObject()));
 163}
 164
 165bool setJSTestDictionaryOpenPropertyTypeConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
 166{
 167 VM& vm = state->vm();
 168 auto throwScope = DECLARE_THROW_SCOPE(vm);
 169 JSValue value = JSValue::decode(encodedValue);
 170 JSTestDictionaryOpenPropertyTypePrototype* domObject = jsDynamicCast<JSTestDictionaryOpenPropertyTypePrototype*>(JSValue::decode(thisValue));
 171 if (UNLIKELY(!domObject)) {
 172 throwVMTypeError(state, throwScope);
 173 return false;
 174 }
 175 // Shadowing a built-in constructor
 176 return domObject->putDirect(state->vm(), state->propertyNames().constructor, value);
 177}
 178
 179JSValue JSTestDictionaryOpenPropertyType::getConstructor(VM& vm, const JSGlobalObject* globalObject)
 180{
 181 return getDOMConstructor<JSTestDictionaryOpenPropertyTypeConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
 182}
 183
 184bool JSTestDictionaryOpenPropertyTypeOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
 185{
 186 UNUSED_PARAM(handle);
 187 UNUSED_PARAM(visitor);
 188 return false;
 189}
 190
 191void JSTestDictionaryOpenPropertyTypeOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
 192{
 193 auto* jsTestDictionaryOpenPropertyType = jsCast<JSTestDictionaryOpenPropertyType*>(handle.slot()->asCell());
 194 auto& world = *static_cast<DOMWrapperWorld*>(context);
 195 uncacheWrapper(world, &jsTestDictionaryOpenPropertyType->wrapped(), jsTestDictionaryOpenPropertyType);
 196}
 197
 198#if ENABLE(BINDING_INTEGRITY)
 199#if PLATFORM(WIN)
 200#pragma warning(disable: 4483)
 201extern "C" { extern void (*const __identifier("??_7TestDictionaryOpenPropertyType@WebCore@@6B@")[])(); }
 202#else
 203extern "C" { extern void* _ZTVN7WebCore30TestDictionaryOpenPropertyTypeE[]; }
 204#endif
 205#endif
 206
 207JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<TestDictionaryOpenPropertyType>&& impl)
 208{
 209
 210#if ENABLE(BINDING_INTEGRITY)
 211 void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
 212#if PLATFORM(WIN)
 213 void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7TestDictionaryOpenPropertyType@WebCore@@6B@"));
 214#else
 215 void* expectedVTablePointer = &_ZTVN7WebCore30TestDictionaryOpenPropertyTypeE[2];
 216#if COMPILER(CLANG)
 217 // If this fails TestDictionaryOpenPropertyType does not have a vtable, so you need to add the
 218 // ImplementationLacksVTable attribute to the interface definition
 219 static_assert(__is_polymorphic(TestDictionaryOpenPropertyType), "TestDictionaryOpenPropertyType is not polymorphic");
 220#endif
 221#endif
 222 // If you hit this assertion you either have a use after free bug, or
 223 // TestDictionaryOpenPropertyType has subclasses. If TestDictionaryOpenPropertyType has subclasses that get passed
 224 // to toJS() we currently require TestDictionaryOpenPropertyType you to opt out of binding hardening
 225 // by adding the SkipVTableValidation attribute to the interface IDL definition
 226 RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
 227#endif
 228 return createWrapper<TestDictionaryOpenPropertyType>(globalObject, WTFMove(impl));
 229}
 230
 231JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestDictionaryOpenPropertyType& impl)
 232{
 233 return wrap(state, globalObject, impl);
 234}
 235
 236TestDictionaryOpenPropertyType* JSTestDictionaryOpenPropertyType::toWrapped(JSC::JSValue value)
 237{
 238 if (auto* wrapper = jsDynamicCast<JSTestDictionaryOpenPropertyType*>(value))
 239 return &wrapper->wrapped();
 240 return nullptr;
 241}
 242
 243}

Source/WebCore/bindings/scripts/test/JS/JSTestDictionaryOpenPropertyType.h

 1/*
 2 This file is part of the WebKit open source project.
 3 This file has been generated by generate-bindings.pl. DO NOT MODIFY!
 4
 5 This library is free software; you can redistribute it and/or
 6 modify it under the terms of the GNU Library General Public
 7 License as published by the Free Software Foundation; either
 8 version 2 of the License, or (at your option) any later version.
 9
 10 This library is distributed in the hope that it will be useful,
 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 13 Library General Public License for more details.
 14
 15 You should have received a copy of the GNU Library General Public License
 16 along with this library; see the file COPYING.LIB. If not, write to
 17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 18 Boston, MA 02110-1301, USA.
 19*/
 20
 21#pragma once
 22
 23#include "JSDOMConvert.h"
 24#include "JSDOMWrapper.h"
 25#include "TestDictionaryOpenPropertyType.h"
 26#include <wtf/NeverDestroyed.h>
 27
 28namespace WebCore {
 29
 30class JSTestDictionaryOpenPropertyType : public JSDOMWrapper<TestDictionaryOpenPropertyType> {
 31public:
 32 using Base = JSDOMWrapper<TestDictionaryOpenPropertyType>;
 33 static JSTestDictionaryOpenPropertyType* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<TestDictionaryOpenPropertyType>&& impl)
 34 {
 35 JSTestDictionaryOpenPropertyType* ptr = new (NotNull, JSC::allocateCell<JSTestDictionaryOpenPropertyType>(globalObject->vm().heap)) JSTestDictionaryOpenPropertyType(structure, *globalObject, WTFMove(impl));
 36 ptr->finishCreation(globalObject->vm());
 37 return ptr;
 38 }
 39
 40 static JSC::JSObject* createPrototype(JSC::VM&, JSC::JSGlobalObject*);
 41 static JSC::JSObject* prototype(JSC::VM&, JSC::JSGlobalObject*);
 42 static TestDictionaryOpenPropertyType* toWrapped(JSC::JSValue);
 43 static void destroy(JSC::JSCell*);
 44
 45 DECLARE_INFO;
 46
 47 static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
 48 {
 49 return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
 50 }
 51
 52 static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
 53protected:
 54 JSTestDictionaryOpenPropertyType(JSC::Structure*, JSDOMGlobalObject&, Ref<TestDictionaryOpenPropertyType>&&);
 55
 56 void finishCreation(JSC::VM& vm)
 57 {
 58 Base::finishCreation(vm);
 59 ASSERT(inherits(info()));
 60 }
 61
 62};
 63
 64class JSTestDictionaryOpenPropertyTypeOwner : public JSC::WeakHandleOwner {
 65public:
 66 virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
 67 virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
 68};
 69
 70inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestDictionaryOpenPropertyType*)
 71{
 72 static NeverDestroyed<JSTestDictionaryOpenPropertyTypeOwner> owner;
 73 return &owner.get();
 74}
 75
 76inline void* wrapperKey(TestDictionaryOpenPropertyType* wrappableObject)
 77{
 78 return wrappableObject;
 79}
 80
 81JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestDictionaryOpenPropertyType&);
 82inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, TestDictionaryOpenPropertyType* impl) { return impl ? toJS(state, globalObject, *impl) : JSC::jsNull(); }
 83JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject*, Ref<TestDictionaryOpenPropertyType>&&);
 84inline JSC::JSValue toJSNewlyCreated(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RefPtr<TestDictionaryOpenPropertyType>&& impl) { return impl ? toJSNewlyCreated(state, globalObject, impl.releaseNonNull()) : JSC::jsNull(); }
 85
 86template<> struct JSDOMWrapperConverterTraits<TestDictionaryOpenPropertyType> {
 87 using WrapperClass = JSTestDictionaryOpenPropertyType;
 88};
 89template<> Optional<TestDictionaryOpenPropertyType::Dictionary1> convertDictionary<TestDictionaryOpenPropertyType::Dictionary1>(JSC::ExecState&, JSC::JSValue);
 90
 91
 92} // namespace WebCore

Source/WebCore/bindings/scripts/test/TestDictionaryOpenPropertyType.idl

 1/*
 2 * Copyright (C) Canon Inc. 2016
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted, provided that the following conditions
 6 * are required to be met:
 7 *
 8 * 1. Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above copyright
 11 * notice, this list of conditions and the following disclaimer in the
 12 * documentation and/or other materials provided with the distribution.
 13 * 3. Neither the name of Canon Inc. nor the names of
 14 * its contributors may be used to endorse or promote products derived
 15 * from this software without specific prior written permission.
 16 *
 17 * THIS SOFTWARE IS PROVIDED BY CANON INC. AND ITS CONTRIBUTORS "AS IS" AND ANY
 18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 20 * DISCLAIMED. IN NO EVENT SHALL CANON INC. AND ITS CONTRIBUTORS BE LIABLE FOR
 21 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 24 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 27 */
 28
 29// This IDL file is for testing the bindings code generator for the WebKit extended IDL
 30// attribute (OpenPropertyType) for half-open dictionaries.
 31[
 32 OpenPropertyType=DOMString
 33]
 34dictionary OpenPropertyTypeDictionary1 {
 35};
 36
 37[
 38 Constructor(sequence<OpenPropertyTypeDictionary1> test1)
 39] interface TestDictionaryOpenPropertyType {
 40};
 41