| 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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 Frame* child = frame->tree().scopedChild(propName); | 335 Frame* child = frame->tree().scopedChild(propName); |
| 336 if (child) { | 336 if (child) { |
| 337 v8SetReturnValueFast(info, child->domWindow(), window); | 337 v8SetReturnValueFast(info, child->domWindow(), window); |
| 338 return; | 338 return; |
| 339 } | 339 } |
| 340 | 340 |
| 341 // Search IDL functions defined in the prototype | 341 // Search IDL functions defined in the prototype |
| 342 if (!info.Holder()->GetRealNamedProperty(nameString).IsEmpty()) | 342 if (!info.Holder()->GetRealNamedProperty(nameString).IsEmpty()) |
| 343 return; | 343 return; |
| 344 | 344 |
| 345 // Frame could have been detached in call to GetRealNamedProperty. |
| 346 frame = window->frame(); |
| 347 // window is detached. |
| 348 if (!frame) |
| 349 return; |
| 350 |
| 345 // Search named items in the document. | 351 // Search named items in the document. |
| 346 Document* doc = frame->document(); | 352 Document* doc = frame->document(); |
| 347 | 353 |
| 348 if (doc && doc->isHTMLDocument()) { | 354 if (doc && doc->isHTMLDocument()) { |
| 349 if (toHTMLDocument(doc)->hasNamedItem(propName) || doc->hasElementWithId
(propName)) { | 355 if (toHTMLDocument(doc)->hasNamedItem(propName) || doc->hasElementWithId
(propName)) { |
| 350 RefPtrWillBeRawPtr<HTMLCollection> items = doc->windowNamedItems(pro
pName); | 356 RefPtrWillBeRawPtr<HTMLCollection> items = doc->windowNamedItems(pro
pName); |
| 351 if (!items->isEmpty()) { | 357 if (!items->isEmpty()) { |
| 352 if (items->hasExactlyOneItem()) { | 358 if (items->hasExactlyOneItem()) { |
| 353 v8SetReturnValueFast(info, items->item(0), window); | 359 v8SetReturnValueFast(info, items->item(0), window); |
| 354 return; | 360 return; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::curren
t(isolate)); | 460 v8::Handle<v8::Context> context = toV8Context(frame, DOMWrapperWorld::curren
t(isolate)); |
| 455 if (context.IsEmpty()) | 461 if (context.IsEmpty()) |
| 456 return v8Undefined(); | 462 return v8Undefined(); |
| 457 | 463 |
| 458 v8::Handle<v8::Object> global = context->Global(); | 464 v8::Handle<v8::Object> global = context->Global(); |
| 459 ASSERT(!global.IsEmpty()); | 465 ASSERT(!global.IsEmpty()); |
| 460 return global; | 466 return global; |
| 461 } | 467 } |
| 462 | 468 |
| 463 } // namespace blink | 469 } // namespace blink |
| OLD | NEW |