| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/renderer/module_system.h" | 5 #include "extensions/renderer/module_system.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 // Default exception handler which logs the exception. | 66 // Default exception handler which logs the exception. |
| 67 class DefaultExceptionHandler : public ModuleSystem::ExceptionHandler { | 67 class DefaultExceptionHandler : public ModuleSystem::ExceptionHandler { |
| 68 public: | 68 public: |
| 69 explicit DefaultExceptionHandler(ScriptContext* context) | 69 explicit DefaultExceptionHandler(ScriptContext* context) |
| 70 : context_(context) {} | 70 : context_(context) {} |
| 71 | 71 |
| 72 // Fatally dumps the debug info from |try_catch| to the console. | 72 // Fatally dumps the debug info from |try_catch| to the console. |
| 73 // Make sure this is never used for exceptions that originate in external | 73 // Make sure this is never used for exceptions that originate in external |
| 74 // code! | 74 // code! |
| 75 virtual void HandleUncaughtException(const v8::TryCatch& try_catch) OVERRIDE { | 75 virtual void HandleUncaughtException(const v8::TryCatch& try_catch) override { |
| 76 v8::HandleScope handle_scope(context_->isolate()); | 76 v8::HandleScope handle_scope(context_->isolate()); |
| 77 std::string stack_trace = "<stack trace unavailable>"; | 77 std::string stack_trace = "<stack trace unavailable>"; |
| 78 if (!try_catch.StackTrace().IsEmpty()) { | 78 if (!try_catch.StackTrace().IsEmpty()) { |
| 79 v8::String::Utf8Value stack_value(try_catch.StackTrace()); | 79 v8::String::Utf8Value stack_value(try_catch.StackTrace()); |
| 80 if (*stack_value) | 80 if (*stack_value) |
| 81 stack_trace.assign(*stack_value, stack_value.length()); | 81 stack_trace.assign(*stack_value, stack_value.length()); |
| 82 else | 82 else |
| 83 stack_trace = "<could not convert stack trace to string>"; | 83 stack_trace = "<could not convert stack trace to string>"; |
| 84 } | 84 } |
| 85 Fatal(context_, CreateExceptionString(try_catch) + "{" + stack_trace + "}"); | 85 Fatal(context_, CreateExceptionString(try_catch) + "{" + stack_trace + "}"); |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 v8::Handle<v8::Value> value) { | 661 v8::Handle<v8::Value> value) { |
| 662 if (!is_valid()) | 662 if (!is_valid()) |
| 663 return; | 663 return; |
| 664 v8::HandleScope handle_scope(GetIsolate()); | 664 v8::HandleScope handle_scope(GetIsolate()); |
| 665 v8::Handle<v8::Promise::Resolver> resolver_local( | 665 v8::Handle<v8::Promise::Resolver> resolver_local( |
| 666 v8::Local<v8::Promise::Resolver>::New(GetIsolate(), *resolver)); | 666 v8::Local<v8::Promise::Resolver>::New(GetIsolate(), *resolver)); |
| 667 resolver_local->Resolve(value); | 667 resolver_local->Resolve(value); |
| 668 } | 668 } |
| 669 | 669 |
| 670 } // namespace extensions | 670 } // namespace extensions |
| OLD | NEW |