Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Unified Diff: third_party/WebKit/Source/bindings/core/v8/V8AbstractEventListener.cpp

Issue 2784473002: [Bindings] Move some private symbols from V8HiddenValue to V8PrivateProperty (Closed)
Patch Set: Work for comments Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..212a0ef2093eab4b361f768bccfc3e96961eafc3 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.getOrUndefined(context, context->Global());
tryCatch.Reset();
// Make the event available in the global object, so LocalDOMWindow can
// expose it.
haraken 2017/03/29 06:35:39 Do you know how the js event is exposed on the glo
Yuki 2017/03/29 06:46:41 V8Window::eventAttributeGetterCustom and V8Window:
- V8HiddenValue::setHiddenValue(scriptState, scriptState->context()->Global(),
- V8HiddenValue::event(isolate()), jsEvent);
+ eventSymbol.set(context, context->Global(), jsEvent);
tryCatch.Reset();
returnValue = callListenerFunction(scriptState, jsEvent, event);
@@ -154,14 +155,7 @@ 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()));
- else
- V8HiddenValue::setHiddenValue(
- scriptState, scriptState->context()->Global(),
- V8HiddenValue::event(isolate()), savedEvent);
+ eventSymbol.set(context, context->Global(), savedEvent);
tryCatch.Reset();
}

Powered by Google App Engine
This is Rietveld 408576698