Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/renderer/module_system.h" | 5 #include "chrome/renderer/module_system.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScopedMicrotaskSup pression.h" | 8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScopedMicrotaskSup pression.h" |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 if (!message->GetScriptResourceName().IsEmpty()) { | 71 if (!message->GetScriptResourceName().IsEmpty()) { |
| 72 resource_name = | 72 resource_name = |
| 73 *v8::String::Utf8Value(message->GetScriptResourceName()->ToString()); | 73 *v8::String::Utf8Value(message->GetScriptResourceName()->ToString()); |
| 74 } | 74 } |
| 75 | 75 |
| 76 std::string error_message = "<no error message>"; | 76 std::string error_message = "<no error message>"; |
| 77 if (!message->Get().IsEmpty()) | 77 if (!message->Get().IsEmpty()) |
| 78 error_message = *v8::String::Utf8Value(message->Get()); | 78 error_message = *v8::String::Utf8Value(message->Get()); |
| 79 | 79 |
| 80 std::string stack_trace = "<stack trace unavailable>"; | 80 std::string stack_trace = "<stack trace unavailable>"; |
| 81 if (!try_catch.StackTrace().IsEmpty()) | 81 if (!try_catch.StackTrace().IsEmpty()) { |
| 82 stack_trace = *v8::String::Utf8Value(try_catch.StackTrace()); | 82 v8::String::Utf8Value stack_value(try_catch.StackTrace()); |
|
eaugusti
2012/08/27 22:39:55
I think this should be v8::Handle<v8::String::Utf8
| |
| 83 if (*stack_value) | |
| 84 stack_trace.assign(*stack_value, stack_value.length()); | |
| 85 else | |
| 86 stack_trace = "<could not convert stack trace to string>"; | |
| 87 } | |
| 83 | 88 |
| 84 LOG(ERROR) << "[" << resource_name << "(" << message->GetLineNumber() << ")] " | 89 LOG(ERROR) << "[" << resource_name << "(" << message->GetLineNumber() << ")] " |
| 85 << error_message | 90 << error_message |
| 86 << "{" << stack_trace << "}"; | 91 << "{" << stack_trace << "}"; |
| 87 } | 92 } |
| 88 | 93 |
| 89 void ModuleSystem::Require(const std::string& module_name) { | 94 void ModuleSystem::Require(const std::string& module_name) { |
| 90 v8::HandleScope handle_scope; | 95 v8::HandleScope handle_scope; |
| 91 RequireForJsInner(v8::String::New(module_name.c_str())); | 96 RequireForJsInner(v8::String::New(module_name.c_str())); |
| 92 } | 97 } |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 251 v8::Handle<v8::String> left = | 256 v8::Handle<v8::String> left = |
| 252 v8::String::New("(function(require, requireNative, exports) {"); | 257 v8::String::New("(function(require, requireNative, exports) {"); |
| 253 v8::Handle<v8::String> right = v8::String::New("\n})"); | 258 v8::Handle<v8::String> right = v8::String::New("\n})"); |
| 254 return handle_scope.Close( | 259 return handle_scope.Close( |
| 255 v8::String::Concat(left, v8::String::Concat(source, right))); | 260 v8::String::Concat(left, v8::String::Concat(source, right))); |
| 256 } | 261 } |
| 257 | 262 |
| 258 v8::Handle<v8::Value> ModuleSystem::ThrowException(const std::string& message) { | 263 v8::Handle<v8::Value> ModuleSystem::ThrowException(const std::string& message) { |
| 259 return v8::ThrowException(v8::String::New(message.c_str())); | 264 return v8::ThrowException(v8::String::New(message.c_str())); |
| 260 } | 265 } |
| OLD | NEW |