| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/extension_error.h" | 5 #include "extensions/browser/extension_error.h" |
| 6 | 6 |
| 7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "extensions/common/constants.h" | 9 #include "extensions/common/constants.h" |
| 10 #include "url/gurl.h" | 10 #include "url/gurl.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 stack_trace_.size() == error->stack_trace_.size() && | 141 stack_trace_.size() == error->stack_trace_.size() && |
| 142 (stack_trace_.empty() || stack_trace_[0] == error->stack_trace_[0]); | 142 (stack_trace_.empty() || stack_trace_[0] == error->stack_trace_[0]); |
| 143 } | 143 } |
| 144 | 144 |
| 145 void RuntimeError::CleanUpInit() { | 145 void RuntimeError::CleanUpInit() { |
| 146 // If the error came from a generated background page, the "context" is empty | 146 // If the error came from a generated background page, the "context" is empty |
| 147 // because there's no visible URL. We should set context to be the generated | 147 // because there's no visible URL. We should set context to be the generated |
| 148 // background page in this case. | 148 // background page in this case. |
| 149 GURL source_url = GURL(source_); | 149 GURL source_url = GURL(source_); |
| 150 if (context_url_.is_empty() && | 150 if (context_url_.is_empty() && |
| 151 source_url.path() == | 151 source_url.path_piece() == |
| 152 std::string("/") + kGeneratedBackgroundPageFilename) { | 152 std::string("/") + kGeneratedBackgroundPageFilename) { |
| 153 context_url_ = source_url; | 153 context_url_ = source_url; |
| 154 } | 154 } |
| 155 | 155 |
| 156 // In some instances (due to the fact that we're reusing error reporting from | 156 // In some instances (due to the fact that we're reusing error reporting from |
| 157 // other systems), the source won't match up with the final entry in the stack | 157 // other systems), the source won't match up with the final entry in the stack |
| 158 // trace. (For instance, in a browser action error, the source is the page - | 158 // trace. (For instance, in a browser action error, the source is the page - |
| 159 // sometimes the background page - but the error is thrown from the script.) | 159 // sometimes the background page - but the error is thrown from the script.) |
| 160 // Make the source match the stack trace, since that is more likely the cause | 160 // Make the source match the stack trace, since that is more likely the cause |
| 161 // of the error. | 161 // of the error. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 184 return ExtensionError::GetDebugString() + | 184 return ExtensionError::GetDebugString() + |
| 185 "\n Type: InternalError"; | 185 "\n Type: InternalError"; |
| 186 } | 186 } |
| 187 | 187 |
| 188 bool InternalError::IsEqualImpl(const ExtensionError* rhs) const { | 188 bool InternalError::IsEqualImpl(const ExtensionError* rhs) const { |
| 189 // ExtensionError logic is sufficient for comparison. | 189 // ExtensionError logic is sufficient for comparison. |
| 190 return true; | 190 return true; |
| 191 } | 191 } |
| 192 | 192 |
| 193 } // namespace extensions | 193 } // namespace extensions |
| OLD | NEW |