tor-browser

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

Close-reason-unpaired-surrogates.any.js (762B)


      1 // META: script=constants.sub.js
      2 // META: variant=?default
      3 // META: variant=?wss
      4 // META: variant=?wpt_flags=h2
      5 
      6 var test = async_test("Create WebSocket - Close the Connection - close(reason with unpaired surrogates) - connection should get closed");
      7 
      8 var wsocket = CreateWebSocket(false, false);
      9 var isOpenCalled = false;
     10 var replacementChar = "\uFFFD";
     11 var reason = "\uD807";
     12 
     13 wsocket.addEventListener('open', test.step_func(function(evt) {
     14  wsocket.close(1000, reason);
     15  isOpenCalled = true;
     16 }), true);
     17 
     18 wsocket.addEventListener('close', test.step_func(function(evt) {
     19  assert_true(isOpenCalled, "WebSocket connection should be opened");
     20  assert_equals(evt.reason, replacementChar, "reason replaced with replacement character");
     21  test.done();
     22 }), true);