Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: test/mjsunit/strict-mode.js

Issue 1552223002: ThrowTypeError should not be constructable, so shouldn't have a prototype. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/mjsunit/regress/regress-crbug-573858.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 function CheckFunctionPillDescriptor(func, name) { 1011 function CheckFunctionPillDescriptor(func, name) {
1012 1012
1013 function CheckPill(pill) { 1013 function CheckPill(pill) {
1014 assertEquals("function", typeof pill); 1014 assertEquals("function", typeof pill);
1015 assertInstanceof(pill, Function); 1015 assertInstanceof(pill, Function);
1016 pill.property = "value"; 1016 pill.property = "value";
1017 assertEquals(pill.value, undefined); 1017 assertEquals(pill.value, undefined);
1018 assertThrows(function() { 'use strict'; pill.property = "value"; }, 1018 assertThrows(function() { 'use strict'; pill.property = "value"; },
1019 TypeError); 1019 TypeError);
1020 assertThrows(pill, TypeError); 1020 assertThrows(pill, TypeError);
1021 assertEquals(pill.prototype, (function(){}).prototype); 1021 assertEquals(undefined, pill.prototype);
1022 var d = Object.getOwnPropertyDescriptor(pill, "prototype");
1023 assertFalse(d.writable);
1024 assertFalse(d.configurable);
1025 assertFalse(d.enumerable);
1026 } 1022 }
1027 1023
1028 // Poisoned accessors are no longer own properties 1024 // Poisoned accessors are no longer own properties
1029 func = Object.getPrototypeOf(func); 1025 func = Object.getPrototypeOf(func);
1030 var descriptor = Object.getOwnPropertyDescriptor(func, name); 1026 var descriptor = Object.getOwnPropertyDescriptor(func, name);
1031 CheckPill(descriptor.get) 1027 CheckPill(descriptor.get)
1032 CheckPill(descriptor.set); 1028 CheckPill(descriptor.set);
1033 assertFalse(descriptor.enumerable); 1029 assertFalse(descriptor.enumerable);
1034 // In ES6, restricted function properties are configurable 1030 // In ES6, restricted function properties are configurable
1035 assertTrue(descriptor.configurable); 1031 assertTrue(descriptor.configurable);
1036 } 1032 }
1037 1033
1038 1034
1039 function CheckArgumentsPillDescriptor(func, name) { 1035 function CheckArgumentsPillDescriptor(func, name) {
1040 1036
1041 function CheckPill(pill) { 1037 function CheckPill(pill) {
1042 assertEquals("function", typeof pill); 1038 assertEquals("function", typeof pill);
1043 assertInstanceof(pill, Function); 1039 assertInstanceof(pill, Function);
1044 pill.property = "value"; 1040 pill.property = "value";
1045 assertEquals(pill.value, undefined); 1041 assertEquals(pill.value, undefined);
1046 assertThrows(function() { 'use strict'; pill.property = "value"; }, 1042 assertThrows(function() { 'use strict'; pill.property = "value"; },
1047 TypeError); 1043 TypeError);
1048 assertThrows(pill, TypeError); 1044 assertThrows(pill, TypeError);
1049 assertEquals(pill.prototype, (function(){}).prototype); 1045 assertEquals(undefined, pill.prototype);
1050 var d = Object.getOwnPropertyDescriptor(pill, "prototype");
1051 assertFalse(d.writable);
1052 assertFalse(d.configurable);
1053 assertFalse(d.enumerable);
1054 } 1046 }
1055 1047
1056 var descriptor = Object.getOwnPropertyDescriptor(func, name); 1048 var descriptor = Object.getOwnPropertyDescriptor(func, name);
1057 CheckPill(descriptor.get) 1049 CheckPill(descriptor.get)
1058 CheckPill(descriptor.set); 1050 CheckPill(descriptor.set);
1059 assertFalse(descriptor.enumerable); 1051 assertFalse(descriptor.enumerable);
1060 assertFalse(descriptor.configurable); 1052 assertFalse(descriptor.configurable);
1061 } 1053 }
1062 1054
1063 1055
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 assertSame(null, test(i)); 1216 assertSame(null, test(i));
1225 } 1217 }
1226 })(); 1218 })();
1227 1219
1228 1220
1229 (function TestStrictModeEval() { 1221 (function TestStrictModeEval() {
1230 "use strict"; 1222 "use strict";
1231 eval("var eval_local = 10;"); 1223 eval("var eval_local = 10;");
1232 assertThrows(function() { return eval_local; }, ReferenceError); 1224 assertThrows(function() { return eval_local; }, ReferenceError);
1233 })(); 1225 })();
OLDNEW
« no previous file with comments | « test/mjsunit/regress/regress-crbug-573858.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698