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

Side by Side Diff: src/string.js

Issue 7685005: Inserted a missing string encoding check in lastIndexOf. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Included a test case. Created 9 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 var patLength = pat.length; 142 var patLength = pat.length;
143 var index = subLength - patLength; 143 var index = subLength - patLength;
144 if (%_ArgumentsLength() > 1) { 144 if (%_ArgumentsLength() > 1) {
145 var position = ToNumber(%_Arguments(1)); 145 var position = ToNumber(%_Arguments(1));
146 if (!NUMBER_IS_NAN(position)) { 146 if (!NUMBER_IS_NAN(position)) {
147 position = TO_INTEGER(position); 147 position = TO_INTEGER(position);
148 if (position < 0) { 148 if (position < 0) {
149 position = 0; 149 position = 0;
150 } 150 }
151 if (position + patLength < subLength) { 151 if (position + patLength < subLength) {
152 index = position 152 index = position;
153 } 153 }
154 } 154 }
155 } 155 }
156 if (index < 0) { 156 if (index < 0) {
157 return -1; 157 return -1;
158 } 158 }
159 return %StringLastIndexOf(sub, pat, index); 159 return %StringLastIndexOf(sub, pat, index);
160 } 160 }
161 161
162 162
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 "italics", StringItalics, 990 "italics", StringItalics,
991 "small", StringSmall, 991 "small", StringSmall,
992 "strike", StringStrike, 992 "strike", StringStrike,
993 "sub", StringSub, 993 "sub", StringSub,
994 "sup", StringSup 994 "sup", StringSup
995 )); 995 ));
996 } 996 }
997 997
998 998
999 SetupString(); 999 SetupString();
OLDNEW
« src/runtime.cc ('K') | « src/runtime.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698