| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 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 17 matching lines...) Expand all Loading... |
| 28 function f() { return this; } | 28 function f() { return this; } |
| 29 | 29 |
| 30 assertFalse(this == null); // the global object shouldn't be null or undefined | 30 assertFalse(this == null); // the global object shouldn't be null or undefined |
| 31 assertEquals('[object global]', String(this)); | 31 assertEquals('[object global]', String(this)); |
| 32 | 32 |
| 33 assertTrue(this === this); | 33 assertTrue(this === this); |
| 34 assertTrue(this === (function() { return this; })()); | 34 assertTrue(this === (function() { return this; })()); |
| 35 assertTrue(this === f()); | 35 assertTrue(this === f()); |
| 36 | 36 |
| 37 var x = {}, y = {}; | 37 var x = {}, y = {}; |
| 38 x.f = y.f = f; | 38 x.f = y.f = f; |
| 39 assertFalse(x === f()); | 39 assertFalse(x === f()); |
| 40 assertFalse(y === f()); | 40 assertFalse(y === f()); |
| 41 assertTrue(x === x.f()); | 41 assertTrue(x === x.f()); |
| 42 assertTrue(x === x[new String('f')]()); | 42 assertTrue(x === x[new String('f')]()); |
| 43 assertTrue(y === y.f(), "y.f()"); | 43 assertTrue(y === y.f(), "y.f()"); |
| 44 assertTrue(y === y[new String('f')]()); | 44 assertTrue(y === y[new String('f')]()); |
| 45 assertFalse(x === y.f()); | 45 assertFalse(x === y.f()); |
| 46 assertFalse(y === x.f()); | 46 assertFalse(y === x.f()); |
| OLD | NEW |