OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project 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 <errno.h> | 5 #include <errno.h> |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 #include <string.h> | 7 #include <string.h> |
8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 1788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1799 v8::String::NewFromUtf8(isolate_, "receive", v8::NewStringType::kNormal) | 1799 v8::String::NewFromUtf8(isolate_, "receive", v8::NewStringType::kNormal) |
1800 .ToLocalChecked(); | 1800 .ToLocalChecked(); |
1801 Local<Context> context = context_.Get(isolate_); | 1801 Local<Context> context = context_.Get(isolate_); |
1802 Local<Value> callback = | 1802 Local<Value> callback = |
1803 context->Global()->Get(context, callback_name).ToLocalChecked(); | 1803 context->Global()->Get(context, callback_name).ToLocalChecked(); |
1804 if (callback->IsFunction()) { | 1804 if (callback->IsFunction()) { |
1805 v8::TryCatch try_catch(isolate_); | 1805 v8::TryCatch try_catch(isolate_); |
1806 Local<Value> args[] = {message}; | 1806 Local<Value> args[] = {message}; |
1807 MaybeLocal<Value> result = Local<Function>::Cast(callback)->Call( | 1807 MaybeLocal<Value> result = Local<Function>::Cast(callback)->Call( |
1808 context, Undefined(isolate_), 1, args); | 1808 context, Undefined(isolate_), 1, args); |
1809 CHECK(!result.IsEmpty()); // Listeners may not throw. | 1809 #ifdef DEBUG |
| 1810 if (try_catch.HasCaught()) { |
| 1811 Local<Object> exception = Local<Object>::Cast(try_catch.Exception()); |
| 1812 Local<String> key = v8::String::NewFromUtf8(isolate_, "message", |
| 1813 v8::NewStringType::kNormal) |
| 1814 .ToLocalChecked(); |
| 1815 Local<String> expected = |
| 1816 v8::String::NewFromUtf8(isolate_, |
| 1817 "Maximum call stack size exceeded", |
| 1818 v8::NewStringType::kNormal) |
| 1819 .ToLocalChecked(); |
| 1820 CHECK(exception->Get(context, key) |
| 1821 .ToLocalChecked() |
| 1822 ->StrictEquals(expected)); |
| 1823 } |
| 1824 #endif |
1810 } | 1825 } |
1811 } | 1826 } |
1812 | 1827 |
1813 Isolate* isolate_; | 1828 Isolate* isolate_; |
1814 Global<Context> context_; | 1829 Global<Context> context_; |
1815 }; | 1830 }; |
1816 | 1831 |
1817 class InspectorClient : public v8_inspector::V8InspectorClient { | 1832 class InspectorClient : public v8_inspector::V8InspectorClient { |
1818 public: | 1833 public: |
1819 InspectorClient(Local<Context> context, bool connect) { | 1834 InspectorClient(Local<Context> context, bool connect) { |
(...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2949 } | 2964 } |
2950 | 2965 |
2951 } // namespace v8 | 2966 } // namespace v8 |
2952 | 2967 |
2953 | 2968 |
2954 #ifndef GOOGLE3 | 2969 #ifndef GOOGLE3 |
2955 int main(int argc, char* argv[]) { | 2970 int main(int argc, char* argv[]) { |
2956 return v8::Shell::Main(argc, argv); | 2971 return v8::Shell::Main(argc, argv); |
2957 } | 2972 } |
2958 #endif | 2973 #endif |
OLD | NEW |