tor-browser

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

invalid-UTF-16.html (1589B)


      1 <!--
      2 Copyright (c) 2019 The Khronos Group Inc.
      3 Use of this source code is governed by an MIT-style license that can be
      4 found in the LICENSE.txt file.
      5 -->
      6 
      7 <!DOCTYPE html>
      8 <html>
      9 <head>
     10 <meta charset="utf-8">
     11 <link rel="stylesheet" href="../../resources/js-test-style.css">
     12 <script src="../../js/js-test-pre.js"></script>
     13 <script src="../../js/webgl-test-utils.js"></script>
     14 </head>
     15 <body>
     16 <p id="description"></p>
     17 <div id="console"></div>
     18 <script>
     19 "use strict";
     20 description('This test verifies that the internal conversion from UTF16 to UTF8 is robust to invalid inputs. Any DOM entry point which converts an incoming string to UTF8 could be used for this test.');
     21 
     22 var array = [];
     23 array.push(String.fromCharCode(0x48)); // H
     24 array.push(String.fromCharCode(0x69)); // i
     25 array.push(String.fromCharCode(0xd87e)); // Bogus
     26 var string = array.join('');
     27 
     28 // In order to make this test not depend on WebGL, the following were
     29 // attempted:
     30 //  - Send a string to console.log
     31 //  - Submit a mailto: form containing a text input with the bogus
     32 //    string
     33 // The first code path does not perform a utf8 conversion of the
     34 // incoming string unless Console::shouldPrintExceptions() returns
     35 // true. The second seems to sanitize the form's input before
     36 // converting it to a UTF8 string.
     37 
     38 var wtu = WebGLTestUtils;
     39 var gl = wtu.create3DContext();
     40 var program = gl.createProgram();
     41 gl.bindAttribLocation(program, 0, string);
     42 testPassed("bindAttribLocation with invalid UTF-16 did not crash");
     43 
     44 var successfullyParsed = true;
     45 </script>
     46 <script src="../../js/js-test-post.js"></script>
     47 </body>
     48 </html>