Chromium Code Reviews| Index: third_party/WebKit/Source/bindings/core/v8/custom/V8WindowCustom.cpp |
| diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8WindowCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8WindowCustom.cpp |
| index 4680204cd7b75a6efb403ef7fe0de72613e35fd9..8cebbf373f04eb6321eb199ef1594b10df1d98b4 100644 |
| --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8WindowCustom.cpp |
| +++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8WindowCustom.cpp |
| @@ -43,6 +43,7 @@ |
| #include "bindings/core/v8/V8HTMLCollection.h" |
| #include "bindings/core/v8/V8HiddenValue.h" |
| #include "bindings/core/v8/V8Node.h" |
| +#include "bindings/core/v8/V8PrivateProperty.h" |
| #include "core/dom/DOMArrayBuffer.h" |
| #include "core/dom/MessagePort.h" |
| #include "core/frame/Deprecation.h" |
| @@ -119,26 +120,20 @@ void V8Window::locationAttributeGetterCustom( |
| void V8Window::eventAttributeGetterCustom( |
| const v8::FunctionCallbackInfo<v8::Value>& info) { |
| LocalDOMWindow* impl = toLocalDOMWindow(V8Window::toImpl(info.Holder())); |
| - ExceptionState exceptionState( |
| - info.GetIsolate(), ExceptionState::GetterContext, "Window", "event"); |
| - if (!BindingSecurity::shouldAllowAccessTo(currentDOMWindow(info.GetIsolate()), |
| - impl, exceptionState)) { |
| + v8::Isolate* isolate = info.GetIsolate(); |
| + ExceptionState exceptionState(isolate, ExceptionState::GetterContext, |
| + "Window", "event"); |
| + if (!BindingSecurity::shouldAllowAccessTo(currentDOMWindow(isolate), impl, |
| + exceptionState)) { |
| return; |
| } |
| LocalFrame* frame = impl->frame(); |
| ASSERT(frame); |
| - // This is a fast path to retrieve info.Holder()->CreationContext(). |
| - v8::Local<v8::Context> context = |
| - toV8Context(frame, DOMWrapperWorld::current(info.GetIsolate())); |
| - if (context.IsEmpty()) |
| - return; |
| - v8::Local<v8::Value> jsEvent = V8HiddenValue::getHiddenValue( |
| - ScriptState::current(info.GetIsolate()), context->Global(), |
| - V8HiddenValue::event(info.GetIsolate())); |
| - if (jsEvent.IsEmpty()) |
| - return; |
| + v8::Local<v8::Value> jsEvent = |
| + V8PrivateProperty::getGlobalEvent(isolate).getOrUndefined( |
| + isolate->GetCurrentContext(), info.Holder()); |
| v8SetReturnValue(info, jsEvent); |
| } |
| @@ -146,24 +141,19 @@ void V8Window::eventAttributeSetterCustom( |
| v8::Local<v8::Value> value, |
| const v8::FunctionCallbackInfo<v8::Value>& info) { |
| LocalDOMWindow* impl = toLocalDOMWindow(V8Window::toImpl(info.Holder())); |
| - ExceptionState exceptionState( |
| - info.GetIsolate(), ExceptionState::SetterContext, "Window", "event"); |
| - if (!BindingSecurity::shouldAllowAccessTo(currentDOMWindow(info.GetIsolate()), |
| - impl, exceptionState)) { |
| + v8::Isolate* isolate = info.GetIsolate(); |
| + ExceptionState exceptionState(isolate, ExceptionState::SetterContext, |
| + "Window", "event"); |
| + if (!BindingSecurity::shouldAllowAccessTo(currentDOMWindow(isolate), impl, |
| + exceptionState)) { |
| return; |
| } |
| LocalFrame* frame = impl->frame(); |
| ASSERT(frame); |
| - // This is a fast path to retrieve info.Holder()->CreationContext(). |
| - v8::Local<v8::Context> context = |
| - toV8Context(frame, DOMWrapperWorld::current(info.GetIsolate())); |
| - if (context.IsEmpty()) |
| - return; |
| - V8HiddenValue::setHiddenValue(ScriptState::current(info.GetIsolate()), |
| - context->Global(), |
| - V8HiddenValue::event(info.GetIsolate()), value); |
| + V8PrivateProperty::getGlobalEvent(isolate).set(isolate->GetCurrentContext(), |
| + info.Holder(), value); |
|
haraken
2017/03/29 06:35:39
It looks like that the comment in line 158 (before
Yuki
2017/03/29 06:46:41
Yes, the new code is more correct than before.
We
|
| } |
| void V8Window::frameElementAttributeGetterCustom( |