Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Unified Diff: src/handles.cc

Issue 16035027: DevTools: CPUProfiler: provide url for scripts that have sourceURL property. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: test was added Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/log.cc » ('j') | test/cctest/test-cpu-profiler.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | src/log.cc » ('j') | test/cctest/test-cpu-profiler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698