OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 | 291 |
292 assertThrows(function() { return f.caller; }, TypeError); | 292 assertThrows(function() { return f.caller; }, TypeError); |
293 assertThrows(function() { f.caller = 42; }, TypeError); | 293 assertThrows(function() { f.caller = 42; }, TypeError); |
294 assertThrows(function() { return f.arguments; }, TypeError); | 294 assertThrows(function() { return f.arguments; }, TypeError); |
295 assertThrows(function() { f.arguments = 42; }, TypeError); | 295 assertThrows(function() { f.arguments = 42; }, TypeError); |
296 | 296 |
297 // Shouldn't throw. Accessing the functions caller must throw if | 297 // Shouldn't throw. Accessing the functions caller must throw if |
298 // the caller is strict and the callee isn't. A bound function is built-in, | 298 // the caller is strict and the callee isn't. A bound function is built-in, |
299 // but not considered strict. | 299 // but not considered strict. |
300 (function foo() { return foo.caller; }).bind()(); | 300 (function foo() { return foo.caller; }).bind()(); |
| 301 |
| 302 |
| 303 (function TestProtoIsPreserved() { |
| 304 function fun() {} |
| 305 |
| 306 function proto() {} |
| 307 Object.setPrototypeOf(fun, proto); |
| 308 var bound = fun.bind({}); |
| 309 assertEquals(proto, Object.getPrototypeOf(bound)); |
| 310 |
| 311 Object.setPrototypeOf(fun, null); |
| 312 bound = Function.prototype.bind.call(fun, {}); |
| 313 assertEquals(null, Object.getPrototypeOf(bound)); |
| 314 })(); |
OLD | NEW |