Exemplo n.º 1
0
JSValue jsIDBIndexUnique(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSIDBIndex* castedThis = static_cast<JSIDBIndex*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    IDBIndex* imp = static_cast<IDBIndex*>(castedThis->impl());
    JSValue result = jsBoolean(imp->unique());
    return result;
}
Exemplo n.º 2
0
JSValue jsIDBIndexKeyPath(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSIDBIndex* castedThis = static_cast<JSIDBIndex*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    IDBIndex* imp = static_cast<IDBIndex*>(castedThis->impl());
    JSValue result = jsString(exec, imp->keyPath());
    return result;
}
Exemplo n.º 3
0
JSValue jsIDBIndexObjectStore(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSIDBIndex* castedThis = static_cast<JSIDBIndex*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    IDBIndex* imp = static_cast<IDBIndex*>(castedThis->impl());
    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->objectStore()));
    return result;
}
Exemplo n.º 4
0
void IDBDatabase::renameIndex(IDBIndex& index, const String& newName)
{
    ASSERT(&originThread() == &Thread::current());
    ASSERT(m_versionChangeTransaction);
    ASSERT(m_info.hasObjectStore(index.objectStore().info().name()));
    ASSERT(m_info.infoForExistingObjectStore(index.objectStore().info().name())->hasIndex(index.info().name()));

    m_info.infoForExistingObjectStore(index.objectStore().info().name())->infoForExistingIndex(index.info().identifier())->rename(newName);

    m_versionChangeTransaction->renameIndex(index, newName);
}
Exemplo n.º 5
0
EncodedJSValue JSC_HOST_CALL jsIDBIndexPrototypeFunctionGetKey(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSIDBIndex::s_info))
        return throwVMTypeError(exec);
    JSIDBIndex* castedThis = static_cast<JSIDBIndex*>(asObject(thisValue));
    ASSERT_GC_OBJECT_INHERITS(castedThis, &JSIDBIndex::s_info);
    IDBIndex* imp = static_cast<IDBIndex*>(castedThis->impl());
    ExceptionCode ec = 0;
    ScriptExecutionContext* scriptContext = static_cast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();
    if (!scriptContext)
        return JSValue::encode(jsUndefined());
    RefPtr<IDBKey> key(createIDBKeyFromValue(exec, exec->argument(0)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());


    JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->getKey(scriptContext, key, ec)));
    setDOMException(exec, ec);
    return JSValue::encode(result);
}
Exemplo n.º 6
0
EncodedJSValue JSC_HOST_CALL jsIDBIndexPrototypeFunctionOpenKeyCursor(ExecState* exec)
{
    JSValue thisValue = exec->hostThisValue();
    if (!thisValue.inherits(&JSIDBIndex::s_info))
        return throwVMTypeError(exec);
    JSIDBIndex* castedThis = static_cast<JSIDBIndex*>(asObject(thisValue));
    ASSERT_GC_OBJECT_INHERITS(castedThis, &JSIDBIndex::s_info);
    IDBIndex* imp = static_cast<IDBIndex*>(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->openKeyCursor(scriptContext, ec)));
        setDOMException(exec, ec);
        return JSValue::encode(result);
    }

    IDBKeyRange* range(toIDBKeyRange(exec->argument(0)));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());
    if (argsCount <= 1) {

        JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->openKeyCursor(scriptContext, range, ec)));
        setDOMException(exec, ec);
        return JSValue::encode(result);
    }

    unsigned short direction(exec->argument(1).toUInt32(exec));
    if (exec->hadException())
        return JSValue::encode(jsUndefined());


    JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->openKeyCursor(scriptContext, range, direction, ec)));
    setDOMException(exec, ec);
    return JSValue::encode(result);
}
Exemplo n.º 7
0
static v8::Handle<v8::Value> uniqueAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.IDBIndex.unique._get");
    IDBIndex* imp = V8IDBIndex::toNative(info.Holder());
    return v8Boolean(imp->unique());
}
Exemplo n.º 8
0
static v8::Handle<v8::Value> keyPathAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.IDBIndex.keyPath._get");
    IDBIndex* imp = V8IDBIndex::toNative(info.Holder());
    return v8String(imp->keyPath());
}