| 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 "JSFetchHeaders.h" |
| 23 | |
| 24 | #include "JSDOMBinding.h" |
| 25 | #include "JSDOMConstructor.h" |
| 26 | #include "JSDOMConvertBoolean.h" |
| 27 | #include "JSDOMConvertInterface.h" |
| 28 | #include "JSDOMConvertNullable.h" |
| 29 | #include "JSDOMConvertRecord.h" |
| 30 | #include "JSDOMConvertSequences.h" |
| 31 | #include "JSDOMConvertStrings.h" |
| 32 | #include "JSDOMConvertUnion.h" |
| 33 | #include "JSDOMExceptionHandling.h" |
| 34 | #include "JSDOMIterator.h" |
| 35 | #include "JSDOMOperation.h" |
| 36 | #include "JSDOMWrapperCache.h" |
| 37 | #include "ScriptExecutionContext.h" |
| 38 | #include <JavaScriptCore/BuiltinNames.h> |
| 39 | #include <JavaScriptCore/FunctionPrototype.h> |
| 40 | #include <JavaScriptCore/HeapSnapshotBuilder.h> |
| 41 | #include <JavaScriptCore/JSArray.h> |
| 42 | #include <JavaScriptCore/JSCInlines.h> |
| 43 | #include <wtf/GetPtr.h> |
| 44 | #include <wtf/PointerPreparations.h> |
| 45 | #include <wtf/URL.h> |
| 46 | #include <wtf/Variant.h> |
| 47 | #include <wtf/Vector.h> |
| 48 | |
| 49 | |
| 50 | namespace WebCore { |
| 51 | using namespace JSC; |
| 52 | |
| 53 | // Functions |
| 54 | |
| 55 | JSC::EncodedJSValue JSC_HOST_CALL jsFetchHeadersPrototypeFunctionAppend(JSC::ExecState*); |
| 56 | JSC::EncodedJSValue JSC_HOST_CALL jsFetchHeadersPrototypeFunctionDelete(JSC::ExecState*); |
| 57 | JSC::EncodedJSValue JSC_HOST_CALL jsFetchHeadersPrototypeFunctionGet(JSC::ExecState*); |
| 58 | JSC::EncodedJSValue JSC_HOST_CALL jsFetchHeadersPrototypeFunctionHas(JSC::ExecState*); |
| 59 | JSC::EncodedJSValue JSC_HOST_CALL jsFetchHeadersPrototypeFunctionSet(JSC::ExecState*); |
| 60 | JSC::EncodedJSValue JSC_HOST_CALL (JSC::ExecState*); |
| 61 | JSC::EncodedJSValue JSC_HOST_CALL jsFetchHeadersPrototypeFunctionEntries(JSC::ExecState*); |
| 62 | JSC::EncodedJSValue JSC_HOST_CALL jsFetchHeadersPrototypeFunctionKeys(JSC::ExecState*); |
| 63 | JSC::EncodedJSValue JSC_HOST_CALL jsFetchHeadersPrototypeFunctionValues(JSC::ExecState*); |
| 64 | JSC::EncodedJSValue JSC_HOST_CALL jsFetchHeadersPrototypeFunctionForEach(JSC::ExecState*); |
| 65 | |
| 66 | // Attributes |
| 67 | |
| 68 | JSC::EncodedJSValue jsFetchHeadersConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName); |
| 69 | bool setJSFetchHeadersConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue); |
| 70 | |
| 71 | class : public JSC::JSNonFinalObject { |
| 72 | public: |
| 73 | using = JSC::JSNonFinalObject; |
| 74 | static JSFetchHeadersPrototype* (JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure) |
| 75 | { |
| 76 | JSFetchHeadersPrototype* ptr = new (NotNull, JSC::allocateCell<JSFetchHeadersPrototype>(vm.heap)) JSFetchHeadersPrototype(vm, globalObject, structure); |
| 77 | ptr->finishCreation(vm); |
| 78 | return ptr; |
| 79 | } |
| 80 | |
| 81 | DECLARE_INFO; |
| 82 | static JSC::Structure* (JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype) |
| 83 | { |
| 84 | return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info()); |
| 85 | } |
| 86 | |
| 87 | private: |
| 88 | (JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure) |
| 89 | : JSC::JSNonFinalObject(vm, structure) |
| 90 | { |
| 91 | } |
| 92 | |
| 93 | void finishCreation(JSC::VM&); |
| 94 | }; |
| 95 | |
| 96 | using = JSDOMConstructor<JSFetchHeaders>; |
| 97 | |
| 98 | template<> EncodedJSValue JSC_HOST_CALL JSFetchHeadersConstructor::construct(ExecState* state) |
| 99 | { |
| 100 | VM& vm = state->vm(); |
| 101 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 102 | UNUSED_PARAM(throwScope); |
| 103 | auto* castedThis = jsCast<JSFetchHeadersConstructor*>(state->jsCallee()); |
| 104 | ASSERT(castedThis); |
| 105 | auto init = state->argument(0).isUndefined() ? Optional<Converter<IDLUnion<IDLSequence<IDLSequence<IDLByteString>>, IDLRecord<IDLByteString, IDLByteString>>>::ReturnType>() : Optional<Converter<IDLUnion<IDLSequence<IDLSequence<IDLByteString>>, IDLRecord<IDLByteString, IDLByteString>>>::ReturnType>(convert<IDLUnion<IDLSequence<IDLSequence<IDLByteString>>, IDLRecord<IDLByteString, IDLByteString>>>(*state, state->uncheckedArgument(0))); |
| 106 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 107 | auto object = FetchHeaders::create(WTFMove(init)); |
| 108 | return JSValue::encode(toJSNewlyCreated<IDLInterface<FetchHeaders>>(*state, *castedThis->globalObject(), throwScope, WTFMove(object))); |
| 109 | } |
| 110 | |
| 111 | template<> JSValue JSFetchHeadersConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject) |
| 112 | { |
| 113 | UNUSED_PARAM(vm); |
| 114 | return globalObject.functionPrototype(); |
| 115 | } |
| 116 | |
| 117 | template<> void JSFetchHeadersConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject) |
| 118 | { |
| 119 | putDirect(vm, vm.propertyNames->prototype, JSFetchHeaders::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 120 | putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String("Headers"_s )), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 121 | putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum); |
| 122 | } |
| 123 | |
| 124 | template<> const ClassInfo JSFetchHeadersConstructor::s_info = { "Headers" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSFetchHeadersConstructor) }; |
| 125 | |
| 126 | /* Hash table for prototype */ |
| 127 | |
| 128 | static const HashTableValue [] = |
| 129 | { |
| 130 | { "constructor" , static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsFetchHeadersConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSFetchHeadersConstructor) } }, |
| 131 | { "append" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsFetchHeadersPrototypeFunctionAppend), (intptr_t) (2) } }, |
| 132 | { "delete" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsFetchHeadersPrototypeFunctionDelete), (intptr_t) (1) } }, |
| 133 | { "get" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsFetchHeadersPrototypeFunctionGet), (intptr_t) (1) } }, |
| 134 | { "has" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsFetchHeadersPrototypeFunctionHas), (intptr_t) (1) } }, |
| 135 | { "set" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsFetchHeadersPrototypeFunctionSet), (intptr_t) (2) } }, |
| 136 | { "entries" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsFetchHeadersPrototypeFunctionEntries), (intptr_t) (0) } }, |
| 137 | { "keys" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsFetchHeadersPrototypeFunctionKeys), (intptr_t) (0) } }, |
| 138 | { "values" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsFetchHeadersPrototypeFunctionValues), (intptr_t) (0) } }, |
| 139 | { "forEach" , static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsFetchHeadersPrototypeFunctionForEach), (intptr_t) (1) } }, |
| 140 | }; |
| 141 | |
| 142 | const ClassInfo JSFetchHeadersPrototype:: = { "HeadersPrototype" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSFetchHeadersPrototype) }; |
| 143 | |
| 144 | void JSFetchHeadersPrototype::(VM& vm) |
| 145 | { |
| 146 | Base::finishCreation(vm); |
| 147 | reifyStaticProperties(vm, JSFetchHeaders::info(), JSFetchHeadersPrototypeTableValues, *this); |
| 148 | putDirect(vm, vm.propertyNames->iteratorSymbol, getDirect(vm, vm.propertyNames->builtinNames().entriesPublicName()), static_cast<unsigned>(JSC::PropertyAttribute::DontEnum)); |
| 149 | } |
| 150 | |
| 151 | const ClassInfo JSFetchHeaders:: = { "Headers" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSFetchHeaders) }; |
| 152 | |
| 153 | JSFetchHeaders::(Structure* structure, JSDOMGlobalObject& globalObject, Ref<FetchHeaders>&& impl) |
| 154 | : JSDOMWrapper<FetchHeaders>(structure, globalObject, WTFMove(impl)) |
| 155 | { |
| 156 | } |
| 157 | |
| 158 | void JSFetchHeaders::(VM& vm) |
| 159 | { |
| 160 | Base::finishCreation(vm); |
| 161 | ASSERT(inherits(vm, info())); |
| 162 | |
| 163 | } |
| 164 | |
| 165 | JSObject* JSFetchHeaders::(VM& vm, JSDOMGlobalObject& globalObject) |
| 166 | { |
| 167 | return JSFetchHeadersPrototype::create(vm, &globalObject, JSFetchHeadersPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype())); |
| 168 | } |
| 169 | |
| 170 | JSObject* JSFetchHeaders::(VM& vm, JSDOMGlobalObject& globalObject) |
| 171 | { |
| 172 | return getDOMPrototype<JSFetchHeaders>(vm, globalObject); |
| 173 | } |
| 174 | |
| 175 | JSValue JSFetchHeaders::(VM& vm, const JSGlobalObject* globalObject) |
| 176 | { |
| 177 | return getDOMConstructor<JSFetchHeadersConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject)); |
| 178 | } |
| 179 | |
| 180 | void JSFetchHeaders::(JSC::JSCell* cell) |
| 181 | { |
| 182 | JSFetchHeaders* thisObject = static_cast<JSFetchHeaders*>(cell); |
| 183 | thisObject->JSFetchHeaders::~JSFetchHeaders(); |
| 184 | } |
| 185 | |
| 186 | template<> inline JSFetchHeaders* IDLOperation<JSFetchHeaders>::cast(ExecState& state) |
| 187 | { |
| 188 | return jsDynamicCast<JSFetchHeaders*>(state.vm(), state.thisValue()); |
| 189 | } |
| 190 | |
| 191 | EncodedJSValue (ExecState* state, EncodedJSValue thisValue, PropertyName) |
| 192 | { |
| 193 | VM& vm = state->vm(); |
| 194 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 195 | auto* prototype = jsDynamicCast<JSFetchHeadersPrototype*>(vm, JSValue::decode(thisValue)); |
| 196 | if (UNLIKELY(!prototype)) |
| 197 | return throwVMTypeError(state, throwScope); |
| 198 | return JSValue::encode(JSFetchHeaders::getConstructor(state->vm(), prototype->globalObject())); |
| 199 | } |
| 200 | |
| 201 | bool (ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue) |
| 202 | { |
| 203 | VM& vm = state->vm(); |
| 204 | auto throwScope = DECLARE_THROW_SCOPE(vm); |
| 205 | auto* prototype = jsDynamicCast<JSFetchHeadersPrototype*>(vm, JSValue::decode(thisValue)); |
| 206 | if (UNLIKELY(!prototype)) { |
| 207 | throwVMTypeError(state, throwScope); |
| 208 | return false; |
| 209 | } |
| 210 | // Shadowing a built-in constructor |
| 211 | return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue)); |
| 212 | } |
| 213 | |
| 214 | static inline JSC::EncodedJSValue jsFetchHeadersPrototypeFunctionAppendBody(JSC::ExecState* state, typename IDLOperation<JSFetchHeaders>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 215 | { |
| 216 | UNUSED_PARAM(state); |
| 217 | UNUSED_PARAM(throwScope); |
| 218 | auto& impl = castedThis->wrapped(); |
| 219 | if (UNLIKELY(state->argumentCount() < 2)) |
| 220 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
| 221 | auto name = convert<IDLByteString>(*state, state->uncheckedArgument(0)); |
| 222 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 223 | auto value = convert<IDLByteString>(*state, state->uncheckedArgument(1)); |
| 224 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 225 | propagateException(*state, throwScope, impl.append(WTFMove(name), WTFMove(value))); |
| 226 | return JSValue::encode(jsUndefined()); |
| 227 | } |
| 228 | |
| 229 | EncodedJSValue JSC_HOST_CALL (ExecState* state) |
| 230 | { |
| 231 | return IDLOperation<JSFetchHeaders>::call<jsFetchHeadersPrototypeFunctionAppendBody>(*state, "append" ); |
| 232 | } |
| 233 | |
| 234 | static inline JSC::EncodedJSValue jsFetchHeadersPrototypeFunctionDeleteBody(JSC::ExecState* state, typename IDLOperation<JSFetchHeaders>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 235 | { |
| 236 | UNUSED_PARAM(state); |
| 237 | UNUSED_PARAM(throwScope); |
| 238 | auto& impl = castedThis->wrapped(); |
| 239 | if (UNLIKELY(state->argumentCount() < 1)) |
| 240 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
| 241 | auto name = convert<IDLByteString>(*state, state->uncheckedArgument(0)); |
| 242 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 243 | propagateException(*state, throwScope, impl.remove(WTFMove(name))); |
| 244 | return JSValue::encode(jsUndefined()); |
| 245 | } |
| 246 | |
| 247 | EncodedJSValue JSC_HOST_CALL (ExecState* state) |
| 248 | { |
| 249 | return IDLOperation<JSFetchHeaders>::call<jsFetchHeadersPrototypeFunctionDeleteBody>(*state, "delete" ); |
| 250 | } |
| 251 | |
| 252 | static inline JSC::EncodedJSValue jsFetchHeadersPrototypeFunctionGetBody(JSC::ExecState* state, typename IDLOperation<JSFetchHeaders>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 253 | { |
| 254 | UNUSED_PARAM(state); |
| 255 | UNUSED_PARAM(throwScope); |
| 256 | auto& impl = castedThis->wrapped(); |
| 257 | if (UNLIKELY(state->argumentCount() < 1)) |
| 258 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
| 259 | auto name = convert<IDLByteString>(*state, state->uncheckedArgument(0)); |
| 260 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 261 | return JSValue::encode(toJS<IDLNullable<IDLByteString>>(*state, throwScope, impl.get(WTFMove(name)))); |
| 262 | } |
| 263 | |
| 264 | EncodedJSValue JSC_HOST_CALL (ExecState* state) |
| 265 | { |
| 266 | return IDLOperation<JSFetchHeaders>::call<jsFetchHeadersPrototypeFunctionGetBody>(*state, "get" ); |
| 267 | } |
| 268 | |
| 269 | static inline JSC::EncodedJSValue jsFetchHeadersPrototypeFunctionHasBody(JSC::ExecState* state, typename IDLOperation<JSFetchHeaders>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 270 | { |
| 271 | UNUSED_PARAM(state); |
| 272 | UNUSED_PARAM(throwScope); |
| 273 | auto& impl = castedThis->wrapped(); |
| 274 | if (UNLIKELY(state->argumentCount() < 1)) |
| 275 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
| 276 | auto name = convert<IDLByteString>(*state, state->uncheckedArgument(0)); |
| 277 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 278 | return JSValue::encode(toJS<IDLBoolean>(*state, throwScope, impl.has(WTFMove(name)))); |
| 279 | } |
| 280 | |
| 281 | EncodedJSValue JSC_HOST_CALL (ExecState* state) |
| 282 | { |
| 283 | return IDLOperation<JSFetchHeaders>::call<jsFetchHeadersPrototypeFunctionHasBody>(*state, "has" ); |
| 284 | } |
| 285 | |
| 286 | static inline JSC::EncodedJSValue jsFetchHeadersPrototypeFunctionSetBody(JSC::ExecState* state, typename IDLOperation<JSFetchHeaders>::ClassParameter castedThis, JSC::ThrowScope& throwScope) |
| 287 | { |
| 288 | UNUSED_PARAM(state); |
| 289 | UNUSED_PARAM(throwScope); |
| 290 | auto& impl = castedThis->wrapped(); |
| 291 | if (UNLIKELY(state->argumentCount() < 2)) |
| 292 | return throwVMError(state, throwScope, createNotEnoughArgumentsError(state)); |
| 293 | auto name = convert<IDLByteString>(*state, state->uncheckedArgument(0)); |
| 294 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 295 | auto value = convert<IDLByteString>(*state, state->uncheckedArgument(1)); |
| 296 | RETURN_IF_EXCEPTION(throwScope, encodedJSValue()); |
| 297 | propagateException(*state, throwScope, impl.set(WTFMove(name), WTFMove(value))); |
| 298 | return JSValue::encode(jsUndefined()); |
| 299 | } |
| 300 | |
| 301 | EncodedJSValue JSC_HOST_CALL (ExecState* state) |
| 302 | { |
| 303 | return IDLOperation<JSFetchHeaders>::call<jsFetchHeadersPrototypeFunctionSetBody>(*state, "set" ); |
| 304 | } |
| 305 | |
| 306 | struct { |
| 307 | static constexpr JSDOMIteratorType = JSDOMIteratorType::Map; |
| 308 | using = IDLByteString; |
| 309 | using = IDLByteString; |
| 310 | }; |
| 311 | |
| 312 | using = JSDOMIterator<JSFetchHeaders, FetchHeadersIteratorTraits>; |
| 313 | using = JSDOMIteratorPrototype<JSFetchHeaders, FetchHeadersIteratorTraits>; |
| 314 | |
| 315 | template<> |
| 316 | const JSC::ClassInfo FetchHeadersIterator::s_info = { "Headers Iterator" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(FetchHeadersIterator) }; |
| 317 | |
| 318 | template<> |
| 319 | const JSC::ClassInfo FetchHeadersIteratorPrototype::s_info = { "Headers Iterator" , &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(FetchHeadersIteratorPrototype) }; |
| 320 | |
| 321 | static inline EncodedJSValue (ExecState*, JSFetchHeaders* thisObject, JSC::ThrowScope&) |
| 322 | { |
| 323 | return JSValue::encode(iteratorCreate<FetchHeadersIterator>(*thisObject, IterationKind::KeyValue)); |
| 324 | } |
| 325 | |
| 326 | JSC::EncodedJSValue JSC_HOST_CALL (JSC::ExecState* state) |
| 327 | { |
| 328 | return IDLOperation<JSFetchHeaders>::call<jsFetchHeadersPrototypeFunctionEntriesCaller>(*state, "entries" ); |
| 329 | } |
| 330 | |
| 331 | static inline EncodedJSValue (ExecState*, JSFetchHeaders* thisObject, JSC::ThrowScope&) |
| 332 | { |
| 333 | return JSValue::encode(iteratorCreate<FetchHeadersIterator>(*thisObject, IterationKind::Key)); |
| 334 | } |
| 335 | |
| 336 | JSC::EncodedJSValue JSC_HOST_CALL (JSC::ExecState* state) |
| 337 | { |
| 338 | return IDLOperation<JSFetchHeaders>::call<jsFetchHeadersPrototypeFunctionKeysCaller>(*state, "keys" ); |
| 339 | } |
| 340 | |
| 341 | static inline EncodedJSValue (ExecState*, JSFetchHeaders* thisObject, JSC::ThrowScope&) |
| 342 | { |
| 343 | return JSValue::encode(iteratorCreate<FetchHeadersIterator>(*thisObject, IterationKind::Value)); |
| 344 | } |
| 345 | |
| 346 | JSC::EncodedJSValue JSC_HOST_CALL (JSC::ExecState* state) |
| 347 | { |
| 348 | return IDLOperation<JSFetchHeaders>::call<jsFetchHeadersPrototypeFunctionValuesCaller>(*state, "values" ); |
| 349 | } |
| 350 | |
| 351 | static inline EncodedJSValue (ExecState* state, JSFetchHeaders* thisObject, JSC::ThrowScope& throwScope) |
| 352 | { |
| 353 | return JSValue::encode(iteratorForEach<FetchHeadersIterator>(*state, *thisObject, throwScope)); |
| 354 | } |
| 355 | |
| 356 | JSC::EncodedJSValue JSC_HOST_CALL (JSC::ExecState* state) |
| 357 | { |
| 358 | return IDLOperation<JSFetchHeaders>::call<jsFetchHeadersPrototypeFunctionForEachCaller>(*state, "forEach" ); |
| 359 | } |
| 360 | |
| 361 | void JSFetchHeaders::(JSCell* cell, HeapSnapshotBuilder& builder) |
| 362 | { |
| 363 | auto* thisObject = jsCast<JSFetchHeaders*>(cell); |
| 364 | builder.setWrappedObjectForCell(cell, &thisObject->wrapped()); |
| 365 | if (thisObject->scriptExecutionContext()) |
| 366 | builder.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string()); |
| 367 | Base::heapSnapshot(cell, builder); |
| 368 | } |
| 369 | |
| 370 | bool JSFetchHeadersOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason) |
| 371 | { |
| 372 | UNUSED_PARAM(handle); |
| 373 | UNUSED_PARAM(visitor); |
| 374 | UNUSED_PARAM(reason); |
| 375 | return false; |
| 376 | } |
| 377 | |
| 378 | void JSFetchHeadersOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) |
| 379 | { |
| 380 | auto* = static_cast<JSFetchHeaders*>(handle.slot()->asCell()); |
| 381 | auto& world = *static_cast<DOMWrapperWorld*>(context); |
| 382 | uncacheWrapper(world, &jsFetchHeaders->wrapped(), jsFetchHeaders); |
| 383 | } |
| 384 | |
| 385 | JSC::JSValue (JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<FetchHeaders>&& impl) |
| 386 | { |
| 387 | // If you hit this failure the interface definition has the ImplementationLacksVTable |
| 388 | // attribute. You should remove that attribute. If the class has subclasses |
| 389 | // that may be passed through this toJS() function you should use the SkipVTableValidation |
| 390 | // attribute to FetchHeaders. |
| 391 | static_assert(!std::is_polymorphic<FetchHeaders>::value, "FetchHeaders is polymorphic but the IDL claims it is not" ); |
| 392 | return createWrapper<FetchHeaders>(globalObject, WTFMove(impl)); |
| 393 | } |
| 394 | |
| 395 | JSC::JSValue (JSC::ExecState* state, JSDOMGlobalObject* globalObject, FetchHeaders& impl) |
| 396 | { |
| 397 | return wrap(state, globalObject, impl); |
| 398 | } |
| 399 | |
| 400 | FetchHeaders* JSFetchHeaders::(JSC::VM& vm, JSC::JSValue value) |
| 401 | { |
| 402 | if (auto* wrapper = jsDynamicCast<JSFetchHeaders*>(vm, value)) |
| 403 | return &wrapper->wrapped(); |
| 404 | return nullptr; |
| 405 | } |
| 406 | |
| 407 | } |
| 408 | |