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.
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>
16 <p id=
"description"></p>
17 <div id=
"console"></div>
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.');
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('');
28 // In order to make this test not depend on WebGL, the following were
30 // - Send a string to console.log
31 // - Submit a mailto: form containing a text input with the bogus
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.
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");
44 var successfullyParsed
= true;
46 <script src=
"../../js/js-test-post.js"></script>