Close-Reason-124Bytes.any.js (768B)
1 // META: script=constants.sub.js 2 // META: variant=?default 3 // META: variant=?wpt_flags=h2 4 // META: variant=?wss 5 6 var test = async_test("Create WebSocket - Close the Connection - close(code, 'reason more than 123 bytes') - SYNTAX_ERR is thrown"); 7 8 var wsocket = CreateWebSocket(false, false); 9 var isOpenCalled = false; 10 11 wsocket.addEventListener('open', test.step_func(function(evt) { 12 var reason = "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123"; 13 assert_equals(reason.length, 124); 14 assert_throws_dom("SYNTAX_ERR", function() { 15 wsocket.close(1000, reason) 16 }); 17 test.done(); 18 }), true); 19 20 wsocket.addEventListener('close', test.unreached_func('close event should not fire'), true);