OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2009, 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 #include "core/loader/FrameLoadRequest.h" | 60 #include "core/loader/FrameLoadRequest.h" |
61 #include "core/loader/FrameLoader.h" | 61 #include "core/loader/FrameLoader.h" |
62 #include "core/loader/FrameLoaderClient.h" | 62 #include "core/loader/FrameLoaderClient.h" |
63 #include "platform/LayoutTestSupport.h" | 63 #include "platform/LayoutTestSupport.h" |
64 #include "platform/v8_inspector/public/V8Debugger.h" | 64 #include "platform/v8_inspector/public/V8Debugger.h" |
65 #include "wtf/Assertions.h" | 65 #include "wtf/Assertions.h" |
66 #include "wtf/OwnPtr.h" | 66 #include "wtf/OwnPtr.h" |
67 | 67 |
68 namespace blink { | 68 namespace blink { |
69 | 69 |
70 void V8Window::eventAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Val
ue>& info) | 70 void V8Window::eventAttributeGetterCustom(const v8::FunctionCallbackInfo<v8::Val
ue>& info) |
71 { | 71 { |
72 LocalDOMWindow* impl = toLocalDOMWindow(V8Window::toImpl(info.Holder())); | 72 LocalDOMWindow* impl = toLocalDOMWindow(V8Window::toImpl(info.Holder())); |
73 ExceptionState exceptionState(ExceptionState::GetterContext, "event", "Windo
w", info.Holder(), info.GetIsolate()); | 73 ExceptionState exceptionState(ExceptionState::GetterContext, "event", "Windo
w", info.Holder(), info.GetIsolate()); |
74 if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindo
w(info.GetIsolate()), impl, exceptionState)) { | 74 if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindo
w(info.GetIsolate()), impl, exceptionState)) { |
75 exceptionState.throwIfNeeded(); | 75 exceptionState.throwIfNeeded(); |
76 return; | 76 return; |
77 } | 77 } |
78 | 78 |
79 LocalFrame* frame = impl->frame(); | 79 LocalFrame* frame = impl->frame(); |
80 ASSERT(frame); | 80 ASSERT(frame); |
81 // This is a fast path to retrieve info.Holder()->CreationContext(). | 81 // This is a fast path to retrieve info.Holder()->CreationContext(). |
82 v8::Local<v8::Context> context = toV8Context(frame, DOMWrapperWorld::current
(info.GetIsolate())); | 82 v8::Local<v8::Context> context = toV8Context(frame, DOMWrapperWorld::current
(info.GetIsolate())); |
83 if (context.IsEmpty()) | 83 if (context.IsEmpty()) |
84 return; | 84 return; |
85 | 85 |
86 v8::Local<v8::Value> jsEvent = V8HiddenValue::getHiddenValue(ScriptState::cu
rrent(info.GetIsolate()), context->Global(), V8HiddenValue::event(info.GetIsolat
e())); | 86 v8::Local<v8::Value> jsEvent = V8HiddenValue::getHiddenValue(ScriptState::cu
rrent(info.GetIsolate()), context->Global(), V8HiddenValue::event(info.GetIsolat
e())); |
87 if (jsEvent.IsEmpty()) | 87 if (jsEvent.IsEmpty()) |
88 return; | 88 return; |
89 v8SetReturnValue(info, jsEvent); | 89 v8SetReturnValue(info, jsEvent); |
90 } | 90 } |
91 | 91 |
92 void V8Window::eventAttributeSetterCustom(v8::Local<v8::Value> value, const v8::
PropertyCallbackInfo<void>& info) | 92 void V8Window::eventAttributeSetterCustom(v8::Local<v8::Value> value, const v8::
FunctionCallbackInfo<v8::Value>& info) |
93 { | 93 { |
94 LocalDOMWindow* impl = toLocalDOMWindow(V8Window::toImpl(info.Holder())); | 94 LocalDOMWindow* impl = toLocalDOMWindow(V8Window::toImpl(info.Holder())); |
95 ExceptionState exceptionState(ExceptionState::SetterContext, "event", "Windo
w", info.Holder(), info.GetIsolate()); | 95 ExceptionState exceptionState(ExceptionState::SetterContext, "event", "Windo
w", info.Holder(), info.GetIsolate()); |
96 if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindo
w(info.GetIsolate()), impl, exceptionState)) { | 96 if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindo
w(info.GetIsolate()), impl, exceptionState)) { |
97 exceptionState.throwIfNeeded(); | 97 exceptionState.throwIfNeeded(); |
98 return; | 98 return; |
99 } | 99 } |
100 | 100 |
101 LocalFrame* frame = impl->frame(); | 101 LocalFrame* frame = impl->frame(); |
102 ASSERT(frame); | 102 ASSERT(frame); |
103 // This is a fast path to retrieve info.Holder()->CreationContext(). | 103 // This is a fast path to retrieve info.Holder()->CreationContext(). |
104 v8::Local<v8::Context> context = toV8Context(frame, DOMWrapperWorld::current
(info.GetIsolate())); | 104 v8::Local<v8::Context> context = toV8Context(frame, DOMWrapperWorld::current
(info.GetIsolate())); |
105 if (context.IsEmpty()) | 105 if (context.IsEmpty()) |
106 return; | 106 return; |
107 | 107 |
108 V8HiddenValue::setHiddenValue(ScriptState::current(info.GetIsolate()), conte
xt->Global(), V8HiddenValue::event(info.GetIsolate()), value); | 108 V8HiddenValue::setHiddenValue(ScriptState::current(info.GetIsolate()), conte
xt->Global(), V8HiddenValue::event(info.GetIsolate()), value); |
109 } | 109 } |
110 | 110 |
111 void V8Window::frameElementAttributeGetterCustom(const v8::PropertyCallbackInfo<
v8::Value>& info) | 111 void V8Window::frameElementAttributeGetterCustom(const v8::FunctionCallbackInfo<
v8::Value>& info) |
112 { | 112 { |
113 LocalDOMWindow* impl = toLocalDOMWindow(V8Window::toImpl(info.Holder())); | 113 LocalDOMWindow* impl = toLocalDOMWindow(V8Window::toImpl(info.Holder())); |
114 | 114 |
115 if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindo
w(info.GetIsolate()), impl->frameElement(), DoNotReportSecurityError)) { | 115 if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindo
w(info.GetIsolate()), impl->frameElement(), DoNotReportSecurityError)) { |
116 v8SetReturnValueNull(info); | 116 v8SetReturnValueNull(info); |
117 return; | 117 return; |
118 } | 118 } |
119 | 119 |
120 // The wrapper for an <iframe> should get its prototype from the context of
the frame it's in, rather than its own frame. | 120 // The wrapper for an <iframe> should get its prototype from the context of
the frame it's in, rather than its own frame. |
121 // So, use its containing document as the creation context when wrapping. | 121 // So, use its containing document as the creation context when wrapping. |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 if (items->hasExactlyOneItem()) { | 338 if (items->hasExactlyOneItem()) { |
339 v8SetReturnValueFast(info, items->item(0), window); | 339 v8SetReturnValueFast(info, items->item(0), window); |
340 return; | 340 return; |
341 } | 341 } |
342 v8SetReturnValueFast(info, items, window); | 342 v8SetReturnValueFast(info, items, window); |
343 return; | 343 return; |
344 } | 344 } |
345 } | 345 } |
346 | 346 |
347 } // namespace blink | 347 } // namespace blink |
OLD | NEW |