Chromium Code Reviews| Index: Source/bindings/core/v8/custom/V8WindowCustom.cpp |
| diff --git a/Source/bindings/core/v8/custom/V8WindowCustom.cpp b/Source/bindings/core/v8/custom/V8WindowCustom.cpp |
| index b0a945f5f24a56d81d984a29cc6ba46b2ab83294..afb6214d11faf082b77853ca1432f72a5438cf8f 100644 |
| --- a/Source/bindings/core/v8/custom/V8WindowCustom.cpp |
| +++ b/Source/bindings/core/v8/custom/V8WindowCustom.cpp |
| @@ -78,7 +78,7 @@ static void windowSetTimeoutImpl(const v8::FunctionCallbackInfo<v8::Value>& info |
| if (argumentCount < 1) |
| return; |
| - LocalDOMWindow* impl = V8Window::toImpl(info.Holder()); |
| + LocalDOMWindow* impl = toLocalDOMWindow(V8Window::toImpl(info.Holder())); |
| if (!impl->frame() || !impl->document()) { |
| exceptionState.throwDOMException(InvalidAccessError, "No script context is available in which to execute the script."); |
| return; |
| @@ -149,7 +149,7 @@ static void windowSetTimeoutImpl(const v8::FunctionCallbackInfo<v8::Value>& info |
| void V8Window::eventAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| - LocalFrame* frame = V8Window::toImpl(info.Holder())->frame(); |
| + LocalFrame* frame = toLocalDOMWindow(V8Window::toImpl(info.Holder()))->frame(); |
| ExceptionState exceptionState(ExceptionState::GetterContext, "event", "Window", info.Holder(), info.GetIsolate()); |
| if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), frame, exceptionState)) { |
| exceptionState.throwIfNeeded(); |
| @@ -170,7 +170,7 @@ void V8Window::eventAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Val |
| void V8Window::eventAttributeSetterCustom(v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| - LocalFrame* frame = V8Window::toImpl(info.Holder())->frame(); |
| + LocalFrame* frame = toLocalDOMWindow(V8Window::toImpl(info.Holder()))->frame(); |
| ExceptionState exceptionState(ExceptionState::SetterContext, "event", "Window", info.Holder(), info.GetIsolate()); |
| if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), frame, exceptionState)) { |
| exceptionState.throwIfNeeded(); |
| @@ -188,7 +188,7 @@ void V8Window::eventAttributeSetterCustom(v8::Local<v8::Value> value, const v8:: |
| void V8Window::frameElementAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| - LocalDOMWindow* impl = V8Window::toImpl(info.Holder()); |
| + LocalDOMWindow* impl = toLocalDOMWindow(V8Window::toImpl(info.Holder())); |
| ExceptionState exceptionState(ExceptionState::GetterContext, "frame", "Window", info.Holder(), info.GetIsolate()); |
| if (!BindingSecurity::shouldAllowAccessToNode(info.GetIsolate(), impl->frameElement(), exceptionState)) { |
| v8SetReturnValueNull(info); |
| @@ -206,7 +206,7 @@ void V8Window::frameElementAttributeGetterCustom(const v8::PropertyCallbackInfo< |
| void V8Window::openerAttributeSetterCustom(v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) |
| { |
| - LocalDOMWindow* impl = V8Window::toImpl(info.Holder()); |
| + LocalDOMWindow* impl = toLocalDOMWindow(V8Window::toImpl(info.Holder())); |
| ExceptionState exceptionState(ExceptionState::SetterContext, "opener", "Window", info.Holder(), info.GetIsolate()); |
| if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->frame(), exceptionState)) { |
| exceptionState.throwIfNeeded(); |
| @@ -243,7 +243,8 @@ void V8Window::postMessageMethodCustom(const v8::FunctionCallbackInfo<v8::Value> |
| { |
| // None of these need to be RefPtr because info and context are guaranteed |
| // to hold on to them. |
| - LocalDOMWindow* window = V8Window::toImpl(info.Holder()); |
| + // FIXME: This is likely to be problematic for the use counters below. |
|
haraken
2014/11/08 09:17:24
Just help me understand: Why is it problematic?
I
dcheng
2014/11/08 23:59:55
UseCounter::countIfNotPrivateScript has two overlo
|
| + DOMWindow* window = V8Window::toImpl(info.Holder()); |
| LocalDOMWindow* source = callingDOMWindow(info.GetIsolate()); |
| ASSERT(window); |
| @@ -355,7 +356,7 @@ static void setUpDialog(LocalDOMWindow* dialog, void* handler) |
| void V8Window::showModalDialogMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| - LocalDOMWindow* impl = V8Window::toImpl(info.Holder()); |
| + LocalDOMWindow* impl = toLocalDOMWindow(V8Window::toImpl(info.Holder())); |
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "showModalDialog", "Window", info.Holder(), info.GetIsolate()); |
| if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->frame(), exceptionState)) { |
| exceptionState.throwIfNeeded(); |
| @@ -373,7 +374,7 @@ void V8Window::showModalDialogMethodCustom(const v8::FunctionCallbackInfo<v8::Va |
| void V8Window::openMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info) |
| { |
| - LocalDOMWindow* impl = V8Window::toImpl(info.Holder()); |
| + LocalDOMWindow* impl = toLocalDOMWindow(V8Window::toImpl(info.Holder())); |
| ExceptionState exceptionState(ExceptionState::ExecutionContext, "open", "Window", info.Holder(), info.GetIsolate()); |
| if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->frame(), exceptionState)) { |
| exceptionState.throwIfNeeded(); |
| @@ -399,8 +400,7 @@ void V8Window::openMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info) |
| void V8Window::namedPropertyGetterCustom(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| - |
| - LocalDOMWindow* window = V8Window::toImpl(info.Holder()); |
| + LocalDOMWindow* window = toLocalDOMWindow(V8Window::toImpl(info.Holder())); |
| if (!window) |
| return; |
| @@ -462,7 +462,8 @@ bool V8Window::namedSecurityCheckCustom(v8::Local<v8::Object> host, v8::Local<v8 |
| if (window.IsEmpty()) |
| return false; // the frame is gone. |
| - LocalDOMWindow* targetWindow = V8Window::toImpl(window); |
| + // FIXME: Do not commit. Uncertain if this is correct. |
| + LocalDOMWindow* targetWindow = toLocalDOMWindow(V8Window::toImpl(window)); |
|
haraken
2014/11/08 09:17:25
I think V8Window::toImpl(window) can be a RemoteDO
dcheng
2014/11/08 23:59:55
Done.
|
| ASSERT(targetWindow); |
| @@ -505,7 +506,8 @@ bool V8Window::indexedSecurityCheckCustom(v8::Local<v8::Object> host, uint32_t i |
| if (window.IsEmpty()) |
| return false; |
| - LocalDOMWindow* targetWindow = V8Window::toImpl(window); |
| + // FIXME: Do not commit. Uncertain if this is correct. |
| + LocalDOMWindow* targetWindow = toLocalDOMWindow(V8Window::toImpl(window)); |
|
haraken
2014/11/08 09:17:25
Ditto.
dcheng
2014/11/08 23:59:55
Done.
|
| ASSERT(targetWindow); |
| @@ -532,15 +534,16 @@ bool V8Window::indexedSecurityCheckCustom(v8::Local<v8::Object> host, uint32_t i |
| return BindingSecurity::shouldAllowAccessToFrame(isolate, target, DoNotReportSecurityError); |
| } |
| -v8::Handle<v8::Value> toV8(LocalDOMWindow* window, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| +v8::Handle<v8::Value> toV8(DOMWindow* window, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| { |
| // Notice that we explicitly ignore creationContext because the LocalDOMWindow is its own creationContext. |
| - if (!window) |
| + // FIXME: How is this used? Does this need to be able to handle remote DOM windows? |
|
haraken
2014/11/08 09:17:25
I don't fully understand this comment.
The !windo
dcheng
2014/11/08 23:59:56
I've updated this FIXME. We do need to handle this
|
| + if (!window || !window->isLocalDOMWindow()) |
| return v8::Null(isolate); |
| // Initializes environment of a frame, and return the global object |
| // of the frame. |
| - LocalFrame* frame = window->frame(); |
| + LocalFrame* frame = toLocalDOMWindow(window)->frame(); |
| if (!frame) |
| return v8Undefined(); |