Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 417 | 417 |
| 418 | 418 |
| 419 var long = "a"; | 419 var long = "a"; |
| 420 for (var i = 0; i < 100000; i++) { | 420 for (var i = 0; i < 100000; i++) { |
| 421 long = "a?" + long; | 421 long = "a?" + long; |
| 422 } | 422 } |
| 423 // Don't crash on this one, but maybe throw an exception. | 423 // Don't crash on this one, but maybe throw an exception. |
| 424 try { | 424 try { |
| 425 RegExp(long).exec("a"); | 425 RegExp(long).exec("a"); |
| 426 } catch (e) { | 426 } catch (e) { |
| 427 print(e); | |
|
mvstanton
2015/05/18 06:17:31
nit: is the print needed?
| |
| 427 assertTrue(String(e).indexOf("Stack overflow") >= 0, "overflow"); | 428 assertTrue(String(e).indexOf("Stack overflow") >= 0, "overflow"); |
| 428 } | 429 } |
| 429 | 430 |
| 430 | 431 |
| 431 // Test that compile works on modified objects | 432 // Test that compile works on modified objects |
| 432 var re = /re+/; | 433 var re = /re+/; |
| 433 assertEquals("re+", re.source); | 434 assertEquals("re+", re.source); |
| 434 assertFalse(re.global); | 435 assertFalse(re.global); |
| 435 assertFalse(re.ignoreCase); | 436 assertFalse(re.ignoreCase); |
| 436 assertFalse(re.multiline); | 437 assertFalse(re.multiline); |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 709 // Test that RegExp.prototype.toString() throws TypeError for | 710 // Test that RegExp.prototype.toString() throws TypeError for |
| 710 // incompatible receivers (ES5 section 15.10.6 and 15.10.6.4). | 711 // incompatible receivers (ES5 section 15.10.6 and 15.10.6.4). |
| 711 assertThrows("RegExp.prototype.toString.call(null)", TypeError); | 712 assertThrows("RegExp.prototype.toString.call(null)", TypeError); |
| 712 assertThrows("RegExp.prototype.toString.call(0)", TypeError); | 713 assertThrows("RegExp.prototype.toString.call(0)", TypeError); |
| 713 assertThrows("RegExp.prototype.toString.call('')", TypeError); | 714 assertThrows("RegExp.prototype.toString.call('')", TypeError); |
| 714 assertThrows("RegExp.prototype.toString.call(false)", TypeError); | 715 assertThrows("RegExp.prototype.toString.call(false)", TypeError); |
| 715 assertThrows("RegExp.prototype.toString.call(true)", TypeError); | 716 assertThrows("RegExp.prototype.toString.call(true)", TypeError); |
| 716 assertThrows("RegExp.prototype.toString.call([])", TypeError); | 717 assertThrows("RegExp.prototype.toString.call([])", TypeError); |
| 717 assertThrows("RegExp.prototype.toString.call({})", TypeError); | 718 assertThrows("RegExp.prototype.toString.call({})", TypeError); |
| 718 assertThrows("RegExp.prototype.toString.call(function(){})", TypeError); | 719 assertThrows("RegExp.prototype.toString.call(function(){})", TypeError); |
| OLD | NEW |