OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 } | 42 } |
43 | 43 |
44 try { | 44 try { |
45 Object.create("foo"); | 45 Object.create("foo"); |
46 print(2); | 46 print(2); |
47 assertTrue(false); | 47 assertTrue(false); |
48 } catch (e) { | 48 } catch (e) { |
49 assertTrue(/Object or null/.test(e)); | 49 assertTrue(/Object or null/.test(e)); |
50 } | 50 } |
51 | 51 |
| 52 try { |
| 53 Object.create(null, this); |
| 54 assertTrue(false); |
| 55 } catch(e) { |
| 56 assertTrue(/Property description/.test(e)) |
| 57 } |
| 58 |
| 59 try { |
| 60 Object.create(null, [1, 2, 3]); |
| 61 assertTrue(false); |
| 62 } catch(e) { |
| 63 assertTrue(/Property description/.test(e)) |
| 64 } |
| 65 |
| 66 try { |
| 67 Object.create(null, new Proxy([1, 2, 3], {})); |
| 68 assertTrue(false); |
| 69 } catch(e) { |
| 70 assertTrue(/Property description/.test(e)) |
| 71 } |
| 72 |
52 var ctr = 0; | 73 var ctr = 0; |
53 var ctr2 = 0; | 74 var ctr2 = 0; |
54 var ctr3 = 0; | 75 var ctr3 = 0; |
55 var ctr4 = 0; | 76 var ctr4 = 0; |
56 var ctr5 = 0; | 77 var ctr5 = 0; |
57 var ctr6 = 1000; | 78 var ctr6 = 1000; |
58 | 79 |
59 var protoFoo = { foo: function() { ctr++; }}; | 80 var protoFoo = { foo: function() { ctr++; }}; |
60 var fooValue = { foo: { writable: true, value: function() { ctr2++; }}}; | 81 var fooValue = { foo: { writable: true, value: function() { ctr2++; }}}; |
61 var fooGetter = { foo: { get: function() { return ctr3++; }}}; | 82 var fooGetter = { foo: { get: function() { return ctr3++; }}}; |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 | 273 |
253 (function createWithEmptyProtoInfoCreateMap() { | 274 (function createWithEmptyProtoInfoCreateMap() { |
254 var proto = {a:1}; | 275 var proto = {a:1}; |
255 var instance = {__proto__: proto }; | 276 var instance = {__proto__: proto }; |
256 // Try force creation of prototype info on proto by loading a proto property. | 277 // Try force creation of prototype info on proto by loading a proto property. |
257 assertEquals(instance.a, 1); | 278 assertEquals(instance.a, 1); |
258 var result = Object.create(proto, {}); | 279 var result = Object.create(proto, {}); |
259 assertEquals(result.a, 1); | 280 assertEquals(result.a, 1); |
260 assertEquals(result.__proto__, proto); | 281 assertEquals(result.__proto__, proto); |
261 })() | 282 })() |
OLD | NEW |