OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 if (k + 2 >= uriLength) throw new $URIError("URI malformed"); | 198 if (k + 2 >= uriLength) throw new $URIError("URI malformed"); |
199 var cc = URIHexCharsToCharCode(uri.charAt(++k), uri.charAt(++k)); | 199 var cc = URIHexCharsToCharCode(uri.charAt(++k), uri.charAt(++k)); |
200 if (cc >> 7) { | 200 if (cc >> 7) { |
201 var n = 0; | 201 var n = 0; |
202 while (((cc << ++n) & 0x80) != 0) ; | 202 while (((cc << ++n) & 0x80) != 0) ; |
203 if (n == 1 || n > 4) throw new $URIError("URI malformed"); | 203 if (n == 1 || n > 4) throw new $URIError("URI malformed"); |
204 var octets = new $Array(n); | 204 var octets = new $Array(n); |
205 octets[0] = cc; | 205 octets[0] = cc; |
206 if (k + 3 * (n - 1) >= uriLength) throw new $URIError("URI malformed"); | 206 if (k + 3 * (n - 1) >= uriLength) throw new $URIError("URI malformed"); |
207 for (var i = 1; i < n; i++) { | 207 for (var i = 1; i < n; i++) { |
208 k++; | 208 if (uri.charAt(++k) != '%') throw new $URIError("URI malformed"); |
209 octets[i] = URIHexCharsToCharCode(uri.charAt(++k), uri.charAt(++k)); | 209 octets[i] = URIHexCharsToCharCode(uri.charAt(++k), uri.charAt(++k)); |
210 } | 210 } |
211 index = URIDecodeOctets(octets, result, index); | 211 index = URIDecodeOctets(octets, result, index); |
212 } else { | 212 } else { |
213 if (reserved(cc)) { | 213 if (reserved(cc)) { |
214 result[index++] = 37; // Char code of '%'. | 214 result[index++] = 37; // Char code of '%'. |
215 result[index++] = uri.charCodeAt(k - 1); | 215 result[index++] = uri.charCodeAt(k - 1); |
216 result[index++] = uri.charCodeAt(k); | 216 result[index++] = uri.charCodeAt(k); |
217 } else { | 217 } else { |
218 result[index++] = cc; | 218 result[index++] = cc; |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 "escape", URIEscape, | 405 "escape", URIEscape, |
406 "unescape", URIUnescape, | 406 "unescape", URIUnescape, |
407 "decodeURI", URIDecode, | 407 "decodeURI", URIDecode, |
408 "decodeURIComponent", URIDecodeComponent, | 408 "decodeURIComponent", URIDecodeComponent, |
409 "encodeURI", URIEncode, | 409 "encodeURI", URIEncode, |
410 "encodeURIComponent", URIEncodeComponent | 410 "encodeURIComponent", URIEncodeComponent |
411 )); | 411 )); |
412 } | 412 } |
413 | 413 |
414 SetupURI(); | 414 SetupURI(); |
415 | |
OLD | NEW |