Backed out changeset b462e7b742d8 (bug 1908261) for causing multiple reftest failures...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance / programs / invalid-UTF-16.html
blob238552a5e6b277111882a58ce264dd4da2814ea9
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 -->
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.');
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('');
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.
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;
45 </script>
46 <script src="../../js/js-test-post.js"></script>
47 </body>
48 </html>