Chromium Code Reviews| Index: third_party/WebKit/Source/bindings/core/v8/V8AbstractEventListener.cpp |
| diff --git a/third_party/WebKit/Source/bindings/core/v8/V8AbstractEventListener.cpp b/third_party/WebKit/Source/bindings/core/v8/V8AbstractEventListener.cpp |
| index c61b2d15c52dd685c792361e7019c267ca084446..5897a284da4e41cb53581ad9eb6c60ec8aed100f 100644 |
| --- a/third_party/WebKit/Source/bindings/core/v8/V8AbstractEventListener.cpp |
| +++ b/third_party/WebKit/Source/bindings/core/v8/V8AbstractEventListener.cpp |
| @@ -34,7 +34,7 @@ |
| #include "bindings/core/v8/V8Event.h" |
| #include "bindings/core/v8/V8EventListenerHelper.h" |
| #include "bindings/core/v8/V8EventTarget.h" |
| -#include "bindings/core/v8/V8HiddenValue.h" |
| +#include "bindings/core/v8/V8PrivateProperty.h" |
| #include "core/dom/Document.h" |
| #include "core/dom/DocumentParser.h" |
| #include "core/events/BeforeUnloadEvent.h" |
| @@ -127,16 +127,17 @@ void V8AbstractEventListener::invokeEventHandler(ScriptState* scriptState, |
| v8::TryCatch tryCatch(isolate()); |
| tryCatch.SetVerbose(true); |
| + v8::Local<v8::Context> context = scriptState->context(); |
| + V8PrivateProperty::Symbol eventSymbol = |
| + V8PrivateProperty::getGlobalEvent(isolate()); |
| // Save the old 'event' property so we can restore it later. |
| - v8::Local<v8::Value> savedEvent = V8HiddenValue::getHiddenValue( |
| - scriptState, scriptState->context()->Global(), |
| - V8HiddenValue::event(isolate())); |
| + v8::Local<v8::Value> savedEvent = |
| + eventSymbol.get(context, context->Global()); |
| tryCatch.Reset(); |
| // Make the event available in the global object, so LocalDOMWindow can |
| // expose it. |
| - V8HiddenValue::setHiddenValue(scriptState, scriptState->context()->Global(), |
| - V8HiddenValue::event(isolate()), jsEvent); |
| + eventSymbol.set(context, context->Global(), jsEvent); |
| tryCatch.Reset(); |
| returnValue = callListenerFunction(scriptState, jsEvent, event); |
| @@ -155,13 +156,9 @@ void V8AbstractEventListener::invokeEventHandler(ScriptState* scriptState, |
| // Restore the old event. This must be done for all exit paths through this |
| // method. |
| if (savedEvent.IsEmpty()) |
| - V8HiddenValue::setHiddenValue( |
| - scriptState, scriptState->context()->Global(), |
| - V8HiddenValue::event(isolate()), v8::Undefined(isolate())); |
| + eventSymbol.set(context, context->Global(), v8::Undefined(isolate())); |
|
Yuki
2017/03/28 14:10:50
Looks like we can write as follows at a glance.
peria
2017/03/29 03:53:31
Agreed. Done.
|
| else |
| - V8HiddenValue::setHiddenValue( |
| - scriptState, scriptState->context()->Global(), |
| - V8HiddenValue::event(isolate()), savedEvent); |
| + eventSymbol.set(context, context->Global(), savedEvent); |
| tryCatch.Reset(); |
| } |