| 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 26 matching lines...) Expand all Loading... |
| 37 #include "bindings/v8/ExceptionMessages.h" | 37 #include "bindings/v8/ExceptionMessages.h" |
| 38 #include "bindings/v8/ExceptionState.h" | 38 #include "bindings/v8/ExceptionState.h" |
| 39 #include "bindings/v8/ScheduledAction.h" | 39 #include "bindings/v8/ScheduledAction.h" |
| 40 #include "bindings/v8/ScriptController.h" | 40 #include "bindings/v8/ScriptController.h" |
| 41 #include "bindings/v8/ScriptSourceCode.h" | 41 #include "bindings/v8/ScriptSourceCode.h" |
| 42 #include "bindings/v8/SerializedScriptValue.h" | 42 #include "bindings/v8/SerializedScriptValue.h" |
| 43 #include "bindings/v8/V8Binding.h" | 43 #include "bindings/v8/V8Binding.h" |
| 44 #include "bindings/v8/V8EventListener.h" | 44 #include "bindings/v8/V8EventListener.h" |
| 45 #include "bindings/v8/V8EventListenerList.h" | 45 #include "bindings/v8/V8EventListenerList.h" |
| 46 #include "bindings/v8/V8GCForContextDispose.h" | 46 #include "bindings/v8/V8GCForContextDispose.h" |
| 47 #include "bindings/v8/V8HiddenPropertyName.h" | |
| 48 #include "bindings/v8/V8Utilities.h" | 47 #include "bindings/v8/V8Utilities.h" |
| 49 #include "core/dom/ExceptionCode.h" | 48 #include "core/dom/ExceptionCode.h" |
| 50 #include "core/dom/MessagePort.h" | 49 #include "core/dom/MessagePort.h" |
| 51 #include "core/html/HTMLCollection.h" | 50 #include "core/html/HTMLCollection.h" |
| 52 #include "core/html/HTMLDocument.h" | 51 #include "core/html/HTMLDocument.h" |
| 53 #include "core/inspector/ScriptCallStack.h" | 52 #include "core/inspector/ScriptCallStack.h" |
| 54 #include "core/loader/FrameLoadRequest.h" | 53 #include "core/loader/FrameLoadRequest.h" |
| 55 #include "core/loader/FrameLoader.h" | 54 #include "core/loader/FrameLoader.h" |
| 56 #include "core/frame/ContentSecurityPolicy.h" | 55 #include "core/frame/ContentSecurityPolicy.h" |
| 57 #include "core/frame/DOMTimer.h" | 56 #include "core/frame/DOMTimer.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 if (!BindingSecurity::shouldAllowAccessToFrame(frame, exceptionState)) { | 155 if (!BindingSecurity::shouldAllowAccessToFrame(frame, exceptionState)) { |
| 157 exceptionState.throwIfNeeded(); | 156 exceptionState.throwIfNeeded(); |
| 158 return; | 157 return; |
| 159 } | 158 } |
| 160 | 159 |
| 161 ASSERT(frame); | 160 ASSERT(frame); |
| 162 v8::Local<v8::Context> context = frame->script().currentWorldContextOrMainWo
rldContext(); | 161 v8::Local<v8::Context> context = frame->script().currentWorldContextOrMainWo
rldContext(); |
| 163 if (context.IsEmpty()) | 162 if (context.IsEmpty()) |
| 164 return; | 163 return; |
| 165 | 164 |
| 166 v8::Handle<v8::String> eventSymbol = V8HiddenPropertyName::event(info.GetIso
late()); | 165 v8::Handle<v8::Value> jsEvent = getHiddenValue(info.GetIsolate(), context->G
lobal(), "event"); |
| 167 v8::Handle<v8::Value> jsEvent = context->Global()->GetHiddenValue(eventSymbo
l); | |
| 168 if (jsEvent.IsEmpty()) | 166 if (jsEvent.IsEmpty()) |
| 169 return; | 167 return; |
| 170 v8SetReturnValue(info, jsEvent); | 168 v8SetReturnValue(info, jsEvent); |
| 171 } | 169 } |
| 172 | 170 |
| 173 void V8Window::eventAttributeSetterCustom(v8::Local<v8::Value> value, const v8::
PropertyCallbackInfo<void>& info) | 171 void V8Window::eventAttributeSetterCustom(v8::Local<v8::Value> value, const v8::
PropertyCallbackInfo<void>& info) |
| 174 { | 172 { |
| 175 Frame* frame = V8Window::toNative(info.Holder())->frame(); | 173 Frame* frame = V8Window::toNative(info.Holder())->frame(); |
| 176 ExceptionState exceptionState(ExceptionState::SetterContext, "event", "Windo
w", info.Holder(), info.GetIsolate()); | 174 ExceptionState exceptionState(ExceptionState::SetterContext, "event", "Windo
w", info.Holder(), info.GetIsolate()); |
| 177 if (!BindingSecurity::shouldAllowAccessToFrame(frame, exceptionState)) { | 175 if (!BindingSecurity::shouldAllowAccessToFrame(frame, exceptionState)) { |
| 178 exceptionState.throwIfNeeded(); | 176 exceptionState.throwIfNeeded(); |
| 179 return; | 177 return; |
| 180 } | 178 } |
| 181 | 179 |
| 182 ASSERT(frame); | 180 ASSERT(frame); |
| 183 v8::Local<v8::Context> context = frame->script().currentWorldContextOrMainWo
rldContext(); | 181 v8::Local<v8::Context> context = frame->script().currentWorldContextOrMainWo
rldContext(); |
| 184 if (context.IsEmpty()) | 182 if (context.IsEmpty()) |
| 185 return; | 183 return; |
| 186 | 184 |
| 187 v8::Handle<v8::String> eventSymbol = V8HiddenPropertyName::event(info.GetIso
late()); | 185 setHiddenValue(info.GetIsolate(), context->Global(), "event", value); |
| 188 context->Global()->SetHiddenValue(eventSymbol, value); | |
| 189 } | 186 } |
| 190 | 187 |
| 191 void V8Window::frameElementAttributeGetterCustom(const v8::PropertyCallbackInfo<
v8::Value>& info) | 188 void V8Window::frameElementAttributeGetterCustom(const v8::PropertyCallbackInfo<
v8::Value>& info) |
| 192 { | 189 { |
| 193 DOMWindow* imp = V8Window::toNative(info.Holder()); | 190 DOMWindow* imp = V8Window::toNative(info.Holder()); |
| 194 ExceptionState exceptionState(ExceptionState::GetterContext, "frame", "Windo
w", info.Holder(), info.GetIsolate()); | 191 ExceptionState exceptionState(ExceptionState::GetterContext, "frame", "Windo
w", info.Holder(), info.GetIsolate()); |
| 195 if (!BindingSecurity::shouldAllowAccessToNode(imp->frameElement(), exception
State)) { | 192 if (!BindingSecurity::shouldAllowAccessToNode(imp->frameElement(), exception
State)) { |
| 196 v8SetReturnValueNull(info); | 193 v8SetReturnValueNull(info); |
| 197 exceptionState.throwIfNeeded(); | 194 exceptionState.throwIfNeeded(); |
| 198 return; | 195 return; |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 v8::Handle<v8::Context> context = frame->script().currentWorldContextOrMainW
orldContext(); | 547 v8::Handle<v8::Context> context = frame->script().currentWorldContextOrMainW
orldContext(); |
| 551 if (context.IsEmpty()) | 548 if (context.IsEmpty()) |
| 552 return v8Undefined(); | 549 return v8Undefined(); |
| 553 | 550 |
| 554 v8::Handle<v8::Object> global = context->Global(); | 551 v8::Handle<v8::Object> global = context->Global(); |
| 555 ASSERT(!global.IsEmpty()); | 552 ASSERT(!global.IsEmpty()); |
| 556 return global; | 553 return global; |
| 557 } | 554 } |
| 558 | 555 |
| 559 } // namespace WebCore | 556 } // namespace WebCore |
| OLD | NEW |