OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 22030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
22041 v8::JSON::Parse(context.local(), v8_str("{\"x\":42}")).ToLocalChecked(); | 22041 v8::JSON::Parse(context.local(), v8_str("{\"x\":42}")).ToLocalChecked(); |
22042 Local<Object> obj = value->ToObject(context.local()).ToLocalChecked(); | 22042 Local<Object> obj = value->ToObject(context.local()).ToLocalChecked(); |
22043 Local<Object> global = context->Global(); | 22043 Local<Object> global = context->Global(); |
22044 global->Set(context.local(), v8_str("obj"), obj).FromJust(); | 22044 global->Set(context.local(), v8_str("obj"), obj).FromJust(); |
22045 Local<String> json = | 22045 Local<String> json = |
22046 v8::JSON::Stringify(context.local(), obj).ToLocalChecked(); | 22046 v8::JSON::Stringify(context.local(), obj).ToLocalChecked(); |
22047 v8::String::Utf8Value utf8(json); | 22047 v8::String::Utf8Value utf8(json); |
22048 ExpectString("JSON.stringify(obj)", *utf8); | 22048 ExpectString("JSON.stringify(obj)", *utf8); |
22049 } | 22049 } |
22050 | 22050 |
| 22051 THREADED_TEST(JSONStringifyObjectWithGap) { |
| 22052 LocalContext context; |
| 22053 HandleScope scope(context->GetIsolate()); |
| 22054 Local<Value> value = |
| 22055 v8::JSON::Parse(context.local(), v8_str("{\"x\":42}")).ToLocalChecked(); |
| 22056 Local<Object> obj = value->ToObject(context.local()).ToLocalChecked(); |
| 22057 Local<Object> global = context->Global(); |
| 22058 global->Set(context.local(), v8_str("obj"), obj).FromJust(); |
| 22059 Local<String> json = |
| 22060 v8::JSON::Stringify(context.local(), obj, v8_str("*")).ToLocalChecked(); |
| 22061 v8::String::Utf8Value utf8(json); |
| 22062 ExpectString("JSON.stringify(obj, null, '*')", *utf8); |
| 22063 } |
| 22064 |
22051 #if V8_OS_POSIX && !V8_OS_NACL | 22065 #if V8_OS_POSIX && !V8_OS_NACL |
22052 class ThreadInterruptTest { | 22066 class ThreadInterruptTest { |
22053 public: | 22067 public: |
22054 ThreadInterruptTest() : sem_(0), sem_value_(0) { } | 22068 ThreadInterruptTest() : sem_(0), sem_value_(0) { } |
22055 ~ThreadInterruptTest() {} | 22069 ~ThreadInterruptTest() {} |
22056 | 22070 |
22057 void RunTest() { | 22071 void RunTest() { |
22058 InterruptThread i_thread(this); | 22072 InterruptThread i_thread(this); |
22059 i_thread.Start(); | 22073 i_thread.Start(); |
22060 | 22074 |
(...skipping 3083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
25144 } | 25158 } |
25145 | 25159 |
25146 TEST(PrivateForApiIsNumber) { | 25160 TEST(PrivateForApiIsNumber) { |
25147 LocalContext context; | 25161 LocalContext context; |
25148 v8::Isolate* isolate = CcTest::isolate(); | 25162 v8::Isolate* isolate = CcTest::isolate(); |
25149 v8::HandleScope scope(isolate); | 25163 v8::HandleScope scope(isolate); |
25150 | 25164 |
25151 // Shouldn't crash. | 25165 // Shouldn't crash. |
25152 v8::Private::ForApi(isolate, v8_str("42")); | 25166 v8::Private::ForApi(isolate, v8_str("42")); |
25153 } | 25167 } |
OLD | NEW |