| 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/extensions/module_system.h" | 5 #include "chrome/renderer/extensions/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" |
| 11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
| 13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
| 14 #include "chrome/common/extensions/extension_messages.h" | 14 #include "chrome/common/extensions/extension_messages.h" |
| 15 #include "chrome/common/extensions/features/feature_channel.h" |
| 15 #include "chrome/renderer/extensions/chrome_v8_context.h" | 16 #include "chrome/renderer/extensions/chrome_v8_context.h" |
| 16 #include "chrome/renderer/extensions/console.h" | 17 #include "chrome/renderer/extensions/console.h" |
| 17 #include "chrome/renderer/extensions/safe_builtins.h" | 18 #include "chrome/renderer/extensions/safe_builtins.h" |
| 18 #include "content/public/renderer/render_view.h" | 19 #include "content/public/renderer/render_view.h" |
| 19 #include "third_party/WebKit/public/web/WebFrame.h" | 20 #include "third_party/WebKit/public/web/WebFrame.h" |
| 20 #include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h" | 21 #include "third_party/WebKit/public/web/WebScopedMicrotaskSuppression.h" |
| 21 | 22 |
| 22 namespace extensions { | 23 namespace extensions { |
| 23 | 24 |
| 24 namespace { | 25 namespace { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 46 full_message += context->GetContextTypeDescription(); | 47 full_message += context->GetContextTypeDescription(); |
| 47 full_message += " context"; | 48 full_message += " context"; |
| 48 if (context->extension()) { | 49 if (context->extension()) { |
| 49 full_message += " for "; | 50 full_message += " for "; |
| 50 full_message += context->extension()->id(); | 51 full_message += context->extension()->id(); |
| 51 } | 52 } |
| 52 full_message += ") "; | 53 full_message += ") "; |
| 53 full_message += message; | 54 full_message += message; |
| 54 | 55 |
| 55 // <= dev means dev, canary, and trunk. | 56 // <= dev means dev, canary, and trunk. |
| 56 if (Feature::GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV) | 57 if (GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV) |
| 57 console::Fatal(v8::Context::GetCalling(), full_message); | 58 console::Fatal(v8::Context::GetCalling(), full_message); |
| 58 else | 59 else |
| 59 console::Error(v8::Context::GetCalling(), full_message); | 60 console::Error(v8::Context::GetCalling(), full_message); |
| 60 } | 61 } |
| 61 | 62 |
| 62 void Warn(const std::string& message) { | 63 void Warn(const std::string& message) { |
| 63 console::Warn(v8::Context::GetCalling(), message); | 64 console::Warn(v8::Context::GetCalling(), message); |
| 64 } | 65 } |
| 65 | 66 |
| 66 // Default exception handler which logs the exception. | 67 // Default exception handler which logs the exception. |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 "(function(require, requireNative, exports, " | 526 "(function(require, requireNative, exports, " |
| 526 "console, " | 527 "console, " |
| 527 "$Array, $Function, $JSON, $Object, $RegExp, $String) {" | 528 "$Array, $Function, $JSON, $Object, $RegExp, $String) {" |
| 528 "'use strict';"); | 529 "'use strict';"); |
| 529 v8::Handle<v8::String> right = v8::String::New("\n})"); | 530 v8::Handle<v8::String> right = v8::String::New("\n})"); |
| 530 return handle_scope.Close( | 531 return handle_scope.Close( |
| 531 v8::String::Concat(left, v8::String::Concat(source, right))); | 532 v8::String::Concat(left, v8::String::Concat(source, right))); |
| 532 } | 533 } |
| 533 | 534 |
| 534 } // namespace extensions | 535 } // namespace extensions |
| OLD | NEW |