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

Side by Side Diff: Source/bindings/core/v8/custom/V8WindowCustom.cpp

Issue 429433002: Revert r174506 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 150
151 void V8Window::eventAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Val ue>& info) 151 void V8Window::eventAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Val ue>& info)
152 { 152 {
153 LocalFrame* frame = V8Window::toNative(info.Holder())->frame(); 153 LocalFrame* frame = V8Window::toNative(info.Holder())->frame();
154 ExceptionState exceptionState(ExceptionState::GetterContext, "event", "Windo w", info.Holder(), info.GetIsolate()); 154 ExceptionState exceptionState(ExceptionState::GetterContext, "event", "Windo w", info.Holder(), info.GetIsolate());
155 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), frame, exc eptionState)) { 155 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), frame, exc eptionState)) {
156 exceptionState.throwIfNeeded(); 156 exceptionState.throwIfNeeded();
157 return; 157 return;
158 } 158 }
159 159
160 v8::Handle<v8::Value> jsEvent = V8HiddenValue::getHiddenValue(info.GetIsolat e(), info.Holder()->CreationContext()->Global(), V8HiddenValue::event(info.GetIs olate())); 160 ASSERT(frame);
161 // This is a fast path to retrieve info.Holder()->CreationContext().
162 v8::Local<v8::Context> context = toV8Context(frame, DOMWrapperWorld::current (info.GetIsolate()));
163 if (context.IsEmpty())
164 return;
165
166 v8::Handle<v8::Value> jsEvent = V8HiddenValue::getHiddenValue(info.GetIsolat e(), context->Global(), V8HiddenValue::event(info.GetIsolate()));
161 if (jsEvent.IsEmpty()) 167 if (jsEvent.IsEmpty())
162 return; 168 return;
163 v8SetReturnValue(info, jsEvent); 169 v8SetReturnValue(info, jsEvent);
164 } 170 }
165 171
166 void V8Window::eventAttributeSetterCustom(v8::Local<v8::Value> value, const v8:: PropertyCallbackInfo<void>& info) 172 void V8Window::eventAttributeSetterCustom(v8::Local<v8::Value> value, const v8:: PropertyCallbackInfo<void>& info)
167 { 173 {
168 LocalFrame* frame = V8Window::toNative(info.Holder())->frame(); 174 LocalFrame* frame = V8Window::toNative(info.Holder())->frame();
169 ExceptionState exceptionState(ExceptionState::SetterContext, "event", "Windo w", info.Holder(), info.GetIsolate()); 175 ExceptionState exceptionState(ExceptionState::SetterContext, "event", "Windo w", info.Holder(), info.GetIsolate());
170 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), frame, exc eptionState)) { 176 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), frame, exc eptionState)) {
171 exceptionState.throwIfNeeded(); 177 exceptionState.throwIfNeeded();
172 return; 178 return;
173 } 179 }
174 180
175 V8HiddenValue::setHiddenValue(info.GetIsolate(), info.Holder()->CreationCont ext()->Global(), V8HiddenValue::event(info.GetIsolate()), value); 181 ASSERT(frame);
182 // This is a fast path to retrieve info.Holder()->CreationContext().
183 v8::Local<v8::Context> context = toV8Context(frame, DOMWrapperWorld::current (info.GetIsolate()));
184 if (context.IsEmpty())
185 return;
186
187 V8HiddenValue::setHiddenValue(info.GetIsolate(), context->Global(), V8Hidden Value::event(info.GetIsolate()), value);
176 } 188 }
177 189
178 void V8Window::frameElementAttributeGetterCustom(const v8::PropertyCallbackInfo< v8::Value>& info) 190 void V8Window::frameElementAttributeGetterCustom(const v8::PropertyCallbackInfo< v8::Value>& info)
179 { 191 {
180 LocalDOMWindow* impl = V8Window::toNative(info.Holder()); 192 LocalDOMWindow* impl = V8Window::toNative(info.Holder());
181 ExceptionState exceptionState(ExceptionState::GetterContext, "frame", "Windo w", info.Holder(), info.GetIsolate()); 193 ExceptionState exceptionState(ExceptionState::GetterContext, "frame", "Windo w", info.Holder(), info.GetIsolate());
182 if (!BindingSecurity::shouldAllowAccessToNode(info.GetIsolate(), impl->frame Element(), exceptionState)) { 194 if (!BindingSecurity::shouldAllowAccessToNode(info.GetIsolate(), impl->frame Element(), exceptionState)) {
183 v8SetReturnValueNull(info); 195 v8SetReturnValueNull(info);
184 exceptionState.throwIfNeeded(); 196 exceptionState.throwIfNeeded();
185 return; 197 return;
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::curren t(isolate)); 544 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::curren t(isolate));
533 if (context.IsEmpty()) 545 if (context.IsEmpty())
534 return v8Undefined(); 546 return v8Undefined();
535 547
536 v8::Handle<v8::Object> global = context->Global(); 548 v8::Handle<v8::Object> global = context->Global();
537 ASSERT(!global.IsEmpty()); 549 ASSERT(!global.IsEmpty());
538 return global; 550 return global;
539 } 551 }
540 552
541 } // namespace blink 553 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698