OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 3844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3855 | 3855 |
3856 | 3856 |
3857 ExpectBoolean("undetectable===null", false); | 3857 ExpectBoolean("undetectable===null", false); |
3858 ExpectBoolean("null===undetectable", false); | 3858 ExpectBoolean("null===undetectable", false); |
3859 ExpectBoolean("undetectable===undefined", false); | 3859 ExpectBoolean("undetectable===undefined", false); |
3860 ExpectBoolean("undefined===undetectable", false); | 3860 ExpectBoolean("undefined===undetectable", false); |
3861 ExpectBoolean("undetectable===undetectable", true); | 3861 ExpectBoolean("undetectable===undetectable", true); |
3862 } | 3862 } |
3863 | 3863 |
3864 | 3864 |
| 3865 THREADED_TEST(VoidLiteral) { |
| 3866 v8::HandleScope scope; |
| 3867 LocalContext env; |
| 3868 |
| 3869 Local<v8::FunctionTemplate> desc = |
| 3870 v8::FunctionTemplate::New(0, v8::Handle<Value>()); |
| 3871 desc->InstanceTemplate()->MarkAsUndetectable(); // undetectable |
| 3872 |
| 3873 Local<v8::Object> obj = desc->GetFunction()->NewInstance(); |
| 3874 env->Global()->Set(v8_str("undetectable"), obj); |
| 3875 |
| 3876 ExpectBoolean("undefined == void 0", true); |
| 3877 ExpectBoolean("undetectable == void 0", true); |
| 3878 ExpectBoolean("null == void 0", true); |
| 3879 ExpectBoolean("undefined === void 0", true); |
| 3880 ExpectBoolean("undetectable === void 0", false); |
| 3881 ExpectBoolean("null === void 0", false); |
| 3882 |
| 3883 ExpectBoolean("void 0 == undefined", true); |
| 3884 ExpectBoolean("void 0 == undetectable", true); |
| 3885 ExpectBoolean("void 0 == null", true); |
| 3886 ExpectBoolean("void 0 === undefined", true); |
| 3887 ExpectBoolean("void 0 === undetectable", false); |
| 3888 ExpectBoolean("void 0 === null", false); |
| 3889 |
| 3890 ExpectString("(function() {" |
| 3891 " try {" |
| 3892 " return x === void 0;" |
| 3893 " } catch(e) {" |
| 3894 " return e.toString();" |
| 3895 " }" |
| 3896 "})()", |
| 3897 "ReferenceError: x is not defined"); |
| 3898 ExpectString("(function() {" |
| 3899 " try {" |
| 3900 " return void 0 === x;" |
| 3901 " } catch(e) {" |
| 3902 " return e.toString();" |
| 3903 " }" |
| 3904 "})()", |
| 3905 "ReferenceError: x is not defined"); |
| 3906 } |
| 3907 |
3865 | 3908 |
3866 THREADED_TEST(ExtensibleOnUndetectable) { | 3909 THREADED_TEST(ExtensibleOnUndetectable) { |
3867 v8::HandleScope scope; | 3910 v8::HandleScope scope; |
3868 LocalContext env; | 3911 LocalContext env; |
3869 | 3912 |
3870 Local<v8::FunctionTemplate> desc = | 3913 Local<v8::FunctionTemplate> desc = |
3871 v8::FunctionTemplate::New(0, v8::Handle<Value>()); | 3914 v8::FunctionTemplate::New(0, v8::Handle<Value>()); |
3872 desc->InstanceTemplate()->MarkAsUndetectable(); // undetectable | 3915 desc->InstanceTemplate()->MarkAsUndetectable(); // undetectable |
3873 | 3916 |
3874 Local<v8::Object> obj = desc->GetFunction()->NewInstance(); | 3917 Local<v8::Object> obj = desc->GetFunction()->NewInstance(); |
(...skipping 10684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14559 CHECK_EQ(v8_str("DONT_CHANGE"), obj->Get(v8_str("1"))); | 14602 CHECK_EQ(v8_str("DONT_CHANGE"), obj->Get(v8_str("1"))); |
14560 obj->Set(v8_num(2), v8_str("DONT_CHANGE"), v8::ReadOnly); | 14603 obj->Set(v8_num(2), v8_str("DONT_CHANGE"), v8::ReadOnly); |
14561 obj->Set(v8_num(2), v8_str("foobar")); | 14604 obj->Set(v8_num(2), v8_str("foobar")); |
14562 CHECK_EQ(v8_str("DONT_CHANGE"), obj->Get(v8_num(2))); | 14605 CHECK_EQ(v8_str("DONT_CHANGE"), obj->Get(v8_num(2))); |
14563 | 14606 |
14564 // Test non-smi case. | 14607 // Test non-smi case. |
14565 obj->Set(v8_str("2000000000"), v8_str("DONT_CHANGE"), v8::ReadOnly); | 14608 obj->Set(v8_str("2000000000"), v8_str("DONT_CHANGE"), v8::ReadOnly); |
14566 obj->Set(v8_str("2000000000"), v8_str("foobar")); | 14609 obj->Set(v8_str("2000000000"), v8_str("foobar")); |
14567 CHECK_EQ(v8_str("DONT_CHANGE"), obj->Get(v8_str("2000000000"))); | 14610 CHECK_EQ(v8_str("DONT_CHANGE"), obj->Get(v8_str("2000000000"))); |
14568 } | 14611 } |
OLD | NEW |