Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 | 71 |
| 72 // FIXME: There is a lot of duplication with SetTimeoutOrInterval() in V8WorkerG lobalScopeCustom.cpp. | 72 // FIXME: There is a lot of duplication with SetTimeoutOrInterval() in V8WorkerG lobalScopeCustom.cpp. |
| 73 // We should refactor this. | 73 // We should refactor this. |
| 74 static void windowSetTimeoutImpl(const v8::FunctionCallbackInfo<v8::Value>& info , bool singleShot, ExceptionState& exceptionState) | 74 static void windowSetTimeoutImpl(const v8::FunctionCallbackInfo<v8::Value>& info , bool singleShot, ExceptionState& exceptionState) |
| 75 { | 75 { |
| 76 int argumentCount = info.Length(); | 76 int argumentCount = info.Length(); |
| 77 | 77 |
| 78 if (argumentCount < 1) | 78 if (argumentCount < 1) |
| 79 return; | 79 return; |
| 80 | 80 |
| 81 LocalDOMWindow* impl = V8Window::toImpl(info.Holder()); | 81 LocalDOMWindow* impl = toLocalDOMWindow(V8Window::toImpl(info.Holder())); |
|
dcheng
2014/10/31 03:20:41
Things like this are not available cross-origin (a
| |
| 82 if (!impl->frame() || !impl->document()) { | 82 if (!impl->frame() || !impl->document()) { |
| 83 exceptionState.throwDOMException(InvalidAccessError, "No script context is available in which to execute the script."); | 83 exceptionState.throwDOMException(InvalidAccessError, "No script context is available in which to execute the script."); |
| 84 return; | 84 return; |
| 85 } | 85 } |
| 86 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); | 86 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); |
| 87 v8::Handle<v8::Value> function = info[0]; | 87 v8::Handle<v8::Value> function = info[0]; |
| 88 String functionString; | 88 String functionString; |
| 89 if (!function->IsFunction()) { | 89 if (!function->IsFunction()) { |
| 90 if (function->IsString()) { | 90 if (function->IsString()) { |
| 91 functionString = toCoreString(function.As<v8::String>()); | 91 functionString = toCoreString(function.As<v8::String>()); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 // FIXME: Crude hack that attempts to pass idle time to V8. This should be | 142 // FIXME: Crude hack that attempts to pass idle time to V8. This should be |
| 143 // done using the scheduler instead. | 143 // done using the scheduler instead. |
| 144 if (timeout >= 0) | 144 if (timeout >= 0) |
| 145 V8GCForContextDispose::instance().notifyIdle(); | 145 V8GCForContextDispose::instance().notifyIdle(); |
| 146 | 146 |
| 147 v8SetReturnValue(info, timerId); | 147 v8SetReturnValue(info, timerId); |
| 148 } | 148 } |
| 149 | 149 |
| 150 void V8Window::eventAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Val ue>& info) | 150 void V8Window::eventAttributeGetterCustom(const v8::PropertyCallbackInfo<v8::Val ue>& info) |
| 151 { | 151 { |
| 152 LocalFrame* frame = V8Window::toImpl(info.Holder())->frame(); | 152 LocalFrame* frame = toLocalDOMWindow(V8Window::toImpl(info.Holder()))->frame (); |
| 153 ExceptionState exceptionState(ExceptionState::GetterContext, "event", "Windo w", info.Holder(), info.GetIsolate()); | 153 ExceptionState exceptionState(ExceptionState::GetterContext, "event", "Windo w", info.Holder(), info.GetIsolate()); |
| 154 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), frame, exc eptionState)) { | 154 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), frame, exc eptionState)) { |
| 155 exceptionState.throwIfNeeded(); | 155 exceptionState.throwIfNeeded(); |
| 156 return; | 156 return; |
| 157 } | 157 } |
| 158 | 158 |
| 159 ASSERT(frame); | 159 ASSERT(frame); |
| 160 // This is a fast path to retrieve info.Holder()->CreationContext(). | 160 // This is a fast path to retrieve info.Holder()->CreationContext(). |
| 161 v8::Local<v8::Context> context = toV8Context(frame, DOMWrapperWorld::current (info.GetIsolate())); | 161 v8::Local<v8::Context> context = toV8Context(frame, DOMWrapperWorld::current (info.GetIsolate())); |
| 162 if (context.IsEmpty()) | 162 if (context.IsEmpty()) |
| 163 return; | 163 return; |
| 164 | 164 |
| 165 v8::Handle<v8::Value> jsEvent = V8HiddenValue::getHiddenValue(info.GetIsolat e(), context->Global(), V8HiddenValue::event(info.GetIsolate())); | 165 v8::Handle<v8::Value> jsEvent = V8HiddenValue::getHiddenValue(info.GetIsolat e(), context->Global(), V8HiddenValue::event(info.GetIsolate())); |
| 166 if (jsEvent.IsEmpty()) | 166 if (jsEvent.IsEmpty()) |
| 167 return; | 167 return; |
| 168 v8SetReturnValue(info, jsEvent); | 168 v8SetReturnValue(info, jsEvent); |
| 169 } | 169 } |
| 170 | 170 |
| 171 void V8Window::eventAttributeSetterCustom(v8::Local<v8::Value> value, const v8:: PropertyCallbackInfo<void>& info) | 171 void V8Window::eventAttributeSetterCustom(v8::Local<v8::Value> value, const v8:: PropertyCallbackInfo<void>& info) |
| 172 { | 172 { |
| 173 LocalFrame* frame = V8Window::toImpl(info.Holder())->frame(); | 173 LocalFrame* frame = toLocalDOMWindow(V8Window::toImpl(info.Holder()))->frame (); |
| 174 ExceptionState exceptionState(ExceptionState::SetterContext, "event", "Windo w", info.Holder(), info.GetIsolate()); | 174 ExceptionState exceptionState(ExceptionState::SetterContext, "event", "Windo w", info.Holder(), info.GetIsolate()); |
| 175 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), frame, exc eptionState)) { | 175 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), frame, exc eptionState)) { |
| 176 exceptionState.throwIfNeeded(); | 176 exceptionState.throwIfNeeded(); |
| 177 return; | 177 return; |
| 178 } | 178 } |
| 179 | 179 |
| 180 ASSERT(frame); | 180 ASSERT(frame); |
| 181 // This is a fast path to retrieve info.Holder()->CreationContext(). | 181 // This is a fast path to retrieve info.Holder()->CreationContext(). |
| 182 v8::Local<v8::Context> context = toV8Context(frame, DOMWrapperWorld::current (info.GetIsolate())); | 182 v8::Local<v8::Context> context = toV8Context(frame, DOMWrapperWorld::current (info.GetIsolate())); |
| 183 if (context.IsEmpty()) | 183 if (context.IsEmpty()) |
| 184 return; | 184 return; |
| 185 | 185 |
| 186 V8HiddenValue::setHiddenValue(info.GetIsolate(), context->Global(), V8Hidden Value::event(info.GetIsolate()), value); | 186 V8HiddenValue::setHiddenValue(info.GetIsolate(), context->Global(), V8Hidden Value::event(info.GetIsolate()), value); |
| 187 } | 187 } |
| 188 | 188 |
| 189 void V8Window::frameElementAttributeGetterCustom(const v8::PropertyCallbackInfo< v8::Value>& info) | 189 void V8Window::frameElementAttributeGetterCustom(const v8::PropertyCallbackInfo< v8::Value>& info) |
| 190 { | 190 { |
| 191 LocalDOMWindow* impl = V8Window::toImpl(info.Holder()); | 191 LocalDOMWindow* impl = toLocalDOMWindow(V8Window::toImpl(info.Holder())); |
| 192 ExceptionState exceptionState(ExceptionState::GetterContext, "frame", "Windo w", info.Holder(), info.GetIsolate()); | 192 ExceptionState exceptionState(ExceptionState::GetterContext, "frame", "Windo w", info.Holder(), info.GetIsolate()); |
| 193 if (!BindingSecurity::shouldAllowAccessToNode(info.GetIsolate(), impl->frame Element(), exceptionState)) { | 193 if (!BindingSecurity::shouldAllowAccessToNode(info.GetIsolate(), impl->frame Element(), exceptionState)) { |
| 194 v8SetReturnValueNull(info); | 194 v8SetReturnValueNull(info); |
| 195 exceptionState.throwIfNeeded(); | 195 exceptionState.throwIfNeeded(); |
| 196 return; | 196 return; |
| 197 } | 197 } |
| 198 | 198 |
| 199 // The wrapper for an <iframe> should get its prototype from the context of the frame it's in, rather than its own frame. | 199 // The wrapper for an <iframe> should get its prototype from the context of the frame it's in, rather than its own frame. |
| 200 // So, use its containing document as the creation context when wrapping. | 200 // So, use its containing document as the creation context when wrapping. |
| 201 v8::Handle<v8::Value> creationContext = toV8(&impl->frameElement()->document (), info.Holder(), info.GetIsolate()); | 201 v8::Handle<v8::Value> creationContext = toV8(&impl->frameElement()->document (), info.Holder(), info.GetIsolate()); |
| 202 RELEASE_ASSERT(!creationContext.IsEmpty()); | 202 RELEASE_ASSERT(!creationContext.IsEmpty()); |
| 203 v8::Handle<v8::Value> wrapper = toV8(impl->frameElement(), v8::Handle<v8::Ob ject>::Cast(creationContext), info.GetIsolate()); | 203 v8::Handle<v8::Value> wrapper = toV8(impl->frameElement(), v8::Handle<v8::Ob ject>::Cast(creationContext), info.GetIsolate()); |
| 204 v8SetReturnValue(info, wrapper); | 204 v8SetReturnValue(info, wrapper); |
| 205 } | 205 } |
| 206 | 206 |
| 207 void V8Window::openerAttributeSetterCustom(v8::Local<v8::Value> value, const v8: :PropertyCallbackInfo<void>& info) | 207 void V8Window::openerAttributeSetterCustom(v8::Local<v8::Value> value, const v8: :PropertyCallbackInfo<void>& info) |
| 208 { | 208 { |
| 209 LocalDOMWindow* impl = V8Window::toImpl(info.Holder()); | 209 LocalDOMWindow* impl = toLocalDOMWindow(V8Window::toImpl(info.Holder())); |
| 210 ExceptionState exceptionState(ExceptionState::SetterContext, "opener", "Wind ow", info.Holder(), info.GetIsolate()); | 210 ExceptionState exceptionState(ExceptionState::SetterContext, "opener", "Wind ow", info.Holder(), info.GetIsolate()); |
| 211 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram e(), exceptionState)) { | 211 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram e(), exceptionState)) { |
| 212 exceptionState.throwIfNeeded(); | 212 exceptionState.throwIfNeeded(); |
| 213 return; | 213 return; |
| 214 } | 214 } |
| 215 | 215 |
| 216 // Opener can be shadowed if it is in the same domain. | 216 // Opener can be shadowed if it is in the same domain. |
| 217 // Have a special handling of null value to behave | 217 // Have a special handling of null value to behave |
| 218 // like Firefox. See bug http://b/1224887 & http://b/791706. | 218 // like Firefox. See bug http://b/1224887 & http://b/791706. |
| 219 if (value->IsNull()) { | 219 if (value->IsNull()) { |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 236 if (value->IsString() || value->IsStringObject()) | 236 if (value->IsString() || value->IsStringObject()) |
| 237 return true; | 237 return true; |
| 238 return false; | 238 return false; |
| 239 } | 239 } |
| 240 | 240 |
| 241 | 241 |
| 242 void V8Window::postMessageMethodCustom(const v8::FunctionCallbackInfo<v8::Value> & info) | 242 void V8Window::postMessageMethodCustom(const v8::FunctionCallbackInfo<v8::Value> & info) |
| 243 { | 243 { |
| 244 // None of these need to be RefPtr because info and context are guaranteed | 244 // None of these need to be RefPtr because info and context are guaranteed |
| 245 // to hold on to them. | 245 // to hold on to them. |
| 246 LocalDOMWindow* window = V8Window::toImpl(info.Holder()); | 246 // FIXME: This is likely to be problematic for the use counters below. |
|
dcheng
2014/10/31 03:20:41
I don't have a good solution for the use counters
haraken
2014/10/31 06:07:04
The same problem should be happening in auto-gener
dcheng
2014/10/31 06:31:01
Let me look into this. Hopefully we can just updat
| |
| 247 DOMWindow* window = V8Window::toImpl(info.Holder()); | |
| 247 LocalDOMWindow* source = callingDOMWindow(info.GetIsolate()); | 248 LocalDOMWindow* source = callingDOMWindow(info.GetIsolate()); |
| 248 | 249 |
| 249 ASSERT(window); | 250 ASSERT(window); |
| 250 UseCounter::countIfNotPrivateScript(info.GetIsolate(), window->document(), U seCounter::WindowPostMessage); | 251 UseCounter::countIfNotPrivateScript(info.GetIsolate(), window->document(), U seCounter::WindowPostMessage); |
| 251 | 252 |
| 252 ExceptionState exceptionState(ExceptionState::ExecutionContext, "postMessage ", "Window", info.Holder(), info.GetIsolate()); | 253 ExceptionState exceptionState(ExceptionState::ExecutionContext, "postMessage ", "Window", info.Holder(), info.GetIsolate()); |
| 253 | 254 |
| 254 // If called directly by WebCore we don't have a calling context. | 255 // If called directly by WebCore we don't have a calling context. |
| 255 if (!source) { | 256 if (!source) { |
| 256 exceptionState.throwTypeError("No active calling context exists."); | 257 exceptionState.throwTypeError("No active calling context exists."); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 348 return handleScope.Escape(returnValue); | 349 return handleScope.Escape(returnValue); |
| 349 } | 350 } |
| 350 | 351 |
| 351 static void setUpDialog(LocalDOMWindow* dialog, void* handler) | 352 static void setUpDialog(LocalDOMWindow* dialog, void* handler) |
| 352 { | 353 { |
| 353 static_cast<DialogHandler*>(handler)->dialogCreated(dialog); | 354 static_cast<DialogHandler*>(handler)->dialogCreated(dialog); |
| 354 } | 355 } |
| 355 | 356 |
| 356 void V8Window::showModalDialogMethodCustom(const v8::FunctionCallbackInfo<v8::Va lue>& info) | 357 void V8Window::showModalDialogMethodCustom(const v8::FunctionCallbackInfo<v8::Va lue>& info) |
| 357 { | 358 { |
| 358 LocalDOMWindow* impl = V8Window::toImpl(info.Holder()); | 359 LocalDOMWindow* impl = toLocalDOMWindow(V8Window::toImpl(info.Holder())); |
| 359 ExceptionState exceptionState(ExceptionState::ExecutionContext, "showModalDi alog", "Window", info.Holder(), info.GetIsolate()); | 360 ExceptionState exceptionState(ExceptionState::ExecutionContext, "showModalDi alog", "Window", info.Holder(), info.GetIsolate()); |
| 360 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram e(), exceptionState)) { | 361 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram e(), exceptionState)) { |
| 361 exceptionState.throwIfNeeded(); | 362 exceptionState.throwIfNeeded(); |
| 362 return; | 363 return; |
| 363 } | 364 } |
| 364 | 365 |
| 365 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, urlString , info[0]); | 366 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, urlString , info[0]); |
| 366 DialogHandler handler(info[1], ScriptState::current(info.GetIsolate())); | 367 DialogHandler handler(info[1], ScriptState::current(info.GetIsolate())); |
| 367 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, dialogFea turesString, info[2]); | 368 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, dialogFea turesString, info[2]); |
| 368 | 369 |
| 369 impl->showModalDialog(urlString, dialogFeaturesString, callingDOMWindow(info .GetIsolate()), enteredDOMWindow(info.GetIsolate()), setUpDialog, &handler); | 370 impl->showModalDialog(urlString, dialogFeaturesString, callingDOMWindow(info .GetIsolate()), enteredDOMWindow(info.GetIsolate()), setUpDialog, &handler); |
| 370 | 371 |
| 371 v8SetReturnValue(info, handler.returnValue()); | 372 v8SetReturnValue(info, handler.returnValue()); |
| 372 } | 373 } |
| 373 | 374 |
| 374 void V8Window::openMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info) | 375 void V8Window::openMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 375 { | 376 { |
| 376 LocalDOMWindow* impl = V8Window::toImpl(info.Holder()); | 377 LocalDOMWindow* impl = toLocalDOMWindow(V8Window::toImpl(info.Holder())); |
| 377 ExceptionState exceptionState(ExceptionState::ExecutionContext, "open", "Win dow", info.Holder(), info.GetIsolate()); | 378 ExceptionState exceptionState(ExceptionState::ExecutionContext, "open", "Win dow", info.Holder(), info.GetIsolate()); |
| 378 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram e(), exceptionState)) { | 379 if (!BindingSecurity::shouldAllowAccessToFrame(info.GetIsolate(), impl->fram e(), exceptionState)) { |
| 379 exceptionState.throwIfNeeded(); | 380 exceptionState.throwIfNeeded(); |
| 380 return; | 381 return; |
| 381 } | 382 } |
| 382 | 383 |
| 383 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, urlString , info[0]); | 384 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, urlString , info[0]); |
| 384 AtomicString frameName; | 385 AtomicString frameName; |
| 385 if (info[1]->IsUndefined() || info[1]->IsNull()) { | 386 if (info[1]->IsUndefined() || info[1]->IsNull()) { |
| 386 frameName = "_blank"; | 387 frameName = "_blank"; |
| 387 } else { | 388 } else { |
| 388 TOSTRING_VOID(V8StringResource<>, frameNameResource, info[1]); | 389 TOSTRING_VOID(V8StringResource<>, frameNameResource, info[1]); |
| 389 frameName = frameNameResource; | 390 frameName = frameNameResource; |
| 390 } | 391 } |
| 391 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, windowFea turesString, info[2]); | 392 TOSTRING_VOID(V8StringResource<TreatNullAndUndefinedAsNullString>, windowFea turesString, info[2]); |
| 392 | 393 |
| 393 RefPtrWillBeRawPtr<LocalDOMWindow> openedWindow = impl->open(urlString, fram eName, windowFeaturesString, callingDOMWindow(info.GetIsolate()), enteredDOMWind ow(info.GetIsolate())); | 394 RefPtrWillBeRawPtr<LocalDOMWindow> openedWindow = impl->open(urlString, fram eName, windowFeaturesString, callingDOMWindow(info.GetIsolate()), enteredDOMWind ow(info.GetIsolate())); |
| 394 if (!openedWindow) | 395 if (!openedWindow) |
| 395 return; | 396 return; |
| 396 | 397 |
| 397 v8SetReturnValueFast(info, openedWindow.release(), impl); | 398 v8SetReturnValueFast(info, openedWindow.release(), impl); |
| 398 } | 399 } |
| 399 | 400 |
| 400 void V8Window::namedPropertyGetterCustom(v8::Local<v8::String> name, const v8::P ropertyCallbackInfo<v8::Value>& info) | 401 void V8Window::namedPropertyGetterCustom(v8::Local<v8::String> name, const v8::P ropertyCallbackInfo<v8::Value>& info) |
| 401 { | 402 { |
| 402 | 403 LocalDOMWindow* window = toLocalDOMWindow(V8Window::toImpl(info.Holder())); |
| 403 LocalDOMWindow* window = V8Window::toImpl(info.Holder()); | |
| 404 if (!window) | 404 if (!window) |
| 405 return; | 405 return; |
| 406 | 406 |
| 407 LocalFrame* frame = window->frame(); | 407 LocalFrame* frame = window->frame(); |
| 408 // window is detached from a frame. | 408 // window is detached from a frame. |
| 409 if (!frame) | 409 if (!frame) |
| 410 return; | 410 return; |
| 411 | 411 |
| 412 // Search sub-frames. | 412 // Search sub-frames. |
| 413 AtomicString propName = toCoreAtomicString(name); | 413 AtomicString propName = toCoreAtomicString(name); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 455 exceptionState.throwIfNeeded(); | 455 exceptionState.throwIfNeeded(); |
| 456 } | 456 } |
| 457 | 457 |
| 458 bool V8Window::namedSecurityCheckCustom(v8::Local<v8::Object> host, v8::Local<v8 ::Value> key, v8::AccessType type, v8::Local<v8::Value>) | 458 bool V8Window::namedSecurityCheckCustom(v8::Local<v8::Object> host, v8::Local<v8 ::Value> key, v8::AccessType type, v8::Local<v8::Value>) |
| 459 { | 459 { |
| 460 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 460 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 461 v8::Handle<v8::Object> window = V8Window::findInstanceInPrototypeChain(host, isolate); | 461 v8::Handle<v8::Object> window = V8Window::findInstanceInPrototypeChain(host, isolate); |
| 462 if (window.IsEmpty()) | 462 if (window.IsEmpty()) |
| 463 return false; // the frame is gone. | 463 return false; // the frame is gone. |
| 464 | 464 |
| 465 LocalDOMWindow* targetWindow = V8Window::toImpl(window); | 465 // FIXME: Do not commit. Uncertain if this is correct. |
| 466 LocalDOMWindow* targetWindow = toLocalDOMWindow(V8Window::toImpl(window)); | |
| 466 | 467 |
| 467 ASSERT(targetWindow); | 468 ASSERT(targetWindow); |
| 468 | 469 |
| 469 LocalFrame* target = targetWindow->frame(); | 470 LocalFrame* target = targetWindow->frame(); |
| 470 if (!target) | 471 if (!target) |
| 471 return false; | 472 return false; |
| 472 | 473 |
| 473 // Notify the loader's client if the initial document has been accessed. | 474 // Notify the loader's client if the initial document has been accessed. |
| 474 if (target->loader().stateMachine()->isDisplayingInitialEmptyDocument()) | 475 if (target->loader().stateMachine()->isDisplayingInitialEmptyDocument()) |
| 475 target->loader().didAccessInitialDocument(); | 476 target->loader().didAccessInitialDocument(); |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 498 return BindingSecurity::shouldAllowAccessToFrame(isolate, target, DoNotRepor tSecurityError); | 499 return BindingSecurity::shouldAllowAccessToFrame(isolate, target, DoNotRepor tSecurityError); |
| 499 } | 500 } |
| 500 | 501 |
| 501 bool V8Window::indexedSecurityCheckCustom(v8::Local<v8::Object> host, uint32_t i ndex, v8::AccessType type, v8::Local<v8::Value>) | 502 bool V8Window::indexedSecurityCheckCustom(v8::Local<v8::Object> host, uint32_t i ndex, v8::AccessType type, v8::Local<v8::Value>) |
| 502 { | 503 { |
| 503 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 504 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 504 v8::Handle<v8::Object> window = V8Window::findInstanceInPrototypeChain(host, isolate); | 505 v8::Handle<v8::Object> window = V8Window::findInstanceInPrototypeChain(host, isolate); |
| 505 if (window.IsEmpty()) | 506 if (window.IsEmpty()) |
| 506 return false; | 507 return false; |
| 507 | 508 |
| 508 LocalDOMWindow* targetWindow = V8Window::toImpl(window); | 509 // FIXME: Do not commit. Uncertain if this is correct. |
| 510 LocalDOMWindow* targetWindow = toLocalDOMWindow(V8Window::toImpl(window)); | |
| 509 | 511 |
| 510 ASSERT(targetWindow); | 512 ASSERT(targetWindow); |
| 511 | 513 |
| 512 LocalFrame* target = targetWindow->frame(); | 514 LocalFrame* target = targetWindow->frame(); |
| 513 if (!target) | 515 if (!target) |
| 514 return false; | 516 return false; |
| 515 | 517 |
| 516 // Notify the loader's client if the initial document has been accessed. | 518 // Notify the loader's client if the initial document has been accessed. |
| 517 if (target->loader().stateMachine()->isDisplayingInitialEmptyDocument()) | 519 if (target->loader().stateMachine()->isDisplayingInitialEmptyDocument()) |
| 518 target->loader().didAccessInitialDocument(); | 520 target->loader().didAccessInitialDocument(); |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 547 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::curren t(isolate)); | 549 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::curren t(isolate)); |
| 548 if (context.IsEmpty()) | 550 if (context.IsEmpty()) |
| 549 return v8Undefined(); | 551 return v8Undefined(); |
| 550 | 552 |
| 551 v8::Handle<v8::Object> global = context->Global(); | 553 v8::Handle<v8::Object> global = context->Global(); |
| 552 ASSERT(!global.IsEmpty()); | 554 ASSERT(!global.IsEmpty()); |
| 553 return global; | 555 return global; |
| 554 } | 556 } |
| 555 | 557 |
| 556 } // namespace blink | 558 } // namespace blink |
| OLD | NEW |