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 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file contains support for URI manipulations written in | 5 // This file contains support for URI manipulations written in |
6 // JavaScript. | 6 // JavaScript. |
7 | 7 |
8 (function(global, utils) { | 8 (function(global, utils) { |
9 | 9 |
10 "use strict"; | 10 "use strict"; |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 }; | 212 }; |
213 return Decode(uri, reservedPredicate); | 213 return Decode(uri, reservedPredicate); |
214 } | 214 } |
215 | 215 |
216 // ECMA-262 - 15.1.3.2. | 216 // ECMA-262 - 15.1.3.2. |
217 function URIDecodeComponent(component) { | 217 function URIDecodeComponent(component) { |
218 var reservedPredicate = function(cc) { return false; }; | 218 var reservedPredicate = function(cc) { return false; }; |
219 return Decode(component, reservedPredicate); | 219 return Decode(component, reservedPredicate); |
220 } | 220 } |
221 | 221 |
222 // ECMA-262 - 15.1.3.3. | |
223 function URIEncode(uri) { | |
224 uri = TO_STRING(uri); | |
225 return %URIEncode(uri, true); | |
226 } | |
227 | |
228 // ECMA-262 - 15.1.3.4 | |
229 function URIEncodeComponent(component) { | |
230 component = TO_STRING(component); | |
231 return %URIEncode(component, false); | |
232 } | |
233 | |
234 // ------------------------------------------------------------------- | 222 // ------------------------------------------------------------------- |
235 // Install exported functions. | 223 // Install exported functions. |
236 | 224 |
237 // Set up non-enumerable URI functions on the global object and set | 225 // Set up non-enumerable URI functions on the global object and set |
238 // their names. | 226 // their names. |
239 utils.InstallFunctions(global, DONT_ENUM, [ | 227 utils.InstallFunctions(global, DONT_ENUM, [ |
240 "escape", URIEscapeJS, | 228 "escape", URIEscapeJS, |
241 "unescape", URIUnescapeJS, | 229 "unescape", URIUnescapeJS, |
242 "decodeURI", URIDecode, | 230 "decodeURI", URIDecode, |
243 "decodeURIComponent", URIDecodeComponent, | 231 "decodeURIComponent", URIDecodeComponent |
244 "encodeURI", URIEncode, | |
245 "encodeURIComponent", URIEncodeComponent | |
246 ]); | 232 ]); |
247 | 233 |
248 }) | 234 }) |
OLD | NEW |