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..6142fcae6d4eec05689352c8ef39e8e957bdb46b 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,10 +120,11 @@ 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; |
| } |
| @@ -130,13 +132,12 @@ void V8Window::eventAttributeGetterCustom( |
| ASSERT(frame); |
| // This is a fast path to retrieve info.Holder()->CreationContext(). |
| v8::Local<v8::Context> context = |
| - toV8Context(frame, DOMWrapperWorld::current(info.GetIsolate())); |
| + toV8Context(frame, DOMWrapperWorld::current(isolate)); |
| if (context.IsEmpty()) |
| return; |
| - v8::Local<v8::Value> jsEvent = V8HiddenValue::getHiddenValue( |
| - ScriptState::current(info.GetIsolate()), context->Global(), |
| - V8HiddenValue::event(info.GetIsolate())); |
| + v8::Local<v8::Value> jsEvent = V8PrivateProperty::getGlobalEvent(isolate).get( |
|
Yuki
2017/03/28 14:10:50
Seems like you can use getOrUndefined() without th
peria
2017/03/29 03:53:31
Done.
|
| + context, context->Global()); |
|
Yuki
2017/03/28 14:10:50
Not directly related to your CL, but we can use in
peria
2017/03/29 03:53:31
Done.
|
| if (jsEvent.IsEmpty()) |
| return; |
| v8SetReturnValue(info, jsEvent); |
| @@ -146,10 +147,11 @@ 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; |
| } |
| @@ -157,13 +159,12 @@ void V8Window::eventAttributeSetterCustom( |
| ASSERT(frame); |
| // This is a fast path to retrieve info.Holder()->CreationContext(). |
| v8::Local<v8::Context> context = |
| - toV8Context(frame, DOMWrapperWorld::current(info.GetIsolate())); |
| + toV8Context(frame, DOMWrapperWorld::current(isolate)); |
| if (context.IsEmpty()) |
| return; |
| - V8HiddenValue::setHiddenValue(ScriptState::current(info.GetIsolate()), |
| - context->Global(), |
| - V8HiddenValue::event(info.GetIsolate()), value); |
| + V8PrivateProperty::getGlobalEvent(isolate).set(context, context->Global(), |
|
Yuki
2017/03/28 14:10:50
Ditto.
Not directly related to your CL, this can
peria
2017/03/29 03:53:31
Done.
|
| + value); |
| } |
| void V8Window::frameElementAttributeGetterCustom( |