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/chrome_v8_context.h" | 5 #include "chrome/renderer/extensions/chrome_v8_context.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 v8::Boolean::New(isolate(), success), | 166 v8::Boolean::New(isolate(), success), |
167 converter->ToV8Value(&response, v8_context_.NewHandle(isolate())), | 167 converter->ToV8Value(&response, v8_context_.NewHandle(isolate())), |
168 v8::String::NewFromUtf8(isolate(), error.c_str()) | 168 v8::String::NewFromUtf8(isolate(), error.c_str()) |
169 }; | 169 }; |
170 | 170 |
171 v8::Handle<v8::Value> retval = module_system_->CallModuleMethod( | 171 v8::Handle<v8::Value> retval = module_system_->CallModuleMethod( |
172 "sendRequest", "handleResponse", arraysize(argv), argv); | 172 "sendRequest", "handleResponse", arraysize(argv), argv); |
173 | 173 |
174 // In debug, the js will validate the callback parameters and return a | 174 // In debug, the js will validate the callback parameters and return a |
175 // string if a validation error has occured. | 175 // string if a validation error has occured. |
176 if (DCHECK_IS_ON()) { | 176 DCHECK(retval.IsEmpty() || retval->IsUndefined()) |
177 if (!retval.IsEmpty() && !retval->IsUndefined()) { | 177 << *v8::String::Utf8Value(retval); |
178 std::string error = *v8::String::Utf8Value(retval); | |
179 DCHECK(false) << error; | |
180 } | |
181 } | |
182 } | 178 } |
183 | 179 |
184 } // namespace extensions | 180 } // namespace extensions |
OLD | NEW |