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

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

Issue 2784473002: [Bindings] Move some private symbols from V8HiddenValue to V8PrivateProperty (Closed)
Patch Set: rebase 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
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/custom/V8MessageChannelCustom.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..852be31bd44f18b00dd382898bacc8587f9c158c 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,16 @@ 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(info.Holder());
v8SetReturnValue(info, jsEvent);
}
@@ -146,24 +137,15 @@ 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(info.Holder(), value);
}
void V8Window::frameElementAttributeGetterCustom(
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/custom/V8MessageChannelCustom.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698