| 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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 v8CallOrCrash(interfacesMap->Set(context, name, interface)); | 293 v8CallOrCrash(interfacesMap->Set(context, name, interface)); |
| 294 v8SetReturnValue(info, interface); | 294 v8SetReturnValue(info, interface); |
| 295 return true; | 295 return true; |
| 296 } | 296 } |
| 297 | 297 |
| 298 return false; | 298 return false; |
| 299 } | 299 } |
| 300 | 300 |
| 301 void V8Window::namedPropertyGetterCustom(v8::Local<v8::Name> name, const v8::Pro
pertyCallbackInfo<v8::Value>& info) | 301 void V8Window::namedPropertyGetterCustom(v8::Local<v8::Name> name, const v8::Pro
pertyCallbackInfo<v8::Value>& info) |
| 302 { | 302 { |
| 303 if (!name->IsString()) | |
| 304 return; | |
| 305 | |
| 306 auto nameString = name.As<v8::String>(); | 303 auto nameString = name.As<v8::String>(); |
| 307 DOMWindow* window = V8Window::toImpl(info.Holder()); | 304 DOMWindow* window = V8Window::toImpl(info.Holder()); |
| 308 if (!window) | 305 if (!window) |
| 309 return; | 306 return; |
| 310 | 307 |
| 311 Frame* frame = window->frame(); | 308 Frame* frame = window->frame(); |
| 312 // window is detached from a frame. | 309 // window is detached from a frame. |
| 313 if (!frame) | 310 if (!frame) |
| 314 return; | 311 return; |
| 315 | 312 |
| 316 AtomicString propName = toCoreAtomicString(nameString); | 313 AtomicString propName = toCoreAtomicString(nameString); |
| 317 | 314 |
| 318 // Note that the spec doesn't allow any cross-origin named access to the win
dow object. However, | 315 // Note that the spec doesn't allow any cross-origin named access to the win
dow object. However, |
| 319 // UAs have traditionally allowed named access to named child browsing conte
xts, even across | 316 // UAs have traditionally allowed named access to named child browsing conte
xts, even across |
| 320 // origins. So first, search child frames for a frame with a matching name. | 317 // origins. So first, search child frames for a frame with a matching name. |
| 321 Frame* child = frame->tree().scopedChild(propName); | 318 Frame* child = frame->tree().scopedChild(propName); |
| 322 if (child) { | 319 if (child) { |
| 323 v8SetReturnValueFast(info, child->domWindow(), window); | 320 v8SetReturnValueFast(info, child->domWindow(), window); |
| 324 return; | 321 return; |
| 325 } | 322 } |
| 326 | 323 |
| 327 // Search IDL functions defined in the prototype | |
| 328 if (!info.Holder()->GetRealNamedProperty(info.GetIsolate()->GetCurrentContex
t(), nameString).IsEmpty()) | |
| 329 return; | |
| 330 | |
| 331 // Frame could have been detached in call to GetRealNamedProperty. | |
| 332 frame = window->frame(); | |
| 333 // window is detached. | |
| 334 if (!frame) | |
| 335 return; | |
| 336 | |
| 337 // If the frame is remote, the caller will never be able to access further n
amed results. | 324 // If the frame is remote, the caller will never be able to access further n
amed results. |
| 338 if (!frame->isLocalFrame()) | 325 if (!frame->isLocalFrame()) |
| 339 return; | 326 return; |
| 340 | 327 |
| 341 if (installTestInterfaceIfNeeded(toLocalFrame(*frame), nameString, info)) | 328 if (installTestInterfaceIfNeeded(toLocalFrame(*frame), nameString, info)) |
| 342 return; | 329 return; |
| 343 | 330 |
| 344 // Search named items in the document. | 331 // Search named items in the document. |
| 345 Document* doc = toLocalFrame(frame)->document(); | 332 Document* doc = toLocalFrame(frame)->document(); |
| 346 if (!doc || !doc->isHTMLDocument()) | 333 if (!doc || !doc->isHTMLDocument()) |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 { | 389 { |
| 403 return securityCheck(host); | 390 return securityCheck(host); |
| 404 } | 391 } |
| 405 | 392 |
| 406 bool V8Window::indexedSecurityCheckCustom(v8::Local<v8::Object> host, uint32_t i
ndex, v8::AccessType type, v8::Local<v8::Value>) | 393 bool V8Window::indexedSecurityCheckCustom(v8::Local<v8::Object> host, uint32_t i
ndex, v8::AccessType type, v8::Local<v8::Value>) |
| 407 { | 394 { |
| 408 return securityCheck(host); | 395 return securityCheck(host); |
| 409 } | 396 } |
| 410 | 397 |
| 411 } // namespace blink | 398 } // namespace blink |
| OLD | NEW |