OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 // Flags: --allow-natives-syntax --expose-gc | 5 // Flags: --allow-natives-syntax --expose-gc |
6 | 6 |
7 "use strict"; | 7 "use strict"; |
8 | 8 |
9 | 9 |
10 function checkPrototypeChain(object, constructors) { | 10 function checkPrototypeChain(object, constructors) { |
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
913 log.push("tostring"); | 913 log.push("tostring"); |
914 f.prototype = p3; return "biep" }}; | 914 f.prototype = p3; return "biep" }}; |
915 | 915 |
916 Object.defineProperty(pattern, Symbol.match, { | 916 Object.defineProperty(pattern, Symbol.match, { |
917 get() { log.push("match"); f.prototype = p2; return false; }}); | 917 get() { log.push("match"); f.prototype = p2; return false; }}); |
918 | 918 |
919 var o = Reflect.construct(RegExp, [pattern], f); | 919 var o = Reflect.construct(RegExp, [pattern], f); |
920 assertEquals(["match", "tostring"], log); | 920 assertEquals(["match", "tostring"], log); |
921 // TODO(littledan): Is the RegExp constructor correct to create | 921 // TODO(littledan): Is the RegExp constructor correct to create |
922 // the internal slots and do these type checks this way? | 922 // the internal slots and do these type checks this way? |
923 assertEquals("biep", %_RegExpSource(o)); | |
924 assertThrows(() => Object.getOwnPropertyDescriptor(RegExp.prototype, | 923 assertThrows(() => Object.getOwnPropertyDescriptor(RegExp.prototype, |
925 'source').get(o), | 924 'source').get(o), |
926 TypeError); | 925 TypeError); |
927 assertEquals("/undefined/undefined", RegExp.prototype.toString.call(o)); | 926 assertEquals("/undefined/undefined", RegExp.prototype.toString.call(o)); |
928 assertTrue(o.__proto__ === p2); | 927 assertTrue(o.__proto__ === p2); |
929 assertTrue(f.prototype === p3); | 928 assertTrue(f.prototype === p3); |
930 })(); | 929 })(); |
OLD | NEW |