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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // Check that the debugger correctly reflects that the receiver is not | 77 // Check that the debugger correctly reflects that the receiver is not |
78 // converted to object for strict mode functions. | 78 // converted to object for strict mode functions. |
79 function Strict() { "use strict"; debugger; } | 79 function Strict() { "use strict"; debugger; } |
80 function TestStrict(receiver) { | 80 function TestStrict(receiver) { |
81 expected_receiver = receiver; | 81 expected_receiver = receiver; |
82 Strict.call(receiver); | 82 Strict.call(receiver); |
83 } | 83 } |
84 | 84 |
85 listener_delegate = function(exec_state) { | 85 listener_delegate = function(exec_state) { |
86 var receiver = exec_state.frame().receiver(); | 86 var receiver = exec_state.frame().receiver(); |
87 assertTrue(!receiver.isObject()); | |
88 assertEquals(expected_receiver, receiver.value()) | 87 assertEquals(expected_receiver, receiver.value()) |
89 } | 88 } |
90 | 89 |
91 BeginTest("strict: undefined"); TestStrict(undefined); EndTest(); | 90 BeginTest("strict: undefined"); TestStrict(undefined); EndTest(); |
92 BeginTest("strict: null"); TestStrict(null); EndTest(); | 91 BeginTest("strict: null"); TestStrict(null); EndTest(); |
93 BeginTest("strict: 1"); TestStrict(1); EndTest(); | 92 BeginTest("strict: 1"); TestStrict(1); EndTest(); |
94 BeginTest("strict: 1.2"); TestStrict(1.2); EndTest(); | 93 BeginTest("strict: 1.2"); TestStrict(1.2); EndTest(); |
95 BeginTest("strict: 'asdf'"); TestStrict('asdf'); EndTest(); | 94 BeginTest("strict: 'asdf'"); TestStrict('asdf'); EndTest(); |
96 BeginTest("strict: true"); TestStrict(true); EndTest(); | 95 BeginTest("strict: true"); TestStrict(true); EndTest(); |
97 | 96 |
98 | 97 |
99 // Check that the debugger correctly reflects the object conversion of | 98 // Check that the debugger correctly reflects the object conversion of |
100 // the receiver for non-strict mode functions. | 99 // the receiver for non-strict mode functions. |
101 function NonStrict() { debugger; } | 100 function NonStrict() { debugger; } |
102 function TestNonStrict(receiver) { | 101 function TestNonStrict(receiver) { |
103 // null and undefined should be transformed to the global object and | 102 // null and undefined should be transformed to the global object and |
104 // primitives should be wrapped. | 103 // primitives should be wrapped. |
105 expected_receiver = (receiver == null) ? this : Object(receiver); | 104 expected_receiver = (receiver == null) ? this : Object(receiver); |
106 NonStrict.call(receiver); | 105 NonStrict.call(receiver); |
107 } | 106 } |
108 | 107 |
109 listener_delegate = function(exec_state) { | 108 listener_delegate = function(exec_state) { |
110 var receiver = exec_state.frame().receiver(); | 109 var receiver = exec_state.frame().receiver(); |
111 assertTrue(receiver.isObject()); | |
112 assertEquals(expected_receiver, receiver.value()); | 110 assertEquals(expected_receiver, receiver.value()); |
113 } | 111 } |
114 | 112 |
115 BeginTest("non-strict: undefined"); TestNonStrict(undefined); EndTest(); | 113 BeginTest("non-strict: undefined"); TestNonStrict(undefined); EndTest(); |
116 BeginTest("non-strict: null"); TestNonStrict(null); EndTest(); | 114 BeginTest("non-strict: null"); TestNonStrict(null); EndTest(); |
117 BeginTest("non-strict: 1"); TestNonStrict(1); EndTest(); | 115 BeginTest("non-strict: 1"); TestNonStrict(1); EndTest(); |
118 BeginTest("non-strict: 1.2"); TestNonStrict(1.2); EndTest(); | 116 BeginTest("non-strict: 1.2"); TestNonStrict(1.2); EndTest(); |
119 BeginTest("non-strict: 'asdf'"); TestNonStrict('asdf'); EndTest(); | 117 BeginTest("non-strict: 'asdf'"); TestNonStrict('asdf'); EndTest(); |
120 BeginTest("non-strict: true"); TestNonStrict(true); EndTest(); | 118 BeginTest("non-strict: true"); TestNonStrict(true); EndTest(); |
121 | 119 |
122 | 120 |
123 assertEquals(begin_test_count, break_count, | 121 assertEquals(begin_test_count, break_count, |
124 'one or more tests did not enter the debugger'); | 122 'one or more tests did not enter the debugger'); |
125 assertEquals(begin_test_count, end_test_count, | 123 assertEquals(begin_test_count, end_test_count, |
126 'one or more tests did not have its result checked'); | 124 'one or more tests did not have its result checked'); |
OLD | NEW |