Пример #1
0
void V8History::replaceStateMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    ExceptionState exceptionState(ExceptionState::ExecutionContext, "replaceState", "History", info.Holder(), info.GetIsolate());
    RefPtr<SerializedScriptValue> historyState = SerializedScriptValue::create(info[0], 0, 0, exceptionState, info.GetIsolate());
    if (exceptionState.throwIfNeeded())
        return;

    TOSTRING_VOID(V8StringResource<WithUndefinedOrNullCheck>, title, info[1]);
    TOSTRING_VOID(V8StringResource<WithUndefinedOrNullCheck>, url, argumentOrNull(info, 2));

    History* history = V8History::toNative(info.Holder());
    history->stateObjectAdded(historyState.release(), title, url, FrameLoadTypeRedirectWithLockedBackForwardList, exceptionState);
    V8HiddenValue::deleteHiddenValue(info.GetIsolate(), info.Holder(), V8HiddenValue::state(info.GetIsolate()));
    exceptionState.throwIfNeeded();
}
Пример #2
0
void V8History::replaceStateMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
{
    bool didThrow = false;
    RefPtr<SerializedScriptValue> historyState = SerializedScriptValue::create(args[0], 0, 0, didThrow, args.GetIsolate());
    if (didThrow)
        return;

    V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithUndefinedOrNullCheck>, title, args[1]);
    V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<WithUndefinedOrNullCheck>, url, argumentOrNull(args, 2));

    ExceptionCode ec = 0;
    History* history = V8History::toNative(args.Holder());
    history->stateObjectAdded(historyState.release(), title, url, History::StateObjectReplace, ec);
    args.Holder()->DeleteHiddenValue(V8HiddenPropertyName::state());
    v8SetReturnValue(args, setDOMException(ec, args.GetIsolate()));
}
Пример #3
0
v8::Handle<v8::Value> V8History::pushStateMethodCustom(const v8::Arguments& args)
{
    bool didThrow = false;
    RefPtr<SerializedScriptValue> historyState = SerializedScriptValue::create(args[0], 0, 0, didThrow, args.GetIsolate());
    if (didThrow)
        return v8::Undefined();

    V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<WithUndefinedOrNullCheck>, title, args[1]);
    V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<WithUndefinedOrNullCheck>, url, argumentOrNull(args, 2));

    ExceptionCode ec = 0;
    History* history = V8History::toNative(args.Holder());
    history->stateObjectAdded(historyState.release(), title, url, History::StateObjectPush, ec);
    args.Holder()->DeleteHiddenValue(V8HiddenPropertyName::state());
    return setDOMException(ec, args.GetIsolate());
}
v8::Handle<v8::Value> V8History::replaceStateCallback(const v8::Arguments& args)
{
    RefPtr<SerializedScriptValue> historyState = SerializedScriptValue::create(toWebCoreString(args[0]));

    v8::TryCatch tryCatch;
    String title = toWebCoreStringWithNullOrUndefinedCheck(args[1]);
    if (tryCatch.HasCaught())
        return v8::Undefined();
    String url;
    if (args.Length() > 2) {
        url = toWebCoreStringWithNullOrUndefinedCheck(args[2]);
        if (tryCatch.HasCaught())
            return v8::Undefined();
    }

    ExceptionCode ec = 0;
    History* history = V8DOMWrapper::convertToNativeObject<History>(V8ClassIndex::HISTORY, args.Holder());
    history->stateObjectAdded(historyState.release(), title, url, History::StateObjectReplace, ec);
    return throwError(ec);
}
v8::Handle<v8::Value> V8History::replaceStateCallback(const v8::Arguments& args)
{
    bool didThrow = false;
    RefPtr<SerializedScriptValue> historyState = SerializedScriptValue::create(args[0], didThrow);
    if (didThrow)
        return v8::Undefined();

    v8::TryCatch tryCatch;
    String title = toWebCoreStringWithNullOrUndefinedCheck(args[1]);
    if (tryCatch.HasCaught())
        return v8::Undefined();
    String url;
    if (args.Length() > 2) {
        url = toWebCoreStringWithNullOrUndefinedCheck(args[2]);
        if (tryCatch.HasCaught())
            return v8::Undefined();
    }

    ExceptionCode ec = 0;
    History* history = V8History::toNative(args.Holder());
    history->stateObjectAdded(historyState.release(), title, url, History::StateObjectReplace, ec);
    return throwError(ec);
}
Пример #6
0
v8::Handle<v8::Value> V8History::pushStateCallback(const v8::Arguments& args)
{
    bool didThrow = false;
    RefPtr<SerializedScriptValue> historyState = SerializedScriptValue::create(args[0], 0, 0, didThrow, args.GetIsolate());
    if (didThrow)
        return v8::Undefined();

    v8::TryCatch tryCatch;
    String title = toWebCoreStringWithNullOrUndefinedCheck(args[1]);
    if (tryCatch.HasCaught())
        return v8::Undefined();
    String url;
    if (args.Length() > 2) {
        url = toWebCoreStringWithNullOrUndefinedCheck(args[2]);
        if (tryCatch.HasCaught())
            return v8::Undefined();
    }

    ExceptionCode ec = 0;
    History* history = V8History::toNative(args.Holder());
    history->stateObjectAdded(historyState.release(), title, url, History::StateObjectPush, ec);
    args.Holder()->DeleteHiddenValue(V8HiddenPropertyName::state());
    return setDOMException(ec, args.GetIsolate());
}