tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

S15.1.3.2_A1.12_T3.js (1263B)


      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 esid: sec-decodeuricomponent-encodeduricomponent
     11 description: >
     12    Complex tests, string.charAt(k + 10) and string.charAt(k + 11)  do
     13    not represent hexadecimal digits
     14 ---*/
     15 
     16 //CHECK
     17 var result = true;
     18 var interval = [
     19  [0x00, 0x2F],
     20  [0x3A, 0x40],
     21  [0x47, 0x60],
     22  [0x67, 0xFFFF]
     23 ];
     24 for (var indexI = 0; indexI < interval.length; indexI++) {
     25  for (var indexJ = interval[indexI][0]; indexJ <= interval[indexI][1]; indexJ++) {
     26    try {
     27      decodeURIComponent("%F0" + "%A0%A0%" + String.fromCharCode(indexJ, indexJ));
     28      result = false;
     29    } catch (e) {
     30      if ((e instanceof URIError) !== true) {
     31        result = false;
     32      }
     33    }
     34  }
     35 }
     36 
     37 if (result !== true) {
     38  throw new Test262Error('#1: If B = 11110xxx (n = 4) and (string.charAt(k + 10) and string.charAt(k + 11)) do not represent hexadecimal digits, throw URIError');
     39 }
     40 
     41 reportCompare(0, 0);