本文整理汇总了C++中JSIDBDatabase::globalObject方法的典型用法代码示例。如果您正苦于以下问题:C++ JSIDBDatabase::globalObject方法的具体用法?C++ JSIDBDatabase::globalObject怎么用?C++ JSIDBDatabase::globalObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JSIDBDatabase
的用法示例。
在下文中一共展示了JSIDBDatabase::globalObject方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: jsIDBDatabasePrototypeFunctionCreateObjectStore
EncodedJSValue JSC_HOST_CALL jsIDBDatabasePrototypeFunctionCreateObjectStore(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSIDBDatabase::s_info))
return throwVMTypeError(exec);
JSIDBDatabase* castedThis = static_cast<JSIDBDatabase*>(asObject(thisValue));
IDBDatabase* imp = static_cast<IDBDatabase*>(castedThis->impl());
ExceptionCode ec = 0;
const String& name(ustringToString(exec->argument(0).toString(exec)));
if (exec->hadException())
return JSValue::encode(jsUndefined());
int argsCount = exec->argumentCount();
if (argsCount <= 1) {
JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->createObjectStore(name, ec)));
setDOMException(exec, ec);
return JSValue::encode(result);
}
OptionsObject* options(toOptionsObject(exec->argument(1)));
if (exec->hadException())
return JSValue::encode(jsUndefined());
JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->createObjectStore(name, options, ec)));
setDOMException(exec, ec);
return JSValue::encode(result);
}
示例2: throwVMTypeError
static EncodedJSValue JSC_HOST_CALL jsIDBDatabasePrototypeFunctionTransaction2(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
JSIDBDatabase* castedThis = jsDynamicCast<JSIDBDatabase*>(thisValue);
if (!castedThis)
return throwVMTypeError(exec);
ASSERT_GC_OBJECT_INHERITS(castedThis, JSIDBDatabase::info());
IDBDatabase& impl = castedThis->impl();
if (exec->argumentCount() < 1)
return throwVMError(exec, createNotEnoughArgumentsError(exec));
ExceptionCode ec = 0;
ScriptExecutionContext* scriptContext = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();
if (!scriptContext)
return JSValue::encode(jsUndefined());
Vector<String> storeNames(toNativeArray<String>(exec, exec->argument(0)));
if (exec->hadException())
return JSValue::encode(jsUndefined());
const String& mode(argumentOrNull(exec, 1).isEmpty() ? String() : argumentOrNull(exec, 1).toString(exec)->value(exec));
if (exec->hadException())
return JSValue::encode(jsUndefined());
JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.transaction(scriptContext, storeNames, mode, ec)));
setDOMException(exec, ec);
return JSValue::encode(result);
}
示例3: jsIDBDatabaseObjectStoreNames
JSValue jsIDBDatabaseObjectStoreNames(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSIDBDatabase* castedThis = static_cast<JSIDBDatabase*>(asObject(slotBase));
UNUSED_PARAM(exec);
IDBDatabase* imp = static_cast<IDBDatabase*>(castedThis->impl());
JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->objectStoreNames()));
return result;
}
示例4: jsIDBDatabaseConstructor
EncodedJSValue jsIDBDatabaseConstructor(ExecState* exec, EncodedJSValue thisValue, EncodedJSValue, PropertyName)
{
JSIDBDatabase* domObject = jsDynamicCast<JSIDBDatabase*>(JSValue::decode(thisValue));
if (!domObject)
return throwVMTypeError(exec);
if (!domObject)
return throwVMTypeError(exec);
return JSValue::encode(JSIDBDatabase::getConstructor(exec->vm(), domObject->globalObject()));
}
示例5: jsIDBDatabaseObjectStoreNames
EncodedJSValue jsIDBDatabaseObjectStoreNames(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
JSIDBDatabase* castedThis = jsDynamicCast<JSIDBDatabase*>(JSValue::decode(thisValue));
UNUSED_PARAM(slotBase);
if (!castedThis)
return throwVMTypeError(exec);
UNUSED_PARAM(exec);
IDBDatabase& impl = castedThis->impl();
JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl.objectStoreNames()));
return JSValue::encode(result);
}
示例6: jsIDBDatabasePrototypeFunctionTransaction
EncodedJSValue JSC_HOST_CALL jsIDBDatabasePrototypeFunctionTransaction(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSIDBDatabase::s_info))
return throwVMTypeError(exec);
JSIDBDatabase* castedThis = static_cast<JSIDBDatabase*>(asObject(thisValue));
IDBDatabase* imp = static_cast<IDBDatabase*>(castedThis->impl());
ExceptionCode ec = 0;
ScriptExecutionContext* scriptContext = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();
if (!scriptContext)
return JSValue::encode(jsUndefined());
int argsCount = exec->argumentCount();
if (argsCount <= 0) {
JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->transaction(scriptContext, ec)));
setDOMException(exec, ec);
return JSValue::encode(result);
}
DOMStringList* storeNames(toDOMStringList(exec->argument(0)));
if (exec->hadException())
return JSValue::encode(jsUndefined());
if (argsCount <= 1) {
JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->transaction(scriptContext, storeNames, ec)));
setDOMException(exec, ec);
return JSValue::encode(result);
}
unsigned short mode(exec->argument(1).toUInt32(exec));
if (exec->hadException())
return JSValue::encode(jsUndefined());
JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->transaction(scriptContext, storeNames, mode, ec)));
setDOMException(exec, ec);
return JSValue::encode(result);
}
示例7: jsIDBDatabasePrototypeFunctionSetVersion
EncodedJSValue JSC_HOST_CALL jsIDBDatabasePrototypeFunctionSetVersion(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSIDBDatabase::s_info))
return throwVMTypeError(exec);
JSIDBDatabase* castedThis = static_cast<JSIDBDatabase*>(asObject(thisValue));
IDBDatabase* imp = static_cast<IDBDatabase*>(castedThis->impl());
ExceptionCode ec = 0;
ScriptExecutionContext* scriptContext = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();
if (!scriptContext)
return JSValue::encode(jsUndefined());
const String& version(ustringToString(exec->argument(0).toString(exec)));
if (exec->hadException())
return JSValue::encode(jsUndefined());
JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->setVersion(scriptContext, version, ec)));
setDOMException(exec, ec);
return JSValue::encode(result);
}
示例8: jsIDBDatabaseConstructor
JSValue jsIDBDatabaseConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSIDBDatabase* domObject = static_cast<JSIDBDatabase*>(asObject(slotBase));
return JSIDBDatabase::getConstructor(exec, domObject->globalObject());
}