Don't ever crash on JavaScript errors in stable/beta channels. Previously we
would crash extension pages regardless, but turns out this is too crashy.

BUG=258526
[email protected]

Review URL: https://codereview.chromium.org/21069007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214453 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/renderer/extensions/module_system.cc b/chrome/renderer/extensions/module_system.cc
index 86cb0d94..ab6a15f 100644
--- a/chrome/renderer/extensions/module_system.cc
+++ b/chrome/renderer/extensions/module_system.cc
@@ -34,20 +34,11 @@
 //  - Whether it's valid.
 //  - The extension ID, if one exists.
 //
-// This will crash web pages, but only in dev channel. It will always crash
-// extension processes. It will always crash in single process mode (since
-// typically it's used to debug renderer crashes).
+// This will only actual be fatal in in dev/canary, since in too many cases
+// we're at the mercy of the extension or web page's environment. They can mess
+// up our JS in unexpected ways. Hopefully dev/canary channel will pick up such
+// problems, but given the wider variety on stable/beta it's impossible to know.
 void Fatal(ChromeV8Context* context, const std::string& message) {
-  bool is_fatal = false;
-  const CommandLine* command_line = CommandLine::ForCurrentProcess();
-  if (command_line->HasSwitch(switches::kExtensionProcess) ||
-      command_line->HasSwitch(switches::kSingleProcess)) {
-    is_fatal = true;
-  } else {
-    // <= dev means dev, canary, and trunk.
-    is_fatal = Feature::GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV;
-  }
-
   // Prepend some context metadata.
   std::string full_message = "(";
   if (!context->is_valid())
@@ -61,7 +52,8 @@
   full_message += ") ";
   full_message += message;
 
-  if (is_fatal)
+  // <= dev means dev, canary, and trunk.
+  if (Feature::GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV)
     console::Fatal(v8::Context::GetCalling(), full_message);
   else
     console::Error(v8::Context::GetCalling(), full_message);