v8::Handle<v8::Value> V8Document::locationAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    Document* document = V8Document::toNative(info.Holder());
    if (!document->frame())
        return v8::Null(info.GetIsolate());

    DOMWindow* window = document->domWindow();
    return toV8(window->location(), info.Holder(), info.GetIsolate());
}
void V8Document::locationAttrGetterCustom(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
    Document* document = V8Document::toNative(info.Holder());
    if (!document->frame()) {
        v8SetReturnValueNull(info);
        return;
    }

    DOMWindow* window = document->domWindow();
    v8SetReturnValue(info, toV8Fast(window->location(), info, document));
}
void V8Window::locationAttrSetterCustom(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
{
    DOMWindow* imp = V8Window::toNative(info.Holder());

    DOMWindow* active = activeDOMWindow();
    if (!active)
        return;

    DOMWindow* first = firstDOMWindow();
    if (!first)
        return;

    if (Location* location = imp->location())
        location->setHref(active, first, toWebCoreString(value));
}
void V8Document::locationAttrSetterCustom(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
{
    Document* document = V8Document::toNative(info.Holder());
    if (!document->frame())
        return;

    DOMWindow* active = activeDOMWindow();
    if (!active)
        return;

    DOMWindow* first = firstDOMWindow();
    if (!first)
        return;

    DOMWindow* window = document->domWindow();
    if (Location* location = window->location())
        location->setHref(active, first, toWebCoreString(value));
}
void V8Document::locationAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
    Document* document = V8Document::toNative(info.Holder());
    if (!document->frame())
        return;

    BindingState* state = BindingState::instance();

    DOMWindow* active = activeDOMWindow(state);
    if (!active)
        return;

    DOMWindow* first = firstDOMWindow(state);
    if (!first)
        return;

    DOMWindow* window = document->domWindow();
    if (Location* location = window->location())
        location->setHref(toWebCoreString(value), active, first);
}