Index: src/handles.cc |
diff --git a/src/handles.cc b/src/handles.cc |
index 123fdc5adf4de5d691ba3bcdcf1ab28c3fc7810b..47f5632cb05a2cf697b882986f2becee445c4005 100644 |
--- a/src/handles.cc |
+++ b/src/handles.cc |
@@ -366,6 +366,9 @@ Handle<JSValue> GetScriptWrapper(Handle<Script> script) { |
reinterpret_cast<JSValue**>(script->wrapper()->foreign_address())); |
} |
Isolate* isolate = script->GetIsolate(); |
+ if (!isolate->IsInitialized()) { |
yurys
2013/06/11 11:23:06
Can we move this check to Logger::LogExistingFunct
|
+ return Handle<JSValue>(); |
+ } |
// Construct a new script wrapper. |
isolate->counters()->script_wrappers()->Increment(); |
Handle<JSFunction> constructor = isolate->script_function(); |
@@ -601,15 +604,22 @@ Handle<Object> GetScriptNameOrSourceURL(Handle<Script> script) { |
isolate->factory()->InternalizeOneByteString( |
STATIC_ASCII_VECTOR("nameOrSourceURL")); |
Handle<JSValue> script_wrapper = GetScriptWrapper(script); |
+ if (script_wrapper.is_null()) { |
+ return isolate->factory()->undefined_value(); |
+ } |
Handle<Object> property = GetProperty(isolate, |
script_wrapper, |
name_or_source_url_key); |
- ASSERT(property->IsJSFunction()); |
- Handle<JSFunction> method = Handle<JSFunction>::cast(property); |
- bool caught_exception; |
- Handle<Object> result = Execution::TryCall(method, script_wrapper, 0, |
- NULL, &caught_exception); |
- if (caught_exception) { |
+ Handle<Object> result; |
+ if (property->IsJSFunction()) { |
yurys
2013/06/11 11:23:06
How can it happen? We should be checking for is_bo
|
+ Handle<JSFunction> method = Handle<JSFunction>::cast(property); |
+ bool caught_exception; |
+ result = Execution::TryCall(method, script_wrapper, 0, |
+ NULL, &caught_exception); |
+ if (caught_exception) { |
+ result = isolate->factory()->undefined_value(); |
+ } |
+ } else { |
result = isolate->factory()->undefined_value(); |
} |
return result; |