本文整理汇总了C++中JSIDBDatabase类的典型用法代码示例。如果您正苦于以下问题:C++ JSIDBDatabase类的具体用法?C++ JSIDBDatabase怎么用?C++ JSIDBDatabase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JSIDBDatabase类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: jsIDBDatabasePrototypeFunctionDeleteObjectStore
EncodedJSValue JSC_HOST_CALL jsIDBDatabasePrototypeFunctionDeleteObjectStore(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());
imp->deleteObjectStore(name, ec);
setDOMException(exec, ec);
return JSValue::encode(jsUndefined());
}
示例2: jsIDBDatabaseOnversionchange
EncodedJSValue jsIDBDatabaseOnversionchange(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();
if (EventListener* listener = impl.onversionchange()) {
if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
if (JSObject* jsFunction = jsListener->jsFunction(impl.scriptExecutionContext()))
return JSValue::encode(jsFunction);
}
}
return JSValue::encode(jsNull());
}
示例3: jsIDBDatabasePrototypeFunctionDispatchEvent
EncodedJSValue JSC_HOST_CALL jsIDBDatabasePrototypeFunctionDispatchEvent(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;
Event* evt(toEvent(exec->argument(0)));
if (exec->hadException())
return JSValue::encode(jsUndefined());
JSC::JSValue result = jsBoolean(imp->dispatchEvent(evt, ec));
setDOMException(exec, ec);
return JSValue::encode(result);
}
示例4: jsIDBDatabasePrototypeFunctionDeleteObjectStore
EncodedJSValue JSC_HOST_CALL jsIDBDatabasePrototypeFunctionDeleteObjectStore(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;
const String& name(exec->argument(0).isEmpty() ? String() : exec->argument(0).toString(exec)->value(exec));
if (exec->hadException())
return JSValue::encode(jsUndefined());
impl.deleteObjectStore(name, ec);
setDOMException(exec, ec);
return JSValue::encode(jsUndefined());
}
示例5: 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);
}
示例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: finalize
void JSIDBDatabaseOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
{
JSIDBDatabase* jsIDBDatabase = static_cast<JSIDBDatabase*>(handle.get().asCell());
DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
uncacheWrapper(world, jsIDBDatabase->impl(), jsIDBDatabase);
}
示例8: jsIDBDatabaseConstructor
JSValue jsIDBDatabaseConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSIDBDatabase* domObject = static_cast<JSIDBDatabase*>(asObject(slotBase));
return JSIDBDatabase::getConstructor(exec, domObject->globalObject());
}