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