JSValue JSDocument::location(ExecState* exec) const
{
    Frame* frame = static_cast<Document*>(impl())->frame();
    if (!frame)
        return jsNull();

    Location* location = frame->domWindow()->location();
    if (JSDOMWrapper* wrapper = getCachedWrapper(currentWorld(exec), location))
        return wrapper;

    JSLocation* jsLocation = JSLocation::create(getDOMStructure<JSLocation>(exec, globalObject()), globalObject(), location);
    cacheWrapper(currentWorld(exec), location, jsLocation);
    return jsLocation;
}
Example #2
0
JSValue JSDocument::location(ExecState* exec) const
{
    RefPtr<Frame> frame = impl().frame();
    if (!frame)
        return jsNull();

    RefPtr<Location> location = frame->document()->domWindow()->location();
    if (JSObject* wrapper = getCachedWrapper(globalObject()->world(), location.get()))
        return wrapper;

    JSLocation* jsLocation = JSLocation::create(getDOMStructure<JSLocation>(exec->vm(), globalObject()), globalObject(), location.get());
    cacheWrapper(globalObject()->world(), location.get(), jsLocation);
    return jsLocation;
}