Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(745)

Side by Side Diff: test/mjsunit/regress/regress-603.js

Issue 6930006: Make RegExp objects not callable. (Closed)
Patch Set: Address review comments Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/mjsunit/regexp-call-as-function.js ('k') | test/mjsunit/regress/regress-752.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 11 matching lines...) Expand all
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 // Calling non-objects directly or via Function.prototype.call should 28 // Calling non-objects directly or via Function.prototype.call should
29 // not mess up the stack. 29 // not mess up the stack.
30 // http://code.google.com/p/v8/issues/detail?id=603 30 // http://code.google.com/p/v8/issues/detail?id=603
31 31
32 function test0() { 32 var re = /b../;
33 var re = /b../; 33 assertThrows(function() {
34 return re('abcdefghijklm') + 'z'; 34 return re('abcdefghijklm') + 'z';
35 } 35 });
36 assertEquals('bcdz', test0());
37 36
38 var re1 = /c../; 37 var re1 = /c../;
39 re1.call = Function.prototype.call; 38 re1.call = Function.prototype.call;
40 var test1 = re1.call(null, 'abcdefghijklm') + 'z'; 39 assertThrows(function() {
41 assertEquals('cdez', test1); 40 re1.call(null, 'abcdefghijklm') + 'z';
41 });
42 42
43 var re2 = /d../; 43 var re2 = /d../;
44 var test2 = Function.prototype.call.call(re2, null, 'abcdefghijklm') + 'z'; 44 assertThrows(function() {
45 assertEquals('defz', test2); 45 Function.prototype.call.call(re2, null, 'abcdefghijklm') + 'z';
46 });
46 47
47 var re3 = /e../; 48 var re3 = /e../;
48 var test3 = Function.prototype.call.apply(re3, [null, 'abcdefghijklm']) + 'z'; 49 assertThrows(function() {
49 assertEquals('efgz', test3); 50 Function.prototype.call.apply(
51 re3, [null, 'abcdefghijklm']) + 'z';
52 });
53
54 var re4 = /f../;
55 assertThrows(function() {
56 Function.prototype.apply.call(
57 re4, null, ['abcdefghijklm']) + 'z';
58 });
59
60 var re5 = /g../;
61 assertThrows(function() {
62 Function.prototype.apply.apply(
63 re4, [null, ['abcdefghijklm']]) + 'z';
64 });
OLDNEW
« no previous file with comments | « test/mjsunit/regexp-call-as-function.js ('k') | test/mjsunit/regress/regress-752.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698