tor-browser

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

006.html (1063B)


      1 <!doctype html>
      2 <title>WebSockets: send() with unpaired surrogate when readyState is OPEN</title>
      3 <script src=/resources/testharness.js></script>
      4 <script src=/resources/testharnessreport.js></script>
      5 <script src=../../../constants.sub.js></script>
      6 <meta name="variant" content="?default">
      7 <meta name="variant" content="?wss">
      8 <meta name="variant" content="?wpt_flags=h2">
      9 <div id="log"></div>
     10 <script>
     11 async_test(function(t) {
     12  var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/echo');
     13  ws.onopen = t.step_func(function(e) {
     14    // lone low surrogate, lone high surrogate + surrogates in wrong order.
     15    ws.send('a\uDC00xb\uD800xc\uDC00\uD800x');
     16  })
     17  ws.onmessage = t.step_func(function(e) {
     18    assert_equals(e.data, 'a\uFFFDxb\uFFFDxc\uFFFD\uFFFDx');
     19    ws.onclose = t.step_func(function(e) {
     20      ws.onclose = t.unreached_func();
     21      t.step_timeout(() => t.done(), 50);
     22    });
     23    ws.close();
     24  })
     25  // This will be overridden if the message event fires.
     26  ws.onclose = t.unreached_func('close event should not fire before message event');
     27 });
     28 </script>