| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 if (!scriptContext) { | 87 if (!scriptContext) { |
| 88 es.throwDOMException(InvalidAccessError); | 88 es.throwDOMException(InvalidAccessError); |
| 89 return; | 89 return; |
| 90 } | 90 } |
| 91 | 91 |
| 92 v8::Handle<v8::Value> function = args[0]; | 92 v8::Handle<v8::Value> function = args[0]; |
| 93 String functionString; | 93 String functionString; |
| 94 if (!function->IsFunction()) { | 94 if (!function->IsFunction()) { |
| 95 if (function->IsString()) { | 95 if (function->IsString()) { |
| 96 functionString = toWebCoreString(function); | 96 functionString = toWebCoreString(function.As<v8::String>()); |
| 97 } else { | 97 } else { |
| 98 v8::Handle<v8::Value> v8String = function->ToString(); | 98 v8::Handle<v8::Value> v8String = function->ToString(); |
| 99 | 99 |
| 100 // Bail out if string conversion failed. | 100 // Bail out if string conversion failed. |
| 101 if (v8String.IsEmpty()) | 101 if (v8String.IsEmpty()) |
| 102 return; | 102 return; |
| 103 | 103 |
| 104 functionString = toWebCoreString(v8String); | 104 functionString = toWebCoreString(v8String); |
| 105 } | 105 } |
| 106 | 106 |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 if (!target) | 466 if (!target) |
| 467 return false; | 467 return false; |
| 468 | 468 |
| 469 // Notify the loader's client if the initial document has been accessed. | 469 // Notify the loader's client if the initial document has been accessed. |
| 470 if (target->loader()->stateMachine()->isDisplayingInitialEmptyDocument()) | 470 if (target->loader()->stateMachine()->isDisplayingInitialEmptyDocument()) |
| 471 target->loader()->didAccessInitialDocument(); | 471 target->loader()->didAccessInitialDocument(); |
| 472 | 472 |
| 473 if (key->IsString()) { | 473 if (key->IsString()) { |
| 474 DEFINE_STATIC_LOCAL(AtomicString, nameOfProtoProperty, ("__proto__", Ato
micString::ConstructFromLiteral)); | 474 DEFINE_STATIC_LOCAL(AtomicString, nameOfProtoProperty, ("__proto__", Ato
micString::ConstructFromLiteral)); |
| 475 | 475 |
| 476 String name = toWebCoreString(key); | 476 String name = toWebCoreString(key.As<v8::String>()); |
| 477 Frame* childFrame = target->tree()->scopedChild(name); | 477 Frame* childFrame = target->tree()->scopedChild(name); |
| 478 // Notice that we can't call HasRealNamedProperty for ACCESS_HAS | 478 // Notice that we can't call HasRealNamedProperty for ACCESS_HAS |
| 479 // because that would generate infinite recursion. | 479 // because that would generate infinite recursion. |
| 480 if (type == v8::ACCESS_HAS && childFrame) | 480 if (type == v8::ACCESS_HAS && childFrame) |
| 481 return true; | 481 return true; |
| 482 // We need to explicitly compare against nameOfProtoProperty because | 482 // We need to explicitly compare against nameOfProtoProperty because |
| 483 // V8's JSObject::LocalLookup finds __proto__ before | 483 // V8's JSObject::LocalLookup finds __proto__ before |
| 484 // interceptors and even when __proto__ isn't a "real named property". | 484 // interceptors and even when __proto__ isn't a "real named property". |
| 485 v8::Handle<v8::String> keyString = key.As<v8::String>(); | 485 v8::Handle<v8::String> keyString = key.As<v8::String>(); |
| 486 if (type == v8::ACCESS_GET | 486 if (type == v8::ACCESS_GET |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 v8::Handle<v8::Context> context = frame->script()->currentWorldContext(); | 557 v8::Handle<v8::Context> context = frame->script()->currentWorldContext(); |
| 558 if (context.IsEmpty()) | 558 if (context.IsEmpty()) |
| 559 return v8Undefined(); | 559 return v8Undefined(); |
| 560 | 560 |
| 561 v8::Handle<v8::Object> global = context->Global(); | 561 v8::Handle<v8::Object> global = context->Global(); |
| 562 ASSERT(!global.IsEmpty()); | 562 ASSERT(!global.IsEmpty()); |
| 563 return global; | 563 return global; |
| 564 } | 564 } |
| 565 | 565 |
| 566 } // namespace WebCore | 566 } // namespace WebCore |
| OLD | NEW |