https://github.com/web-platform-tests/wpt
Raw File
Tip revision: c2b8c888626597462c9e9261aa1bedd4c4edb850 authored by Frédéric Wang on 27 June 2018, 07:37:03 UTC
Convert to manual test, add a version where the click happens from a subframe
Tip revision: c2b8c88
basic-auth.any.js
// META: script=websocket.sub.js
// META: global=sharedworker,serviceworker

async_test(t => {
  const isSecure = new URL(location.href).scheme === 'https';
  const scheme = isSecure ? 'wss' : 'ws';
  const port = isSecure ? __SECURE__PORT : __PORT;
  const url = scheme + '://' + 'foo:bar@' + __SERVER__NAME + ':' + port + '/basic_auth';
  const ws = new WebSocket(url);
  ws.onopen = () => {
    ws.onclose = ws.onerror = null;
    ws.close();
    t.done();
  };
  ws.onerror = ws.onclose = t.unreached_func('open should succeed');
}, 'HTTP basic authentication should work with WebSockets');

done();
back to top