content/canvas/test/webgl-conformance/conformance/programs/invalid-UTF-16.html

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

     1 <!--
     2 Copyright (c) 2011 The Chromium Authors. All rights reserved.
     3 Use of this source code is governed by a BSD-style license that can be
     4 found in the LICENSE file.
     5  -->
     6 <!DOCTYPE html>
     7 <html>
     8 <head>
     9 <meta charset="utf-8">
    10 <link rel="stylesheet" href="../../resources/js-test-style.css">
    11 <script src="../../resources/js-test-pre.js"></script>
    12 <script src="../resources/webgl-test.js"></script>
    13 </head>
    14 <body>
    15 <p id="description"></p>
    16 <div id="console"></div>
    17 <script>
    18     if (window.initNonKhronosFramework) {
    19         window.initNonKhronosFramework(false);
    20     }
    21 </script>
    22 <script>
    23 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.');
    25 var array = [];
    26 array.push(String.fromCharCode(0x48)); // H
    27 array.push(String.fromCharCode(0x69)); // i
    28 array.push(String.fromCharCode(0xd87e)); // Bogus
    29 var string = array.join('');
    31 // In order to make this test not depend on WebGL, the following were
    32 // attempted:
    33 //  - Send a string to console.log
    34 //  - Submit a mailto: form containing a text input with the bogus
    35 //    string
    36 // The first code path does not perform a utf8 conversion of the
    37 // incoming string unless Console::shouldPrintExceptions() returns
    38 // true. The second seems to sanitize the form's input before
    39 // converting it to a UTF8 string.
    41 var gl = create3DContext();
    42 var program = gl.createProgram();
    43 gl.bindAttribLocation(program, 0, string);
    44 testPassed("bindAttribLocation with invalid UTF-16 did not crash");
    46 successfullyParsed = true;
    47 </script>
    48 <script>finishTest();</script>
    49 </body>
    50 </html>

mercurial