blob: 6b46f02dffcb9ff860ac1b4fb963de125f889b8c [file] [log] [blame]
/*
This file is part of the WebKit open source project.
This file has been generated by generate-bindings.pl. DO NOT MODIFY!
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "config.h"
#include "JSWorkerNavigator.h"
#include "JSDOMBinding.h"
#include "JSDOMConstructor.h"
#include "URL.h"
#include <runtime/FunctionPrototype.h>
#include <runtime/JSString.h>
#include <wtf/GetPtr.h>
#if ENABLE(WEB_REPLAY)
#include "MemoizedDOMResult.h"
#include <replay/InputCursor.h>
#include <wtf/NeverDestroyed.h>
#endif
using namespace JSC;
namespace WebCore {
// Attributes
#if ENABLE(NAVIGATOR_HWCONCURRENCY)
JSC::EncodedJSValue jsWorkerNavigatorHardwareConcurrency(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
#endif
JSC::EncodedJSValue jsWorkerNavigatorAppCodeName(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsWorkerNavigatorAppName(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsWorkerNavigatorAppVersion(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsWorkerNavigatorPlatform(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsWorkerNavigatorProduct(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsWorkerNavigatorProductSub(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsWorkerNavigatorUserAgent(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsWorkerNavigatorVendor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsWorkerNavigatorVendorSub(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsWorkerNavigatorLanguage(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsWorkerNavigatorOnLine(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
JSC::EncodedJSValue jsWorkerNavigatorConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSWorkerNavigatorConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
class JSWorkerNavigatorPrototype : public JSC::JSNonFinalObject {
public:
typedef JSC::JSNonFinalObject Base;
static JSWorkerNavigatorPrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
{
JSWorkerNavigatorPrototype* ptr = new (NotNull, JSC::allocateCell<JSWorkerNavigatorPrototype>(vm.heap)) JSWorkerNavigatorPrototype(vm, globalObject, structure);
ptr->finishCreation(vm);
return ptr;
}
DECLARE_INFO;
static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
{
return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
}
private:
JSWorkerNavigatorPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
: JSC::JSNonFinalObject(vm, structure)
{
}
void finishCreation(JSC::VM&);
};
typedef JSDOMConstructorNotConstructable<JSWorkerNavigator> JSWorkerNavigatorConstructor;
template<> JSValue JSWorkerNavigatorConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
{
UNUSED_PARAM(vm);
return globalObject.functionPrototype();
}
template<> void JSWorkerNavigatorConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
{
putDirect(vm, vm.propertyNames->prototype, JSWorkerNavigator::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("WorkerNavigator"))), ReadOnly | DontEnum);
putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
}
template<> const ClassInfo JSWorkerNavigatorConstructor::s_info = { "WorkerNavigator", &Base::s_info, 0, CREATE_METHOD_TABLE(JSWorkerNavigatorConstructor) };
/* Hash table for prototype */
static const HashTableValue JSWorkerNavigatorPrototypeTableValues[] =
{
{ "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWorkerNavigatorConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSWorkerNavigatorConstructor) } },
#if ENABLE(NAVIGATOR_HWCONCURRENCY)
{ "hardwareConcurrency", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWorkerNavigatorHardwareConcurrency), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
#else
{ 0, 0, NoIntrinsic, { 0, 0 } },
#endif
{ "appCodeName", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWorkerNavigatorAppCodeName), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "appName", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWorkerNavigatorAppName), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "appVersion", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWorkerNavigatorAppVersion), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "platform", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWorkerNavigatorPlatform), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "product", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWorkerNavigatorProduct), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "productSub", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWorkerNavigatorProductSub), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "userAgent", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWorkerNavigatorUserAgent), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "vendor", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWorkerNavigatorVendor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "vendorSub", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWorkerNavigatorVendorSub), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "language", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWorkerNavigatorLanguage), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
{ "onLine", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsWorkerNavigatorOnLine), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
};
const ClassInfo JSWorkerNavigatorPrototype::s_info = { "WorkerNavigatorPrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSWorkerNavigatorPrototype) };
void JSWorkerNavigatorPrototype::finishCreation(VM& vm)
{
Base::finishCreation(vm);
reifyStaticProperties(vm, JSWorkerNavigatorPrototypeTableValues, *this);
}
const ClassInfo JSWorkerNavigator::s_info = { "WorkerNavigator", &Base::s_info, 0, CREATE_METHOD_TABLE(JSWorkerNavigator) };
JSWorkerNavigator::JSWorkerNavigator(Structure* structure, JSDOMGlobalObject& globalObject, Ref<WorkerNavigator>&& impl)
: JSDOMWrapper<WorkerNavigator>(structure, globalObject, WTFMove(impl))
{
}
JSObject* JSWorkerNavigator::createPrototype(VM& vm, JSGlobalObject* globalObject)
{
return JSWorkerNavigatorPrototype::create(vm, globalObject, JSWorkerNavigatorPrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
}
JSObject* JSWorkerNavigator::prototype(VM& vm, JSGlobalObject* globalObject)
{
return getDOMPrototype<JSWorkerNavigator>(vm, globalObject);
}
void JSWorkerNavigator::destroy(JSC::JSCell* cell)
{
JSWorkerNavigator* thisObject = static_cast<JSWorkerNavigator*>(cell);
thisObject->JSWorkerNavigator::~JSWorkerNavigator();
}
#if ENABLE(NAVIGATOR_HWCONCURRENCY)
EncodedJSValue jsWorkerNavigatorHardwareConcurrency(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSWorkerNavigator*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "WorkerNavigator", "hardwareConcurrency");
}
auto& impl = castedThis->wrapped();
JSValue result = jsNumber(impl.hardwareConcurrency());
return JSValue::encode(result);
}
#endif
EncodedJSValue jsWorkerNavigatorAppCodeName(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSWorkerNavigator*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "WorkerNavigator", "appCodeName");
}
#if ENABLE(WEB_REPLAY)
JSGlobalObject* globalObject = state->lexicalGlobalObject();
InputCursor& cursor = globalObject->inputCursor();
static NeverDestroyed<const AtomicString> bindingName("WorkerNavigator.appCodeName", AtomicString::ConstructFromLiteral);
if (cursor.isCapturing()) {
String memoizedResult = castedThis->wrapped().appCodeName();
cursor.appendInput<MemoizedDOMResult<String>>(bindingName.get().string(), memoizedResult, 0);
JSValue result = jsStringWithCache(state, memoizedResult);
return JSValue::encode(result);
}
if (cursor.isReplaying()) {
String memoizedResult;
MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>();
if (input && input->convertTo<String>(memoizedResult)) {
JSValue result = jsStringWithCache(state, memoizedResult);
return JSValue::encode(result);
}
}
#endif
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.appCodeName());
return JSValue::encode(result);
}
EncodedJSValue jsWorkerNavigatorAppName(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSWorkerNavigator*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "WorkerNavigator", "appName");
}
#if ENABLE(WEB_REPLAY)
JSGlobalObject* globalObject = state->lexicalGlobalObject();
InputCursor& cursor = globalObject->inputCursor();
static NeverDestroyed<const AtomicString> bindingName("WorkerNavigator.appName", AtomicString::ConstructFromLiteral);
if (cursor.isCapturing()) {
String memoizedResult = castedThis->wrapped().appName();
cursor.appendInput<MemoizedDOMResult<String>>(bindingName.get().string(), memoizedResult, 0);
JSValue result = jsStringWithCache(state, memoizedResult);
return JSValue::encode(result);
}
if (cursor.isReplaying()) {
String memoizedResult;
MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>();
if (input && input->convertTo<String>(memoizedResult)) {
JSValue result = jsStringWithCache(state, memoizedResult);
return JSValue::encode(result);
}
}
#endif
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.appName());
return JSValue::encode(result);
}
EncodedJSValue jsWorkerNavigatorAppVersion(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSWorkerNavigator*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "WorkerNavigator", "appVersion");
}
#if ENABLE(WEB_REPLAY)
JSGlobalObject* globalObject = state->lexicalGlobalObject();
InputCursor& cursor = globalObject->inputCursor();
static NeverDestroyed<const AtomicString> bindingName("WorkerNavigator.appVersion", AtomicString::ConstructFromLiteral);
if (cursor.isCapturing()) {
String memoizedResult = castedThis->wrapped().appVersion();
cursor.appendInput<MemoizedDOMResult<String>>(bindingName.get().string(), memoizedResult, 0);
JSValue result = jsStringWithCache(state, memoizedResult);
return JSValue::encode(result);
}
if (cursor.isReplaying()) {
String memoizedResult;
MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>();
if (input && input->convertTo<String>(memoizedResult)) {
JSValue result = jsStringWithCache(state, memoizedResult);
return JSValue::encode(result);
}
}
#endif
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.appVersion());
return JSValue::encode(result);
}
EncodedJSValue jsWorkerNavigatorPlatform(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSWorkerNavigator*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "WorkerNavigator", "platform");
}
#if ENABLE(WEB_REPLAY)
JSGlobalObject* globalObject = state->lexicalGlobalObject();
InputCursor& cursor = globalObject->inputCursor();
static NeverDestroyed<const AtomicString> bindingName("WorkerNavigator.platform", AtomicString::ConstructFromLiteral);
if (cursor.isCapturing()) {
String memoizedResult = castedThis->wrapped().platform();
cursor.appendInput<MemoizedDOMResult<String>>(bindingName.get().string(), memoizedResult, 0);
JSValue result = jsStringWithCache(state, memoizedResult);
return JSValue::encode(result);
}
if (cursor.isReplaying()) {
String memoizedResult;
MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>();
if (input && input->convertTo<String>(memoizedResult)) {
JSValue result = jsStringWithCache(state, memoizedResult);
return JSValue::encode(result);
}
}
#endif
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.platform());
return JSValue::encode(result);
}
EncodedJSValue jsWorkerNavigatorProduct(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSWorkerNavigator*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "WorkerNavigator", "product");
}
#if ENABLE(WEB_REPLAY)
JSGlobalObject* globalObject = state->lexicalGlobalObject();
InputCursor& cursor = globalObject->inputCursor();
static NeverDestroyed<const AtomicString> bindingName("WorkerNavigator.product", AtomicString::ConstructFromLiteral);
if (cursor.isCapturing()) {
String memoizedResult = castedThis->wrapped().product();
cursor.appendInput<MemoizedDOMResult<String>>(bindingName.get().string(), memoizedResult, 0);
JSValue result = jsStringWithCache(state, memoizedResult);
return JSValue::encode(result);
}
if (cursor.isReplaying()) {
String memoizedResult;
MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>();
if (input && input->convertTo<String>(memoizedResult)) {
JSValue result = jsStringWithCache(state, memoizedResult);
return JSValue::encode(result);
}
}
#endif
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.product());
return JSValue::encode(result);
}
EncodedJSValue jsWorkerNavigatorProductSub(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSWorkerNavigator*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "WorkerNavigator", "productSub");
}
#if ENABLE(WEB_REPLAY)
JSGlobalObject* globalObject = state->lexicalGlobalObject();
InputCursor& cursor = globalObject->inputCursor();
static NeverDestroyed<const AtomicString> bindingName("WorkerNavigator.productSub", AtomicString::ConstructFromLiteral);
if (cursor.isCapturing()) {
String memoizedResult = castedThis->wrapped().productSub();
cursor.appendInput<MemoizedDOMResult<String>>(bindingName.get().string(), memoizedResult, 0);
JSValue result = jsStringWithCache(state, memoizedResult);
return JSValue::encode(result);
}
if (cursor.isReplaying()) {
String memoizedResult;
MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>();
if (input && input->convertTo<String>(memoizedResult)) {
JSValue result = jsStringWithCache(state, memoizedResult);
return JSValue::encode(result);
}
}
#endif
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.productSub());
return JSValue::encode(result);
}
EncodedJSValue jsWorkerNavigatorUserAgent(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSWorkerNavigator*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "WorkerNavigator", "userAgent");
}
#if ENABLE(WEB_REPLAY)
JSGlobalObject* globalObject = state->lexicalGlobalObject();
InputCursor& cursor = globalObject->inputCursor();
static NeverDestroyed<const AtomicString> bindingName("WorkerNavigator.userAgent", AtomicString::ConstructFromLiteral);
if (cursor.isCapturing()) {
String memoizedResult = castedThis->wrapped().userAgent();
cursor.appendInput<MemoizedDOMResult<String>>(bindingName.get().string(), memoizedResult, 0);
JSValue result = jsStringWithCache(state, memoizedResult);
return JSValue::encode(result);
}
if (cursor.isReplaying()) {
String memoizedResult;
MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>();
if (input && input->convertTo<String>(memoizedResult)) {
JSValue result = jsStringWithCache(state, memoizedResult);
return JSValue::encode(result);
}
}
#endif
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.userAgent());
return JSValue::encode(result);
}
EncodedJSValue jsWorkerNavigatorVendor(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSWorkerNavigator*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "WorkerNavigator", "vendor");
}
#if ENABLE(WEB_REPLAY)
JSGlobalObject* globalObject = state->lexicalGlobalObject();
InputCursor& cursor = globalObject->inputCursor();
static NeverDestroyed<const AtomicString> bindingName("WorkerNavigator.vendor", AtomicString::ConstructFromLiteral);
if (cursor.isCapturing()) {
String memoizedResult = castedThis->wrapped().vendor();
cursor.appendInput<MemoizedDOMResult<String>>(bindingName.get().string(), memoizedResult, 0);
JSValue result = jsStringWithCache(state, memoizedResult);
return JSValue::encode(result);
}
if (cursor.isReplaying()) {
String memoizedResult;
MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>();
if (input && input->convertTo<String>(memoizedResult)) {
JSValue result = jsStringWithCache(state, memoizedResult);
return JSValue::encode(result);
}
}
#endif
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.vendor());
return JSValue::encode(result);
}
EncodedJSValue jsWorkerNavigatorVendorSub(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSWorkerNavigator*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "WorkerNavigator", "vendorSub");
}
#if ENABLE(WEB_REPLAY)
JSGlobalObject* globalObject = state->lexicalGlobalObject();
InputCursor& cursor = globalObject->inputCursor();
static NeverDestroyed<const AtomicString> bindingName("WorkerNavigator.vendorSub", AtomicString::ConstructFromLiteral);
if (cursor.isCapturing()) {
String memoizedResult = castedThis->wrapped().vendorSub();
cursor.appendInput<MemoizedDOMResult<String>>(bindingName.get().string(), memoizedResult, 0);
JSValue result = jsStringWithCache(state, memoizedResult);
return JSValue::encode(result);
}
if (cursor.isReplaying()) {
String memoizedResult;
MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>();
if (input && input->convertTo<String>(memoizedResult)) {
JSValue result = jsStringWithCache(state, memoizedResult);
return JSValue::encode(result);
}
}
#endif
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.vendorSub());
return JSValue::encode(result);
}
EncodedJSValue jsWorkerNavigatorLanguage(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSWorkerNavigator*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "WorkerNavigator", "language");
}
#if ENABLE(WEB_REPLAY)
JSGlobalObject* globalObject = state->lexicalGlobalObject();
InputCursor& cursor = globalObject->inputCursor();
static NeverDestroyed<const AtomicString> bindingName("WorkerNavigator.language", AtomicString::ConstructFromLiteral);
if (cursor.isCapturing()) {
String memoizedResult = castedThis->wrapped().language();
cursor.appendInput<MemoizedDOMResult<String>>(bindingName.get().string(), memoizedResult, 0);
JSValue result = jsStringWithCache(state, memoizedResult);
return JSValue::encode(result);
}
if (cursor.isReplaying()) {
String memoizedResult;
MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>();
if (input && input->convertTo<String>(memoizedResult)) {
JSValue result = jsStringWithCache(state, memoizedResult);
return JSValue::encode(result);
}
}
#endif
auto& impl = castedThis->wrapped();
JSValue result = jsStringWithCache(state, impl.language());
return JSValue::encode(result);
}
EncodedJSValue jsWorkerNavigatorOnLine(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
UNUSED_PARAM(throwScope);
UNUSED_PARAM(thisValue);
JSValue decodedThisValue = JSValue::decode(thisValue);
auto* castedThis = jsDynamicCast<JSWorkerNavigator*>(decodedThisValue);
if (UNLIKELY(!castedThis)) {
return throwGetterTypeError(*state, throwScope, "WorkerNavigator", "onLine");
}
auto& impl = castedThis->wrapped();
JSValue result = jsBoolean(impl.onLine());
return JSValue::encode(result);
}
EncodedJSValue jsWorkerNavigatorConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSWorkerNavigatorPrototype* domObject = jsDynamicCast<JSWorkerNavigatorPrototype*>(JSValue::decode(thisValue));
if (UNLIKELY(!domObject))
return throwVMTypeError(state, throwScope);
return JSValue::encode(JSWorkerNavigator::getConstructor(state->vm(), domObject->globalObject()));
}
bool setJSWorkerNavigatorConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
{
VM& vm = state->vm();
auto throwScope = DECLARE_THROW_SCOPE(vm);
JSValue value = JSValue::decode(encodedValue);
JSWorkerNavigatorPrototype* domObject = jsDynamicCast<JSWorkerNavigatorPrototype*>(JSValue::decode(thisValue));
if (UNLIKELY(!domObject)) {
throwVMTypeError(state, throwScope);
return false;
}
// Shadowing a built-in constructor
return domObject->putDirect(state->vm(), state->propertyNames().constructor, value);
}
JSValue JSWorkerNavigator::getConstructor(VM& vm, const JSGlobalObject* globalObject)
{
return getDOMConstructor<JSWorkerNavigatorConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
}
bool JSWorkerNavigatorOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
{
auto* jsWorkerNavigator = jsCast<JSWorkerNavigator*>(handle.slot()->asCell());
WorkerNavigator* root = &jsWorkerNavigator->wrapped();
return visitor.containsOpaqueRoot(root);
}
void JSWorkerNavigatorOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
{
auto* jsWorkerNavigator = jsCast<JSWorkerNavigator*>(handle.slot()->asCell());
auto& world = *static_cast<DOMWrapperWorld*>(context);
uncacheWrapper(world, &jsWorkerNavigator->wrapped(), jsWorkerNavigator);
}
#if ENABLE(BINDING_INTEGRITY)
#if PLATFORM(WIN)
#pragma warning(disable: 4483)
extern "C" { extern void (*const __identifier("??_7WorkerNavigator@WebCore@@6B@")[])(); }
#else
extern "C" { extern void* _ZTVN7WebCore15WorkerNavigatorE[]; }
#endif
#endif
JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<WorkerNavigator>&& impl)
{
#if ENABLE(BINDING_INTEGRITY)
void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
#if PLATFORM(WIN)
void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7WorkerNavigator@WebCore@@6B@"));
#else
void* expectedVTablePointer = &_ZTVN7WebCore15WorkerNavigatorE[2];
#if COMPILER(CLANG)
// If this fails WorkerNavigator does not have a vtable, so you need to add the
// ImplementationLacksVTable attribute to the interface definition
static_assert(__is_polymorphic(WorkerNavigator), "WorkerNavigator is not polymorphic");
#endif
#endif
// If you hit this assertion you either have a use after free bug, or
// WorkerNavigator has subclasses. If WorkerNavigator has subclasses that get passed
// to toJS() we currently require WorkerNavigator you to opt out of binding hardening
// by adding the SkipVTableValidation attribute to the interface IDL definition
RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
#endif
return createWrapper<WorkerNavigator>(globalObject, WTFMove(impl));
}
JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, WorkerNavigator& impl)
{
return wrap(state, globalObject, impl);
}
WorkerNavigator* JSWorkerNavigator::toWrapped(JSC::JSValue value)
{
if (auto* wrapper = jsDynamicCast<JSWorkerNavigator*>(value))
return &wrapper->wrapped();
return nullptr;
}
}