1 /* 2 * Copyright (C) 2000 Harri Porten (porten (at) kde.org) 3 * Copyright (C) 2001 Peter Kelly (pmk (at) post.com) 4 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. 5 * Copyright (C) 2006 James G. Speth (speth (at) end.com) 6 * Copyright (C) 2006 Samuel Weinig (sam (at) webkit.org) 7 * Copyright (C) 2007, 2008, 2009 Google Inc. All Rights Reserved. 8 * 9 * This library is free software; you can redistribute it and/or 10 * modify it under the terms of the GNU Lesser General Public 11 * License as published by the Free Software Foundation; either 12 * version 2 of the License, or (at your option) any later version. 13 * 14 * This library is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 * Lesser General Public License for more details. 18 * 19 * You should have received a copy of the GNU Lesser General Public 20 * License along with this library; if not, write to the Free Software 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 */ 23 24 #include "config.h" 25 #include "V8Document.h" 26 27 #include "DOMWindow.h" 28 #include "Frame.h" 29 #include "V8Binding.h" 30 #include "V8Location.h" 31 #include "V8Proxy.h" 32 33 namespace WebCore { 34 35 v8::Handle<v8::Value> V8Document::locationAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) 36 { 37 Document* document = V8Document::toNative(info.Holder()); 38 if (!document->frame()) 39 return v8::Null(); 40 41 DOMWindow* window = document->frame()->domWindow(); 42 return toV8(window->location()); 43 } 44 45 void V8Document::locationAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) 46 { 47 Document* document = V8Document::toNative(info.Holder()); 48 if (!document->frame()) 49 return; 50 51 DOMWindow* window = document->frame()->domWindow(); 52 // setLocation does security checks. // XXXMB- verify! 53 V8DOMWindowShell::setLocation(window, toWebCoreString(value)); 54 } 55 56 } // namespace WebCore 57