| 1 |
// Copyright 2009 the Sputnik authors. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
info: | |
| 6 |
If B = 11110xxx (n = 4) and (string.charAt(k + 4) and |
| 7 |
string.charAt(k + 5)) or (string.charAt(k + 7) and |
| 8 |
string.charAt(k + 8)) or (string.charAt(k + 10) and |
| 9 |
string.charAt(k + 11)) do not represent hexadecimal digits, throw URIError |
| 10 |
es5id: 15.1.3.1_A1.12_T3 |
| 11 |
es6id: 18.2.6.2 |
| 12 |
esid: sec-decodeuri-encodeduri |
| 13 |
description: > |
| 14 |
Complex tests, string.charAt(k + 10) and string.charAt(k + 11) do |
| 15 |
not represent hexadecimal digits |
| 16 |
---*/ |
| 17 |
|
| 18 |
//CHECK |
| 19 |
var result = true; |
| 20 |
var interval = [ |
| 21 |
[0x00, 0x29], |
| 22 |
[0x40, 0x40], |
| 23 |
[0x47, 0x60], |
| 24 |
[0x67, 0xFFFF] |
| 25 |
]; |
| 26 |
for (var indexI = 0; indexI < interval.length; indexI++) { |
| 27 |
for (var indexJ = interval[indexI][0]; indexJ <= interval[indexI][1]; indexJ++) { |
| 28 |
try { |
| 29 |
decodeURI("%F0" + "%A0%A0%" + String.fromCharCode(indexJ, indexJ)); |
| 30 |
result = false; |
| 31 |
} catch (e) { |
| 32 |
if ((e instanceof URIError) !== true) { |
| 33 |
result = false; |
| 34 |
} |
| 35 |
} |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
if (result !== true) { |
| 40 |
$ERROR('#1: If B = 11110xxx (n = 4) and (string.charAt(k + 10) and string.charAt(k + 11)) do not represent hexadecimal digits, throw URIError'); |
| 41 |
} |