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 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1104 })(); | 1104 })(); |
1105 | 1105 |
1106 | 1106 |
1107 (function TestStrictArgumentPills() { | 1107 (function TestStrictArgumentPills() { |
1108 function strict() { | 1108 function strict() { |
1109 "use strict"; | 1109 "use strict"; |
1110 return arguments; | 1110 return arguments; |
1111 } | 1111 } |
1112 | 1112 |
1113 var args = strict(); | 1113 var args = strict(); |
1114 CheckArgumentsPillDescriptor(args, "caller"); | 1114 assertEquals(undefined, Object.getOwnPropertyDescriptor(args, "caller")); |
1115 CheckArgumentsPillDescriptor(args, "callee"); | 1115 CheckArgumentsPillDescriptor(args, "callee"); |
1116 | 1116 |
1117 args = strict(17, "value", strict); | 1117 args = strict(17, "value", strict); |
1118 assertEquals(17, args[0]) | 1118 assertEquals(17, args[0]) |
1119 assertEquals("value", args[1]) | 1119 assertEquals("value", args[1]) |
1120 assertEquals(strict, args[2]); | 1120 assertEquals(strict, args[2]); |
1121 CheckArgumentsPillDescriptor(args, "caller"); | 1121 assertEquals(undefined, Object.getOwnPropertyDescriptor(args, "caller")); |
1122 CheckArgumentsPillDescriptor(args, "callee"); | 1122 CheckArgumentsPillDescriptor(args, "callee"); |
1123 | 1123 |
1124 function outer() { | 1124 function outer() { |
1125 "use strict"; | 1125 "use strict"; |
1126 function inner() { | 1126 function inner() { |
1127 return arguments; | 1127 return arguments; |
1128 } | 1128 } |
1129 return inner; | 1129 return inner; |
1130 } | 1130 } |
1131 | 1131 |
1132 var args = outer()(); | 1132 var args = outer()(); |
1133 CheckArgumentsPillDescriptor(args, "caller"); | 1133 assertEquals(undefined, Object.getOwnPropertyDescriptor(args, "caller")); |
1134 CheckArgumentsPillDescriptor(args, "callee"); | 1134 CheckArgumentsPillDescriptor(args, "callee"); |
1135 | 1135 |
1136 args = outer()(17, "value", strict); | 1136 args = outer()(17, "value", strict); |
1137 assertEquals(17, args[0]) | 1137 assertEquals(17, args[0]) |
1138 assertEquals("value", args[1]) | 1138 assertEquals("value", args[1]) |
1139 assertEquals(strict, args[2]); | 1139 assertEquals(strict, args[2]); |
1140 CheckArgumentsPillDescriptor(args, "caller"); | 1140 assertEquals(undefined, Object.getOwnPropertyDescriptor(args, "caller")); |
1141 CheckArgumentsPillDescriptor(args, "callee"); | 1141 CheckArgumentsPillDescriptor(args, "callee"); |
1142 })(); | 1142 })(); |
1143 | 1143 |
1144 | 1144 |
1145 (function TestNonStrictFunctionCallerPillSimple() { | 1145 (function TestNonStrictFunctionCallerPillSimple() { |
1146 function return_my_caller() { | 1146 function return_my_caller() { |
1147 return return_my_caller.caller; | 1147 return return_my_caller.caller; |
1148 } | 1148 } |
1149 | 1149 |
1150 function strict() { | 1150 function strict() { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1222 assertSame(null, test(i)); | 1222 assertSame(null, test(i)); |
1223 } | 1223 } |
1224 })(); | 1224 })(); |
1225 | 1225 |
1226 | 1226 |
1227 (function TestStrictModeEval() { | 1227 (function TestStrictModeEval() { |
1228 "use strict"; | 1228 "use strict"; |
1229 eval("var eval_local = 10;"); | 1229 eval("var eval_local = 10;"); |
1230 assertThrows(function() { return eval_local; }, ReferenceError); | 1230 assertThrows(function() { return eval_local; }, ReferenceError); |
1231 })(); | 1231 })(); |
OLD | NEW |