v8::Handle<v8::Value> V8InjectedScriptHost::inspectedObjectMethodCustom(const v8::Arguments& args)
{
    if (args.Length() < 1)
        return v8::Undefined();

    if (!args[0]->IsInt32())
        return throwTypeError("argument has to be an integer", args.GetIsolate());

    InjectedScriptHost* host = V8InjectedScriptHost::toNative(args.Holder());
    InjectedScriptHost::InspectableObject* object = host->inspectedObject(args[0]->ToInt32()->Value());
    return object->get(ScriptState::current()).v8Value();
}
void V8InjectedScriptHost::inspectedObjectMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    if (info.Length() < 1)
        return;

    if (!info[0]->IsInt32()) {
        throwTypeError("argument has to be an integer", info.GetIsolate());
        return;
    }

    InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holder());
    InjectedScriptHost::InspectableObject* object = host->inspectedObject(info[0]->ToInt32()->Value());
    v8SetReturnValue(info, object->get(ScriptState::current()).v8Value());
}
void V8InjectedScriptHost::inspectedObjectCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
    if (info.Length() < 1)
        return;

    if (!info[0]->IsInt32()) {
        V8ThrowException::throwTypeError(info.GetIsolate(), "argument has to be an integer");
        return;
    }

    v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext();
    InjectedScriptHost* host = V8InjectedScriptHost::unwrap(context, info.Holder());
    InjectedScriptHost::InspectableObject* object = host->inspectedObject(info[0].As<v8::Int32>()->Value());
    v8SetReturnValue(info, object->get(context));
}
Exemplo n.º 4
0
JSValue JSInjectedScriptHost::inspectedObject(ExecState* exec)
{
    if (exec->argumentCount() < 1)
        return jsUndefined();

    InjectedScriptHost::InspectableObject* object = impl()->inspectedObject(exec->argument(0).toInt32(exec));
    if (!object)
        return jsUndefined();

    JSLock lock(SilenceAssertionsOnly);
    ScriptValue scriptValue = object->get(exec);
    if (scriptValue.hasNoValue())
        return jsUndefined();

    return scriptValue.jsValue();
}